Here is a very confusing printing result, where symbolics seems to
ignore the NaN until trying to numerically approximating something:
This is published in http://sagenb.org/home/pub/1555/, and comes from a
current thread on sage-support.
The NaN in "a" below goes away if I comment out the last term
(-(Nrib+1)*theta(x)/2) in the definition of erseno.
sage: gamma,r,gangle,dz2,Nstep,Nrib,b=var('gamma,r,gangle,dz2,Nstep,Nrib,b')
sage: a=11.5; b=6;#this is fixed
sage: Nstep=2;Nrib=5;Diam=33;gangle=30*2*3.1415/360;gamma=40*0.33+20*0.33;
sage: #these have all to be changed when using different structure
sage: r=(Diam-2*a)/2;th=2*3.1415*Nstep/Nrib;
sage: def theta(dz):
... if 0<=dz<2*r*cot(gangle) : angle= 2*arcsin(dz*tan(gangle)/2/r);
... if 2*r*cot(gangle)<= dz < 2*2*r*cot(gangle) : angle=
2*arcsin((dz-2*r*cot(gangle))/(cot(gangle)*2*r)) - pi;
... if 2*2*r*cot(gangle)<= dz < 4*2*r*cot(gangle) : angle=
2*arcsin((dz-2*2*r*cot(gangle))/(cot(gangle)*2*r)) - 2*pi;
... if 0>=dz>-2*r*cot(gangle) : angle= 2*arcsin(dz*tan(gangle)/2/r);
... if 2*r*cot(gangle)>= dz > -2*2*r*cot(gangle) : angle=
2*arcsin((dz+2*r*cot(gangle))/(cot(gangle)*2*r)) - pi;
... if 2*2*r*cot(gangle)>= dz > -4*2*r*cot(gangle) : angle=
2*arcsin((dz+2*2*r*cot(gangle))/(cot(gangle)*2*r)) - 2*pi;
... return angle;
...
sage: def dz2(dz):
... return (-(Nrib+1)/(Nrib-1)*dz+b*cos(gangle)*2/(Nrib-1))
...
sage: def erseno(x):
... return
2*arcsin(b*sin(gangle)/2/r)-(Nrib-1)*theta(dz2(x))/2-(Nrib+1)*theta(x)/2
sage: a=erseno(0.4)
sage: a
10*pi
sage: a.operands()
[10*pi, NaN]
sage: a.operator()
<built-in function add>
sage: a.n()
NaN
Thanks,
Jason
--
Jason Grout
--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org