Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256 phi_p = 0.0 dF= pi

State = var('State') x = 1 - 2 * State / Tst ps_a=phi_p+4.0dFx ps_b=phi_p+3.0dFx ps_c=phi_p+2.0dFx ps_d=phi_p+1.0dFx ps_e=phi_p+0.0dFx ps_f=phi_p-1.0dFx ps_g=phi_p-2.0dFx ps_h=phi_p-3.0dFx ps_i=phi_p-4.0dFx

px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2) py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2) ps_pc= (atan2 (py, px)) rfs_pc=sqrt(pxpx+pypy)/8

amp = (rfs_pc*cos(ps_pc))

This Breaks: AmpP =[amp(State=r).n() for r in srange(Tst)]

This works, but I need "amp " in another place and it returns the same error. AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256 256

phi_p = 0.0 0.0

dF= pi

State = var('State') var('State')

x = 1 - 2 * State / Tst Tst

ps_a=phi_p+4.0dFx x

ps_b=phi_p+3.0dFx x

ps_c=phi_p+2.0dFx x

ps_d=phi_p+1.0dFx x

ps_e=phi_p+0.0dFx x

ps_f=phi_p-1.0dFx x

ps_g=phi_p-2.0dFx x

ps_h=phi_p-3.0dFx x

ps_i=phi_p-4.0dFx

px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2) (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2)

py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2) (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2)

ps_pc= (atan2 (py, px)) px))

rfs_pc=sqrt(pxpx+pypy)/8

amp = (rfs_pc*cos(ps_pc))

This Breaks: Breaks:

AmpP =[amp(State=r).n() for r in srange(Tst)]

This works, but I need "amp " in another place and it returns the same error. error.

AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256

phi_p = 0.0

dF= pi

State = var('State')

x = 1 - 2 * State / Tst

ps_a=phi_p+4.0dFx

ps_b=phi_p+3.0dFx

ps_c=phi_p+2.0dFx

ps_d=phi_p+1.0dFx

ps_e=phi_p+0.0dFx

ps_f=phi_p-1.0dFx

ps_g=phi_p-2.0dFx

ps_h=phi_p-3.0dFx

ps_i=phi_p-4.0dFx

px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2)

py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2)

ps_pc= (atan2 (py, px))

rfs_pc=sqrt(pxpx+pypy)/8

amp = (rfs_pc*cos(ps_pc))

This Breaks:

AmpP =[amp(State=r).n() for r in srange(Tst)]

This works, but I need "amp " in another place and it returns the same error.

AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

The error is:

Traceback (most recent call last): ps_a=phi_p+4.0dFx

File "", line 1, in <module>

File "/tmp/tmpWGCsSw/___code___.py", line 26, in <module>

AmpP =[amp(State=r).n() for r in srange(Tst)]

File "expression.pyx", line 3902, in sage.symbolic.expression.Expression._numerical_approx (sage/symbolic/expression.cpp:17489)

File "expression.pyx", line 816, in sage.symbolic.expression.Expression._convert (sage/symbolic/expression.cpp:4951)

File "pynac.pyx", line 1369, in sage.symbolic.pynac.py_atan2 (sage/symbolic/pynac.cpp:12772)

ValueError: arctan2(0,0) undefined

click to hide/show revision 4
No.4 Revision

updated 2011-06-02 10:00:51 -0500

kcrisman gravatar image

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256

256 phi_p = 0.0

0.0 dF= pi

pi State = var('State')

var('State') x = 1 - 2 * State / Tst

ps_a=phi_p+4.0dFx

ps_b=phi_p+3.0dFx

ps_c=phi_p+2.0dFx

ps_d=phi_p+1.0dFx

ps_e=phi_p+0.0dFx

ps_f=phi_p-1.0dFx

ps_g=phi_p-2.0dFx

ps_h=phi_p-3.0dFx

ps_i=phi_p-4.0dFx

