On Tuesday, April 16, 2013 8:54:35 PM UTC-4, P Purkayastha wrote:
>
> On 04/16/2013 09:57 PM, GaryMak wrote: 
> > Hi 
> > 
> > I am trying to use plot functions for the first time in sage - apologies 
> > if this is a dumb question for a change. 
> > 
> > I have a square matrix M of fixed complex numbers which are then all 
> > multiplied by a different phase depending on which column they are in. 
> > (In the 2x2 example below M=[a,b;c,d] and column 1 is multiplied by 
> > exp(i*theta) and column 2 is multiplied by exp(i*phi) ). I then take 
> > another fixed matrix A away from M and take f=det(M-A).abs() as my 
> > output. I have explicitly written this formula for A = [1,1;0,0] below. 
> > So the function I would like to plot is f as a function of theta and phi 
> > (in this case). 
> > 
> > a = 1/2 
> > b = - i/3 
> > c = 1/4 
> > d = i/5 
> > theta, phi = var('theta,phi') 
> > f(theta,phi) = ( (a*exp(i*theta)-1)*d*exp(i*phi) - 
> > (b*exp(i*phi)-1)*c*exp(i*theta) ) . abs() 
> > plot3d(f, (theta,0,pi), (phi,0,pi)) 
> > 
> > No matter how I try to do this, even if I explicitly write out the 
> > complex conjugates of each element, I get what for me is a record-length 
> > screed of error stuff ending in 'TypeError: unable to coerce to a real 
> > number', originating in the command 'plot3d(...etc...)'. I have attached 
> > a text file with the full output of one of my attempts. 
> > 
> > I can see that in a way I am asking a lot of the interpreter; but then 
> > again I feel I have explicitly made the thing real by the time it gets 
> > to be an input for the plot3d function. 
> > 
> > Is there any way around this, or do I have to start writing complexes as 
> > a+bi etc and do it the hard way? 
> > 
> > Many thanks 
> > 
> > Gary 
>
> The problem is actually in the conversion of your function to a 
> fast_float() version of the function. Apparently, it fails for symbolic 
> "complex" functions (which are not really complex) even in this trivial 
> example: 
>
> f(theta, phi) = (theta + i * phi).abs() 
> ff = fast_float(f, 'theta', 'phi') 
>

See http://trac.sagemath.org/sage_trac/ticket/13355 
and http://trac.sagemath.org/sage_trac/ticket/5572 

ppurka, can you try the patch at #13355 to see if that helps in this case?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to