Gabriel Pannwitz wrote:
> def phi(z):
> return 2*sqrt(3+z)
> def dif(a,b):
> return (phi(a+I*b)-(a+I*b))
> var('x y')
> plot_vector_field((dif(x,y).real(),dif(x,y).imag()),(x,-3,3),
> (y,-3,3)).show()
>
> This returns an error because Maxima does not know: "Is y positive,
> negative, or zero?"
>
> I suspect that this is a bug, since plot_vector_field should pass the
> necessary information about x and y to Maxima.
>
The problem here is that the plot function evaluates the argument and
then substitutes the numbers.
The problem is manifest here:
sage: (dif(x,y).real()).subs(x=1,y=0)
First, maxima is called with 'x' and 'y', returns the result:
sage: dif(x,y)
2*sqrt(I*y + x + 3) - I*y - x
*then* the .real function is called, which produces an error. If it no
error had occurred, *then* the variables would be substituted in.
In other words, the above expressions call
diff(x,y).real().subs(x=1,y=0), which is what plot would do. However,
you want to do diff(x,y).subs(x=1,y=0).real() instead.
If there was a way to not evaluate the real() function until after the
variables were substituted, that would take care of the problem.
I was trying to do this in CDF[x,y] to see if we could solve the problem
there, but I'm having problems with the sqrt function, of course. I
also stumbled across the following (for anyone to answer): why do the
two following statements return different types?)
sage: x,y=polygens(CDF,['x','y'])
sage: type(x*y+CDF(I))
<class
'sage.rings.polynomial.multi_polynomial_element.MPolynomial_polydict'>
sage: type(x*y+I)
<class 'sage.calculus.calculus.SymbolicArithmetic'>
Jason
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---