Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, at the moment SymPy does not guarantee support for numpy arrays which is what you want in this case. Check this bug report <a href="http://code.google.com/p/sympy/issues/detail?id=537">http://code.google.com/p/sympy/issues/detail?id=537</a></p> <p>Second, If you want to evaluate something numerically for <em>many</em> values SymPy is not the best choice (it is a symbolic library after all). Use numpy and scipy.</p> <p>However, a valid reason to evaluate something numerically will be that deriving the expression to be evaluated was hard so you derive it in SymPy and then evaluate it in NumPy/SciPy/C/Fortran. To translate an expression to numpy just use</p> <pre><code>from sympy.utilities.lambdify import lambdify func = lambdify(x, big_expression_containing_x,'numpy') # returns a numpy-ready function numpy_array_of_results = func(numpy_array_of_arguments) </code></pre> <p>Check the docstring of lambdify for more details. Be aware that lambdify still has some issues and may need a rewrite.</p> <p>And just as a side note, if you want to evaluate the expressions <strong>really</strong> many times, you can use the codegen/autowrap module from sympy in order to create fortran or C code that is wrapped and callable from python.</p> <p>EDIT: An updates list of ways to do numerics in SymPy can be found on the wiki <a href="https://github.com/sympy/sympy/wiki/Philosophy-of-Numerics-and-Code-Generation-in-SymPy">https://github.com/sympy/sympy/wiki/Philosophy-of-Numerics-and-Code-Generation-in-SymPy</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload