sympy

Porting matlab functions to scilab. How to use symbolic?

I'm porting some matlab functions to scilab. The cool thing is that there is a conversion toolbox that make things very easy. The problem is I did not find the counter part to the syms function, and the symbolic toolbox in general. (I'd like a port of the Control System Toolbox too, i'm still searching for some functions I'd may need). ...

units conversion in python

sympy is a great tool for doing units conversions in python: >>> from sympy.physics import units >>> 12. * units.inch / units.m 0.304800000000000 You can easily roll your own: >>> units.BTU = 1055.05585 * units.J >>> units.BTU 1055.05585*m**2*kg/s**2 However, I cannot implement this into my application unless I can convert degrees ...

computer algebra soft to minimize the number of operations in a set of polynomials

hello I have systems of polynomials, fairly simple polynomial expressions but rather long to optimize my hand. Expressions are grouped in sets, and in a given set there are common terms in several variables. I would like to know if there is a computer algebra system, such as Mathematica, Matlab, or sympy, which can optimize multiple p...

Basics of SymPy

I am just starting to play with SymPy and I am a bit surprised by some of its behavior, for instance this is not the results I would expect: >>> import sympy as s >>> (-1)**s.I == s.E**(-1* s.pi) False >>> s.I**s.I == s.exp(-s.pi/2) False Why are these returning False and is there a way to get it to convert from one way of writing a c...

sympy: How to return an expression in terms of other expression(s)

I'm fairly new to sympy and have what might be a basic question. Or I might simply be misinterpreting how sympy is supposed to be used. Is there a way to create an expression that is not represented by atoms, but by a combination of other expressions? Ex: >>> from sympy.physics.units import * >>> expr1 = m/s >>> expr2 = mile/hour >>>...

Is it possible to plot implicit equations using Matplotlib?

Hello all - many thanks again to people who have kindly offered help (especially to Mark for his outstanding response to my previous question). I would like to plot implicit equations (of the form f(x,y)=g(x,y) eg. x^y=y^x) in Matplotlib. Is this possible? All the best, Geddes ...

How to format contour lines from Matplotlib

Hello - I am working on using Matplotlib to produce plots of implicit equations (eg. y^x=x^y). With many thanks to the help I have already received I have got quite far with it. I have used a contour line to produce the plot. My remaining problem is with formatting the contour line eg width, color and especially zorder, where the contour...

how to handle an asymptote/discontinuity with Matplotlib

Hello all. Firstly - thanks again for all your help. Sorry not to have accepted the responses to my previous questions as I did not know how the system worked (thanks to Mark for pointing that out!). I have since been back and gratefully acknowledged the kind help I have received. My question: when plotting a graph with a discontinuity/...

Non-sequential substitution in SymPy

I'm trying to use [SymPy][1] to substitute multiple terms in an expression at the same time. I tried the [subs function][2] with a dictionary as parameter, but found out that it substitutes sequentially. In : a.subs({a:b, b:c}) Out: c The problem is the first substitution resulted in a term that can be substituted by the second substi...

How does sympy work? How does it interact with the interactive Python shell, and how does the interactive Python shell work?

What happens internally when I press Enter? My motivation for asking, besides plain curiosity, is to figure out what happens when you from sympy import * and enter an expression. How does it go from Enter to calling __sympifyit_wrapper(a,b) in sympy.core.decorators? (That's the first place winpdb took me when I tried inspecting an...

how to assign new values to variables in predefined equation?

for predefined equations,assigning new values to variables do not changes value of equation. how can i assign new values to variables so that i will get appropriate value of equation and not the previous one a,b,c,d,e,f=sympy.symbols('abcdef') a,b=c,d e=a+b #equation print e c+d #value of eqn a,b=d,f print e c+d #not d+f ...

how to combine exponents? (x**a)**b => x**(a*b)?

how to simplify exponents in equations in sympy from sympy import symbols a,b,c,d,e,f=symbols('abcdef') j=(a**b**5)**(b**10) print j (a**(b**5))**(b**10) #ans even after using expand simplify # desired output a**(b**15) and if it is not possible with sympy which module should i import in python? edit even if i define 'b' as re...

Is it possible for SymPy to render LaTeX for use in a GUI?

Hello all, I am hoping to use PyQt to produce an application that will display an equation entered by the user. I had considered matplotlib, but this seems like overkill as I would only be using it to render the latex. I need to use SymPy anyway, so I was hoping there would be a way to use it to do the rendering also, preferably produc...

Is it possible to save SymPy's image to the image object from PIL Image?

Hi, there. May I ask is it possible to save SymPy's image to the image object from PIL Image? I really need to do this. And so far I 've got no idea around this, please help with this, thank you! ...

Python: How to export Sympy image to png?

Python: How to export Sympy image to png? Who has any idea with this? ...