Tst ps_a=phi_p+4.0*dF*x ps_b=phi_p+3.0*dF*x ps_c=phi_p+2.0*dF*x ps_d=phi_p+1.0*dF*x ps_e=phi_p+0.0*dF*x ps_f=phi_p-1.0*dF*x ps_g=phi_p-2.0*dF*x ps_h=phi_p-3.0*dF*x ps_i=phi_p-4.0*dF*x px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2)

(cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2) py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2)

(sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2) ps_pc= (atan2 (py, px))

rfs_pc=sqrt(pxpx+pypy)/8

px)) rfs_pc=sqrt(px*px+py*py)/8 amp = (rfs_pc*cos(ps_pc))

(rfs_pc*cos(ps_pc))

This Breaks:

AmpP =[amp(State=r).n() for r in srange(Tst)]

srange(Tst)]

This works, but I need "amp " in another place and it returns the same error.

AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

The error is:

Traceback (most recent call last): ps_a=phi_p+4.0dFx

File "", line 1, in <module>

File "/tmp/tmpWGCsSw/___code___.py", line 26, in <module>

AmpP =[amp(State=r).n() =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

File "expression.pyx", line 3902, in sage.symbolic.expression.Expression._numerical_approx (sage/symbolic/expression.cpp:17489)

File "expression.pyx", line 816, in sage.symbolic.expression.Expression._convert (sage/symbolic/expression.cpp:4951)

File "pynac.pyx", line 1369, in sage.symbolic.pynac.py_atan2 (sage/symbolic/pynac.cpp:12772)

ValueError: arctan2(0,0) undefined

click to hide/show revision 5
retagged

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256
phi_p = 0.0
dF= pi
State = var('State')
x =  1 - 2 * State / Tst
ps_a=phi_p+4.0*dF*x
ps_b=phi_p+3.0*dF*x
ps_c=phi_p+2.0*dF*x
ps_d=phi_p+1.0*dF*x
ps_e=phi_p+0.0*dF*x
ps_f=phi_p-1.0*dF*x
ps_g=phi_p-2.0*dF*x
ps_h=phi_p-3.0*dF*x
ps_i=phi_p-4.0*dF*x
px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2)
py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2)
ps_pc= (atan2 (py, px))
rfs_pc=sqrt(px*px+py*py)/8
amp = (rfs_pc*cos(ps_pc))

This Breaks:

AmpP =[amp(State=r).n() for r in srange(Tst)]

This works, but I need "amp " in another place and it returns the same error.

AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]

atan2 bug?

The following generated an error, what am I doing wrong?

Tst = 256
phi_p = 0.0
dF= pi
State = var('State')
x =  1 - 2 * State / Tst
ps_a=phi_p+4.0*dF*x
ps_b=phi_p+3.0*dF*x
ps_c=phi_p+2.0*dF*x
ps_d=phi_p+1.0*dF*x
ps_e=phi_p+0.0*dF*x
ps_f=phi_p-1.0*dF*x
ps_g=phi_p-2.0*dF*x
ps_h=phi_p-3.0*dF*x
ps_i=phi_p-4.0*dF*x
px = (cos(ps_a)/2+cos(ps_b)+cos(ps_c)+cos(ps_d)+cos(ps_e)+cos(ps_f)+cos(ps_g)+cos(ps_h)+cos(ps_i)/2)
py = (sin(ps_a)/2+sin(ps_b)+sin(ps_c)+sin(ps_d)+sin(ps_e)+sin(ps_f)+sin(ps_g)+sin(ps_h)+sin(ps_i)/2)
ps_pc= (atan2 (py, px))
rfs_pc=sqrt(px*px+py*py)/8
amp = (rfs_pc*cos(ps_pc))

This Breaks:

AmpP =[amp(State=r).n() for r in srange(Tst)]

This works, but I need "amp " in another place and it returns the same error.

AmpP =[((rfs_pc(State=r)).n()*cos(ps_pc(State=r))).n() for r in srange(Tst)]