Yes, that's exactly right. I want to repeatedly evaluate that function. If you look into my next post, I had two lambdify solutions - one involved partially closing the function using subs, and using lambdify each cycle, but that added a lot of overhead. The other involved using lambdify outside of the loop, but that left a binary expression with a lot of redundant calculations. It was still faster than using lambdify every cycle though.
On Thursday, 24 October 2013 19:44:52 UTC+2, Ondřej Čertík wrote: > > On Thu, Oct 24, 2013 at 1:45 AM, Federico Vaggi > <[email protected] <javascript:>> wrote: > > https://gist.github.com/FedericoV/7132880 here you go. > > I see --- the line is just too long. If you write it like this: > > REAL*8 function autofunc(Gal, empty, fullbound_RE, fullbound_closed_RE, & > k_base_synt_p53, k_bindleft_p53_RE, & > k_bindright_p53_RE, k_deg_p53, k_max_synt_p53, k_sat_p53, > k_transclosed, & > k_transhalf, k_transopen, k_unbindleft_p53_RE, k_unbindright_p53_RE, & > leftbound_RE, p53, rightbound_RE) > > then it works. So this is a bug in the sympy generation code, that should > do this automatically. > > > > > This equation is passed to odeint to numerically integrate. Originally, > I > > tried using .subs() to close the function over all the parameters, and > to > > them pass a function where only the variables were open to odeint, but > the > > overhead from using .subs() was way too much. > > You can also look into lambdify(), which generates a very fast numpy or > Python > code. > > > I also looked into your project, csympy for faster subs, but as I > > understand, it cannot handle float substitution yet? > > I can implement the naive floating point evaluation, that should take much > time. > > But the problem with floating point evaluation is that typically, once > the symbolic > expression becomes longer, you get numerical cancellations. So you have > to handle that somehow. > > You simply want to quickly evaluate the expression using double precision? > > Ondrej > -- You received this message because you are subscribed to the Google Groups "sympy" 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/sympy. For more options, visit https://groups.google.com/groups/opt_out.
