Hi all,
I want (my students) to plot Cornu's spiral, givent in parametric form by
x(t) = integral cos(pi/u^2/2), u going from 0 to t , and y(t) defined
analogously using the sine function. The integral connot be evaluated
symbolically, I guess.
The first attempt would be
parametric_plot([integrate(cos(pi*u^2/2),u,0,t),integrate(sin(pi*u^2/2),u,0,t)],(t,-pi,pi))
which failw (coercion)
The second attempt would be:
parametric_plot([integral_numerical(cos(pi*u^2/2),0,t),integral_numerical(sin(pi*u^2/2),0,t)],(t,-pi,pi))
which also fails.
I finally did:
def x(t):
return integral_numerical(cos(pi*u^2/2),0,t)[0]
def y(t):
return integral_numerical(sin(pi*u^2/2),0,t)[0]
Points = [(x(t),y(t)) for t in sxrange(-pi,pi,2*pi/200)]
line(Points).show(figsize=[5, 5],aspect_ratio=1)
This works, but it looks highly inelegant. Also, i cannot expect my
students to come up with something like this in a first year undergrad
course.
Is there a way to fix one of the first two options?
Regards,
JC
--
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.