Questions tagged [sympy]

For questions about performing symbolic computations using the SymPy Python library

Filter by
Sorted by
Tagged with
2 votes
1 answer

Large set of nonlinear equations in Sympy

I have a set of 6 nonlinear equations, and using Sympy I find the values of the 6 unknowns. This works perfectly and it directly gives the exact solution, using sympy.solve to be specific. Now I ...
je2703's user avatar
  • 21
0 votes
0 answers

How to express the polynomial in an graded lex (with the descending power of multiple variables)?

from sympy import * from import A,B,C,D,E,F,x,y,U,V,W,X,Y,Z curve = A*x**2+B*x*y+C*y**2+D*x+E*y+F Now that we know such codes above will form the ...
Roseleaves Wu's user avatar
3 votes
1 answer

Using the Kramers-Kronig (Hilbert) transform in Python

I am trying to use the Kramers-Kronig algorithm to transform the real and imaginary contributions to the anomalous scattering factor from a diffraction anomalous fine structure (DAFS) experiment. I ...
ayrton burgess's user avatar
2 votes
1 answer

Index reduction of a DAE from a PDE system

I have a system of 2 non-linear, coupled PDEs that I would like to transform to a stiff ODE system to solve them using the method of lines. The 2 equations: $$\begin{align} \frac{\partial \phi}{\...
Iddingsite's user avatar
1 vote
1 answer

Converting a 4 rank matrix to 2 rank matrix after using tensorproduct

Let's say I have a 2x2 matrix (with symbols) called 'A'. Now, if do B = sympy.tensorproduct(A,A) print(sympy.shape(B)) I get, ...
Shashank Saumya's user avatar
0 votes
0 answers

Do the projection (with Jacobian) and marginalisation (inversion of matrix and remove a row/column and reinversion) commute?

I try to check the equality or the inequality between 2 Fisher matrices. The goal is too see if the projection (with Jacobian) and marginalisation (inversion of matrix and remove a row/column and ...
user avatar
0 votes
0 answers

Negative binomial expansion of general symbolic polynomial

Using Sympy, I would like to compute the negative binomial expansion of a general symbolic polynomial, e.g., $(x_1 + x_2 + x_3 + 4 x_4)^{-1}$. I understand that I can go by recursively partitioning ...
Omar Shehab's user avatar
3 votes
1 answer

Lambdifying a symbolic matrix in Julia

If I have a symbolic matrix defined as T below, is there any way to lambdify this as function of variables, say σ..., and return ...
Christian Hallas's user avatar
1 vote
0 answers

How to get the derivatives of the determinant and inverse of 2nd-order tensor wrt itself in SymPy?

I have a second-order tensor for which I need to compute the derivatives of its determinant and inverse w.r.t. itself. The equations are as follows: $$\frac{\partial \, det(\mathbf{F})}{\partial F_{...
Chenna K's user avatar
  • 914
1 vote
0 answers

Speeding up the solution of a large set of nonlinear algebraic equations in `sympy`

I have a quite large algebraic equation system to solve, the system is so large, I can't post the example here, so I am posting it to pastebin. The sympy.solve is ...
tmaric's user avatar
  • 1,916
11 votes
5 answers

How to deal with complexity in numerical code, for example, when dealing with large Jacobian matrices?

I am solving a non-linear system of coupled equations, and have calculated the Jacobian of the discretised system. The result is really complicated, below are (only!) the first 3 columns of a $3\times ...
boyfarrell's user avatar
  • 5,399