Error in 2d plotting with romberg as expression....



On 4/13/07, Grzegorz Hermanowicz <herrmannek at interia.pl> wrote:

> I have problem using romberg function inside plot2d. Here is simplified
> example of what I'm trying to do:
>
> > (%i4) plot2d(romberg(x,x,0,t),[t,0,10]);

plot2d (like most Maxima functions) evaluates its arguments.
So romberg(x,x,0,t) is evaluated before a numerical value is
assigned to t; romberg doesn't understand what to do with the
symbolic range (0, t) so it barfs. That is a bug in romberg.

You can postpone evaluation of romberg by enclosing it in a
lambda expression (nameless function).

plot2d (lambda ([t], romberg (x, x, 0, t)), [t, 0, 10]);

By the way, Maxima has more powerful integrations functions
quad_qags etc (which are from the QUADPACK library).
I recommend quad_qags instead of romberg.

Hope this helps,
Robert Dodier