Questions tagged [symbolic-math]

Symbolic math tools allows for analytically process mathematical expressions - without the necessity of assigning specific numeric values to variables.

Common software that allows for symbolic math operations include

See this comparison of computer algebra systems (CAS) for other software packages that support symbolic math operations.

Online examples of Computer Algebra System

1493 questions
13
votes
5 answers

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…
Mad Scientist
  • 18,090
  • 12
  • 83
  • 109
12
votes
2 answers

Maxima: convert matrix to list

I convert list to matrix in Maxima in following way: DataL : [ [1,2], [2,4], [3,6], [4,8] ]; DataM: apply('matrix,DataL); How to do it the other way ? How to convert given matrix DataM into list DataL ?
Grzegorz Wierzowiecki
  • 10,545
  • 9
  • 50
  • 88
12
votes
2 answers

Abstract matrix multiplication with variables

I know about the ability of python to do matrix multiplications. Unfortunately I don't know how to do this abstractly? So not with definite numbers but with variables. Example: M = ( 1 0 ) * ( 1 d ) ( a c ) ( 0 1 ) Is there some way…
hpaantee
  • 147
  • 2
  • 7
12
votes
2 answers

How to expand matrix expressions in SymPy?

In SymPy, I am trying to perform a matrix multiplication and expand it afterwards. However, SymPy does not seem to support the expansion of matrix expressions. For example, here is the 4th order Runge-Kutta (RK4) for matrices: from sympy import…
D.Thomas
  • 349
  • 3
  • 12
11
votes
2 answers

Why does SymPy calculate wrong intersections of planes?

I have the strange problem, that the intersection of planes in SymPy works with simple examples, but fails for one with more complicated coordinates. I post both a simple example that works, and the one that fails. As the Povray images show, I have…
Watchduck
  • 1,076
  • 1
  • 9
  • 29
11
votes
2 answers

SymPy : creating a numpy function from diagonal matrix that takes a numpy array

Building on an example I've found here, I am trying to create a function from a diagonal matrix that was created using sumpy.diag myM = Matrix([ [x1, 4, 4], [4, x2, 4], [4, 4, x3]]) Where this was created using this routine for example: import…
Ohm
  • 2,312
  • 4
  • 36
  • 75
11
votes
2 answers

Constructing piecewise symbolic function in Matlab

I am trying to generate a piecewise symbolic function in Matlab. The reason it has to be symbolic is I want to be able to integrate/differentiate the function afterwards and/or insert actual values. I have the following function: x^3/6 -> 0 < x…
Maximilian Csuk
  • 584
  • 1
  • 6
  • 21
11
votes
2 answers

Sympy: Drop higher order terms in polynomial

Using Sympy, say we have an expression f, which is a polynomial of the Symbol "x" (and of potentially other symbols). I would like to know what if there is an efficient way to drop all terms in f of order greater than some integer n. As a special…
11
votes
4 answers

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 >>>…
Paul
  • 42,322
  • 15
  • 106
  • 123
10
votes
1 answer

Integrating over a constant function

I am trying to integrate over a constant function in MATLAB 2017a, but I am stuck. First of all when I integrate using the following script, I get the right output. So the script works for a x0 which depends on t. function E=sol(n,k) x0 = @(t) …
Airapet
  • 103
  • 6
10
votes
1 answer

Python SymPy: Error while solving inequality

Problem: I am trying to solve an inequality to obtain a variable coeff_rw, which is the value of the symbol rw satisfying the inequality. This value should be in terms of other symbols (variables) that are defined in the following code. I am first…
user238469
10
votes
2 answers

Best way to isolate one coefficient of a multivariate polynomial in sympy

I have a multivariate polynomial (which in the general case many many variables) whose coefficients list some data that I need to read off, but it doesn't seem like sympy gives a good way to do this. The collect function seemed like the right idea,…
xanderflood
  • 826
  • 2
  • 12
  • 22
10
votes
1 answer

How can we convert LaTeX representation to symbolic math functions in matlab?

How can we convert Latex representation into symbolic math. For example, A LaTex representation y = \int x^2 Has an equivalent symbolic math representation as syms x y = int(x*x, x) Is there a function to perform this action? I know that there…
10
votes
4 answers

Map which allows to provide the equals-comparator and the hashing function separately

While trying to model polynomials, in particular their multiplication, I run into the following problem. During the multiplication, the individual monomials of the two polynomials are multiplied and of course in can happen that I have (3x^2 y + 5x…
Harald
  • 4,575
  • 5
  • 33
  • 72
9
votes
2 answers

symbolic computation

My problem: symbolic expression manipulation. A symbolic expression is built starting from integer constants and variable with the help of operators like +, -, *, /, min,max. More exactly I would represent an expression in the following way (Caml…
Calin
  • 1,471
  • 1
  • 15
  • 22