[sage-support] Programming animation

2012-02-05 Thread LFS
Hiya!

Is there a relatively simple way to get a point to animate a point
through a cycle keeping in mind my low programming skills ((like
adding a wait between iterations?) ?

I made this video with stop animation and an animated gif but it was a
real pain.
http://www.youtube.com/watch?v=2ddeHKk9ssg

Now I really want to show how the parameter moves through 3d curves
(and then surfaces) 
e.g. I would like to animate a point through the first curve on:
http://sagenb.org/home/pub/4212/

Thanks for any help.  Linda

-- 
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


[sage-support] Numerical approximation of symbolic coefficients

2012-02-05 Thread Michael Orlitzky
I've got these polynomials in two variables, `x`, and `u`. The 
polynomials are low degree (eight at the moment), but I'm working 
symbolically, so they print exactly:


  ..+ 314069483520)*sqrt(3) - 80295755776*x + 4831838208)/(1953125*x^63
- 73828125*x^61...

All I would really like is to see these displayed with approximate 
coefficients, and to compute their roots.


First attempt: loop through each term and try to n() the coefficient. 
Madness.


Second attempt: leave SR and work in `Polynomial`s over RR. This works 
for display purposes, but once I have an MPolynomial_polydict object, I 
can't figure out how to get the roots (potentially in either variable).


I can go back to SR, take the roots, and then.. go back to Polynomials? 
Is there a better way to go about it? I feel like I'm reinventing the wheel.


--
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


Re: [sage-support] Numerical approximation of symbolic coefficients

2012-02-05 Thread D. S. McNeil
 First attempt: loop through each term and try to n() the coefficient.
 Madness.

Based on a suggestion Mike Hansen once gave me --
http://ask.sagemath.org/question/411/substituting-expressions-for-numbers
-- I tend to use subclasses of Converter when I need to do something
like this, so as not to get lost in the madness. :^)  Something like:


from sage.symbolic.expression_conversions import Converter

class Evaluator(Converter):
def arithmetic(self, ex, operator):
return reduce(operator, map(self, ex.operands()))
def pyobject(self, ex, obj):
return ex.n()

sage: E = Evaluator()
sage: var(u x)
(u, x)
sage: q = ((314069483520)*sqrt(3/(sin(u+2)))*u - 80295755776*x +
4831838208)/(1953125*x^63)
sage: q
33554432/1953125*(9360*sqrt(3)*u*sqrt(1/sin(u + 2)) - 2393*x + 144)/x^63
sage: E(q)
17.17986918398*(16211.99555884469*u*(1/sin(u + 2.0))^0.5 -
2393.0*x + 144.0)/x^63.0



Doug

-- 
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