Ray, Robert, thanks for your suggestions!
Unfortunaly I'm quite new to Maxima and currently I'm able to use it as
a kind of a big calculator and plotter only. I've tried to find out how
your code works, but didn't make much progress in this.
As I see "quad_qags" is some kind of alternative to "integrate" with
different integration mechanisms and a bit different output. But what
is the [1] after it? "matchdeclare" seems to ensure that xx and yy are
numbers and not variables and "tellsimpafter" seems to make some
simplification rule but I don't understand how it works since the rule
is just foo itself. contour_plot seems to plot the simplified integral.
I suppose that I should replace something to make it work since it
doesn't work by copy&pasting:
foo (x, y) := quag_qags (1/sqrt(1+(1/z-1)*x+(z^2-1)*y),z,0,1) [1];
## foo(x,y):=(quag_qags(1/sqrt(1+(1/z-1)*x+(z^2-1)*y),z,0,1))[1]
matchdeclare ([xx, yy], numberp);
## done
tellsimpafter (%foo (xx, yy), foo (xx, yy));
## [%foorule1,false]
contour_plot (%foo (x, y), [x, -5, 5], [y, -5, 5]);
## false
But unfortunately I don't know what to replace... Could you explain how
it is supposed to work or show a working example, please?
Thanks,
Michael
On Tue, 22 Mar 2011 10:39:06 -0600
Robert Dodier <robert.dodier at gmail.com> schrieb:
> Ray's idea about quad_qags helps.
> I found the following adhockery useful to work around
> a bug in listofvars (which is called by plotting code to
> determine the free variables in the plotting expression).
>
> foo (x, y) := quag_qags (...) [1];
> matchdeclare ([xx, yy], numberp);
> tellsimpafter (%foo (xx, yy), foo (xx, yy));
> contour_plot (%foo (x, y), [x, ...], [y, ...]);
>
> which is just postponing any mention of quad_qags until
> the arguments are bound to numbers.
>
> Interested parties will probably need to experiment with
> the number of grid points and contour levels and other parameters.
>
> HTH
>
> Robert Dodier
>
> On 3/22/11, Raymond Toy <toy.raymond at gmail.com> wrote:
> > On 3/21/11 12:01 PM, Jaime Villate wrote:
> >> On Mon, 2011-03-21 at 14:25 +0100, Michael Kogan wrote:
> >>> implicit_plot(1=integrate(1/sqrt(1+(1/z-1)*x
> >>> +(z^2-1)*y),z,0,1),[x,-5,5],[y,-5,5]);
> >>>
> >>> Output
> >>>
> >>> Maxima encountered a Lisp error:
> >> Hi,
> >> the problem is not with implicit_plot, but with integrate which
> >> cannot solve that integral. Even using one of the numerical
> >> methods in Maxima that integral will fail, because in z=0 the term
> >> 1/z gives you an overflow.
> > Agree with the part about maxima not being able to do the symbolic
> > integration. The integrand is the square root of a cubic, which
> > leads to elliptic integrals, which maxima doesn't know how to do.
> >
> > However, the 1/z term is no problem. quad_qags easily evaluates the
> > integral once values for x and y are substituted. I thought that
> > perhaps changing the call to implicit plot to something like
> >
> > f(x,y):= quad_qags(<integrand>,z,0,1)[1];
> >
> > implicit_plot(f(x,y)-1,[x-5,5],[y,-5,5])
> >
> > would work, but it doesn't.
> >
> > Ray
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima