A computer algebra system written in pure Python http://sympy.org/ . To get started to with contributing https://github.com/sympy/sympy/wiki/Introduction-to-contributing
class MyCoordSys3D(CoordSys3D):
def __init__(self):
self.latex_vects = [r'\mathbf{%s}' % n for n in self.vector_names]
y
or alpha
.
replace
with a pattern.
>>> a, b, c = Wild('a'), Wild('b'), Wild('c')
>>> expr.replace((a**b)**c, a**(b*c))
y
integrate(Heaviside(x,0), (x,-1,1) =1
, but instead sympy returns Integral(Heaviside(x, 0), (x, -1, 1))
. Works fine if I omit the second argument of Heaviside
, but I think it should work in any case, as the value at x=0
is irrelevant for the integration (set of measure zero).
@laolux:privacytools.io Many integrators like meijerint
work by looking up the results in a table. The table may contain Heaviside(x)
but not Heaviside(x, 0)
which is a different object.
>>> Heaviside(x) == Heaviside(x, 0)
False
It may be possible to extend the matching code to handle this but that may not be easy to implement. Another entry should probably be added.
I ran into the following issue/error while trying to get the extrema of a simple 4th order polynomial:
import sympy as sym
x_sym = sym.symbols("x", real=True) # single variable
pot_sym = x_sym**4 - x_sym**2 + x_sym * 1/10 # function f
pot_prime_sym = sym.diff(pot_sym, x_sym) # first derivative of function df/fx
extrema = sym.solve(pot_prime_sym) # get extrema via df/dx == 0
for extremum in extrema:
print(sym.N(extremum), " == ", sym.N(sym.simplify(extremum))) # print values
returns:
0.050253826762553 - 0.e-23*I == 0.050253826762553 + 3.70576914423756e-22*I
0.680639276423668 + 0.e-23*I == 0.680639276423668
-0.730893103186221 + 0.e-23*I == -0.730893103186221
The last two results are equal, but the first entry does seem to cause an error of I simplify the result before returning its numeric value. There should be no complex contribution 3.7e-22*I
, thus something goes wrong here.
Is this a know issue, did I do something wrong, or is this a not-yet know issue and I should open a issue on github?
I am using sympy 1.7.1
.
print(type(curl(H, doit=False)))