<br><br><div class="gmail_quote">On Fri, Oct 29, 2010 at 1:02 AM, Chris Rebert <span dir="ltr"><<a href="mailto:clp2@rebertia.com">clp2@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Oct 28, 2010 at 9:41 PM, Bj Raz <<a href="http://whitequill.bj" target="_blank">whitequill.bj</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> wrote:<br>
> I am working with differential equations of the higher roots of negative<br>
> one. (dividing enormous numbers into other enormous numbers to come out with<br>
> very reasonable numbers).<br>
> I am mixing this in to a script for Maya (the final output is graph-able as<br>
> a spiral.)<br>
> I have heard that Sage, would be a good program to do this in, but I'd like<br>
> to try and get this to work in native python if I can.<br>
> The script I am trying to port to Python is; <a href="http://pastebin.com/sc1jW1n4" target="_blank">http://pastebin.com/sc1jW1n4</a>.<br>
<br>
</div>Unless your code is really long, just include it in the message in the future.<br>
So, for the archive:<br>
indvar = 200;<br>
q = 0;<br>
lnanswer = 0;<br>
for m = 1:150<br>
lnanswer = (3 * m) * log(indvar) - log(factorial(3 * m)) ;<br>
q(m+1) = q(m)+ ((-1)^m) * exp(lnanswer);<br>
end<br>
lnanswer<br>
q<br>
<br>
Also, it helps to point out *what language non-Python code is in*. I'm<br>
guessing MATLAB in this case.<br>
<br>
Naive translation attempt (Disclaimer: I don't know much MATLAB):<br>
<br>
from math import log, factorial, exp<br>
indvar = 200<br>
q = [0]<br>
lnanswer = 0<br>
for m in range(1, 151):<br>
lnanswer = (3 * m) * log(indvar) - log(factorial(3 * m))<br>
q.append(q[-1] + (1 if m % 2 == 0 else -1) * exp(lnanswer))<br>
print(lnanswer)<br>
print(q)<br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888">--<br>
<a href="http://blog.rebertia.com" target="_blank">http://blog.rebertia.com</a><br>
</font></blockquote></div>I'm sorry I didn't read the thread very carefully. thank you for your help Chris. :)