[sympy] Example of code generation for a cubic spline solver

2019-02-18 Thread Mark Dewing
Here's an example that may be of interest that uses Sympy in the context of a scientific application. This Jupyter notebook derives the defining equations for cubic spline coefficients (in tridiagonal matrix form), substitutes those equations into those for a tridiagonal solver (not derived,

Re: [sympy] Re: Contributing to SymPy Paper

2016-04-22 Thread Mark Dewing
LLVMPY. However, > the LLVM project itself is a fast moving project, the interfaces keep > changing. It is hard to maintain the corresponding Python interface and > this is also why llvmlite is designed in its way. > By the way, I'd like to see your code for array evaluation in

Re: [sympy] Re: Contributing to SymPy Paper

2016-04-21 Thread Mark Dewing
I think these are good directions. I also think they should be driven by strong examples (the PyDy example in your repo is good, I see the paper has some others), because that will affect the API. For vectorized evaluation, array data can be stored in different ways, and this affects the

[sympy] Procedures (sequence of statements)?

2014-06-21 Thread Mark Dewing
Currently there exists Lambda, which supports modeling a single expression ( and lambdify, which converts a single expression to Python). It would be useful to have something similar for a sequence of statements. This is called a 'procedure' in Cohen's book (Computer Algebra and Symbol

[sympy] Matrix expression canonicalization

2013-11-21 Thread Mark Dewing
I would like to write an expression using Matrix symbols, and then evaluate it by substituting concrete Matrix values. However, the resulting Matrix expression will not simplify. # set up general expression n = Symbol('n') r1 = MatrixSymbol('r1',n,1) r2 = MatrixSymbol('r2',n,1) d = r2 - r1 #

[sympy] Re: Sympy to AST, generation of generic python code

2011-09-12 Thread Mark Dewing
: Is this the code that lets you type (x + 1).match((Add, (Symbol, Number))) (or something like that)? Could give a summary of the functionality?  Perhaps it should be integrated into the main matcher. Aaron On Friday, September 9, 2011, Mark Dewing wrote: Dimas,  The pattern matching code

[sympy] Re: Sympy to AST, generation of generic python code

2011-09-09 Thread Mark Dewing
Dimas, The pattern matching code I've been working on might be useful to compactly represent this sort of transformation. The code is here: https://github.com/markdewing/sympy/blob/derivation_modeling/sympy/prototype/codegen/pattern_match.py Example of it in use is here (converting to a

[sympy] Re: Tutorial at SciPy 2011 conference

2011-07-15 Thread Mark Dewing
of us gave a lighting talk about SymPy. I talked about SymPy Live and App Engine, and Aaron gave a talk about Risch algorithm (@Aaron: can you put a link to your presentation here or add it to SymPy Presentations?). I forgot to mention that today there was also a talk due to Mark Dewing about

[sympy] Example of modeling derivations

2011-04-23 Thread Mark Dewing
As a part of trying to understand how to create scientific programs assisted by sympy, I've made a computer model of derivations, so each step could be checked by sympy. Finally I have a simple example using the configurational integral in statistical mechanics. It starts from the general

[sympy] Pattern matching for sympy tree transformation

2011-03-31 Thread Mark Dewing
The current method for transforming sympy trees (used in the printers, for example) can require some nested if-tests, even for some simple cases like subtraction (addition of -1 multiplied by the first arg), or division (mutiply by arg to the power of -1). It would be nice to be able to

[sympy] Replacing tuple with Tuple in Sum and Integral

2010-10-03 Thread Mark Dewing
Here's a first pass at replacing the tuple in the Sum/Integral limits with Tuple. http://github.com/markdewing/sympy/tree/limit-tuple All the tests pass, but I didn't try it beyond the set of tests. -- You received this message because you are subscribed to the Google Groups sympy group. To

[sympy] limits for sums and integrals

2010-09-14 Thread Mark Dewing
Is there a reason that limits for sums and integrals are stored differently? For integrals, it appears to be (variable, (lower_limit, upper_limit)) and for sums it appears to be (variable, lower_limit, upper_limit) -- You received this message because you are subscribed to the Google Groups

[sympy] Modeling derivations

2010-06-09 Thread Mark Dewing
Attached is a simple class for modeling the derivation of the Euler method for solving a first order ODE. (Mostly because it's one of the easiest algorithms to start with) Running it outputs all the steps: D(f(x), x) == 2*x (f_1 - f_0)/h == 2*x Approximate derivative with finite difference f_1 -

[sympy] Re: Questions about expression forms

2008-06-08 Thread Mark Dewing
, split, or otherwise transformed? 3. Is adding extra memory usage to the nodes a problem? On Jun 8, 3:27 am, Ondrej Certik [EMAIL PROTECTED] wrote: On Sun, Jun 8, 2008 at 6:13 AM, Mark Dewing [EMAIL PROTECTED] wrote: Several expression forms seem be reduced to a canonical form (both

[sympy] Questions about expression forms

2008-06-07 Thread Mark Dewing
Several expression forms seem be reduced to a canonical form (both in the representation and in the pretty printed output). Examples: 1. Factorial vs. Gamma function 2. Sqrt(radical) vs. a**(1/2) Is there any way to control what form is used? Another case, (i*j)**(1/2) is represented as

Using sympy for code generation.

2008-01-06 Thread Mark Dewing
Here's a use for sympy that I thought might be interesting to the list. Sympy computes derivatives that are then used in generated python code. The code generation code is located here https://quameon.svn.sourceforge.net/svnroot/quameon/trunk/codegen/ In particular, lang_py.py defines nodes