Problem calling erf from lisp



-----maxima-admin@math.utexas.edu wrote: -----

>Suppose I have defined the following functions in 'file.lisp'
>
>(defun $g (x) (mfuncall '$exp (* x x)))
>(defun $h (x) (mfuncall '$sin (* x x)))
>(defun $f (x) (mfuncall '$erf (* x x)))
>
>Now,
>
>(%i2) load("file.lisp")$
>(%i3) g(0.1);
>(%o3)                          1.010050167084168
>(%i4) h(0.1);
>(%o4)                          .0099998333341667
>(%i5) f(0.1);
>(%o5)                              erf(0.01)
>(%i6) %,numer;
>(%o6)                              erf(0.01)
>
>but what I expect is
>
>(%i7) erf(0.01);
>(%o7)                          .0112834155558496

Try

(defun $myerf (x)
  (simplify (list '(%erf) x)))

Yes, it is irritating to have to call erf this way.  And erf ought
to be changed to be consistent with $cos, $sin, ...

If you  get stuck  on something like this again, put the function
definition in a file  and translate the file (use translate_file).
Look at the Lisp code that Maxima generates for a hint.


Barton