Hi I was unable to follow all your questions but below are some comments On 19 January 2012 18:58, Vinzenz <vbargs...@freenet.de> wrote: > Hi, > since I can't post to the thread > http://groups.google.com/group/sympy/browse_thread/thread/135ed5dc84d87dd5/18b2d34a997b3139?#18b2d34a997b3139 > anymore, here is a summary/continuation of the discussion: > > Thank you very much for your help. > > I have a differential equation such as > ddq = B^-1(q) * ( T - rest(q,dq)) > which I want to numerically evaluate > where ddq is a 7x1 sympy matrix, B 7x7 (can not invert it symbolically > anymore) and q, dq are the supplied input variables. > > So far I used lambdify successfully with ddq (2x1), B (2x2) (can > invert sym.). > > To summarize (correct me if I'm wrong / sth. missing) and current > states: > - symbolic simplification has been primarily discussed. (I will open a > new thread for this) > - expand + rewrite(exp) + expand + rewrite(cos) works but takes > too much memory for larger expressions (especially the 2nd expand) > - with disabled cache it uses much less memory but becomes too > slow > - my calculations are done in sympy, but I export to Mathematica, > simplify, and reimport to sympy at the moment > - I also tried the improved trigsimp which has been posted to the > mailing list recently (was not more successful) > - cse is an option > - there were problems with solve (in which repo is your version, > smichr?) and chop (I use the function you supplied) > > To get back to the original topic (Numerical Evaluation): > - I want to use results I obtained with sympy for simulations using > scipy's ode integrators. > A fast numerical evaluation is therefore desireable. > It would be nice to save the conversion results accross program > executions. > - is it a good idea to use lambdify for large matrices? > - it is quite slow and since I get a function I can't pickle > it, it has to be done each run > - what about generating a py file with function evaluating the > expression with numpy? > - afaik, lambdify replaces functions / operators for e.g. > numpy. could one get the actual expression (to save it, make a > module)? I don't think that there is an option for doing that, but you can edit the lambdify code and add a print statement (just before the eval). I don't know how complicated your expression is but maybe it will be better just to rewrite it by hand (and file issues in our bug tracker for the cases where lambdify or autowrap are too slow). Also bear in mind that lambdify does not play well (for the moment) with more advanced symbolic expression (infinite sums with a parameter for example). > - what about evalf(var1=1234.....)? I have not tested but I bet it will be slower that lambdify because each time it will substitute symbols. On the other hand it will work in cases where lambdify does not. > - what about using autowrap / binary_function? > - see e.g. > http://ojensen.wordpress.com/2010/08/10/fast-ufunc-ish-hydrogen-solutions/ > .I got the example working, but I am not sure if this would help me > (element-wise application) > - What about http://code.google.com/p/numexpr/ ? What would be a > way to convert my sympy expressions so they can be evaluated with > numexpr If you do something with numexpr I'll be interested to know the results. > > I appreciate if you could comment and share your experiences regarding > similar problems. > > Vinzenz > > > PS: Google Groups is funny, hides the list answer buttons without any > hint. @Chris Smith: Sorry for writing directly to you. Also, google > search does not show messages from this mailing list, but 3rd party > sites (which also show the complete mail addresses). > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to sympy@googlegroups.com. > To unsubscribe from this group, send email to > sympy+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. >
-- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com. To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.