Error in 2d plotting with romberg as expression....
Subject: Error in 2d plotting with romberg as expression....
From: Robert Dodier
Date: Fri, 13 Apr 2007 12:56:41 -0600
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