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
smichr on master
EmptySet/Complexes/nan usage fix #22338 Merge pull request #22370 from … (compare)
print(type(curl(H, doit=False)))
H
is an Add
object whose arguments are Mul
objects, not a vector.In [10]: srepr(H)
Out[10]: "Add(Mul(T.x, Function('Hx')(Symbol('x'), Symbol('y'), Symbol('z'))), Mul(T.y, Function('Hy')(Symbol('x'), Symbol('y'), Symbol('z'))), Mul(T.z, Function('Hz')(Symbol('x'), Symbol('y'), Symbol('z'))))"
Hi, I'd like to express a vector norm with indexed variables for differentation, but I don't quite know how. Every search I came up with led to matrix norms, which aren't really in question here. The variables are indeed vectors, but I don't care about the dimensionality in this case. Formulating a difference is easy enough, but I'm not sure how to continue.
# || x_a - y_b ||
x = sp.IndexedBase('x')
a = sp.Idx('a')
y = sp.IndexedBase('y')
b = sp.Idx('b')
diff = (x[a] - y[b])
How could this be achieved? I'm open for any other formulations as well! Much appreciated.
Hey guys, I'm trying to use parse_latex
function as below:
In [1]: from sympy.parsing.latex import parse_latex
In [2]: r = "5^0 - 4^0"
In [3]: parse_latex(r)
ANTLR runtime and generated code versions disagree: 4.9.2!=4.7.2
ANTLR runtime and generated code versions disagree: 4.9.2!=4.7.2
Out[3]: -1 + 5**0
Is there anyway, I can stop parse_latex
to render it as 5^ 0 - 4^0
and now evaluate 4^0
as 1
?
lh = 5**0
and rh = 4**0
but -1 * rh
will be evaluated to -1
. If you want to preserve rh
, it looks like -1 * rh
should be replaced by Mul(-1, rh, evaluate=False)
.