On Monday, August 31, 2015 at 9:58:51 PM UTC-7, saad khalid wrote:
>
> I see, thank you for pointing that out. I ran the sum up to n = 5, just
> for testing, and I was able to run:
> Phi(.1,2/3)
> And have it return:
>
> mpf('-2.0635259684891158')
>
> My code now looks like this:
> var('q')
> var('n')
> var('z')
> Phi = lambda x,q: -ln(1-q) + ln(q)*sum((q^(n*x)/(1-q^n)),n,1,5)
>
>
> However when i try to run:
> plot(Phi(mpf(z),mpf(2/3),(z,1,2)))
>
> I get the error:
> cannot evaluate symbolic expression numerically
>
>
I assume that you have mpf=RR or something similar. The problem is that you
ask
sage: mpf(z)
TypeError: Cannot evaluate symbolic expression to a numeric value.
This goes wrong before Phi or plot even get to be evaluated, or before z is
assigned a numeric value. You should delay this by doing something like:
sage: phispec(z)=Phi(z,2/3)
sage: plot(phispec,(z,1,2))
But in fact, if you let sage take care of the conversions, you can just
write
sage: plot(Phi(z,2/3),(z,1,2))
If you want to be explicit about the conversions to numeric data, you need
to delay the moment when that gets applied to when z actually gets numeric
values. A lambda expression can do that for you:
sage: plot(lambda z: Phi(RR(z),RR(2/3)), (z,1,2))
If it can return numeral values for specific points, why can't it plot those
points? Why is it trying to do it symbolically?
>
>
Because that's what you told it to do.
--
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.
For more options, visit https://groups.google.com/d/optout.