4 ms·
The biggest drawback of SymPy is the need to pre-define all your symbols. That makes it more difficult to handle scenarios where you're taking formulas as inp
by bloaf 3y ago
The biggest drawback of SymPy is the need to pre-define all your symbols. That makes it more difficult to handle scenarios where you're taking formulas as input because you either need to parse the equation yourself to figure out what variables were used, or have the user manually supply the symbols.
- staplung 3y agoMight not handle exactly the difficulties you're having but you can do `from sympy.abc import *`. This will create symbols for pretty much all letters (lower and upper) as well as a bunch of greek symbols (but written out, e.g. "delta").
- bloaf 3y agoImagine a scenario where you've got a database of timeseries data, say stock prices. Each price trend is identified by the stock ticker, and your users have an excel spreadsheet of several thousand equations in terms of the stock ticker (e.g. (AAPL-TSLA)/AAPL) and you want to calculate the derivative of each one of those equations with respect to each ticker symbol in each equation before pulling the data. Obviously you could find a list of every ticker symbol and create a few thousand symbols before parsing, but you don't always have the luxury of a complete/up-to-date list, or doing so might create too many symbol objects and cause performance problems.
- rav 3y agoThere `isympy -I`, which runs an IPython REPL with a preprocessor that changes unknown variables into sympy symbols, but that only helps you for interactive usage.
- throw4023042q0 3y agoI usually run a pre-processing step to identify all needed symbols and then create them dynamically. I find sympy works fine for such on-the-fly workflow. My experience is with predictive statistics and financial models.