Category "sympy"

Sympy blanket initial condition (or assumption?)

I'm using Sympy 1.10.1 in Jupyter. Some cells look like: import sympy as sp x = sp.Symbol('x') y = sp.Function('y')(x) y.diff(x) diff_eq = sp.Eq(y*y.diff(x), 4

Is it possible to let a sympy symbolic variable be element of a specific interval?

Im trying to solve some inequations containing absolute values and I want to use sympy to make my life a bit easier. There are some conditions for the given var

Quantum mechanics operator valued function in sympy

Is it possible to have operator valued functions in sympy? Here, by operator I'm talking about the class sympy.physics.quantum.operator.Operator. Somewhat equiv

Wrong result of sympy integration with symbol limits

from sympy import * s = Symbol("s") y = Symbol("y") raw_function = 1/(150.0-0.5*y) result = integrate(raw_function, (y, 0, s) The above snippet gets a wrong re

Can I deal with vector fields in sympy without specifying coordinate system?

I have differential equations for two vector fields: diffusion equation for magnetic field and Navier-Stokes equation for fluid velocity. I am interested in tra

Sympy Inverse a function: y = ax+b into x = (y-b)/a

This should be easy, and hopefully doable in Sympy. I have a function: Y = 0.05*X + 0.15, which I define using Sympy: from sympy import * Y = 0.05*X + 0.15 How

Taylorseries of ln(1 + x) with Sympy

I was trying to make a function, which computes the taylorseries of ln(1 + x), which takes a z argument (the value of x) and a k argument (till which term it sh

Solution to a system of non-linear equations in R^2

I am trying to find a solution to the following system where f and g are R^2 -> R^2 functions: f(x1,x2) = (y1,y2) g(y1,y2) = (x1,x2) I tried solving it using

Delta operator in sympy

Is it possible to make a delta operator like this in sympy? Im not really sure how to code it. Should be really eazy if there exists a method.

how can i convert my sympy code to symengine in python

This code I wrote in Sympy is running slow. I want to write this with symengine. How can I translate? I had some difficulty with the Solve commands. Can you hel

How to recognize exp or trig polynomials/fractions in SymPy

Let me define an exponential polynomial as a linear combination of terms exp(a*X) where the as are distinct complex numbers. By taking only imaginary as we obta

Sympy : simplification with expression substitution

I have several expressions involving the norm or norm squared of a vector u. I'd like to simplify these expressions by substituting a known value for the norm o

Sympy plot in a pyscript environment not showing on web screen

Python Sympy running in a pyscript environment is not displaying init_printing(use_unicode=True) characters, for example a √ symbol", nor integrated sympy

Sympy evaluates integral sign wrong

For an integral calculation, Sympy evaluates the same result as me and wolframalpha with a negative sign. The integral I am evaluating is strictly positive so i

How to remove brackets in a reticulate output in R/exams?

I have the following single-choice exercise RadicalPrimo.Rmd, which is intended to simplify square roots: ```{r data generation, echo = FALSE, results = "hide"}

Create indexed functions in sympy

Is it possible to create indexed functions in sympy like fi(t) which might be used in a product or sum, eg Σfi(t)? import sympy as sp f = sp.Function('f')

Extract coefficients and corresponding monomials from a given polynomial in SymPy

Given a symbolic multivariate polynomial P, I need to extract both its coefficients and corresponding monomials as lists: def poly_decomp(P): .... retu

Is there any way to get the step-by-step solution in SymPy?

Is there any way to get the step-by-step solution in SymPy? For example: x**2-5 = 4 step 1 x**2-5+5=4+5 step 2 : x**2=9 step 3 :x = 3 or x= -3

Solving coupled differential equations with sympy

I am trying to solve the following system of first order coupled differential equations: - dR/dt=k2*Y(t)-k1*R(t)*L(t)+k4*X(t)-k3*R(t)*I(t) - dL/dt=k2*Y(t)-k1*

How can I determine whether a line segment is completely covered by a set of smaller segments?

I am trying to write an algorithm using turtle. The turtle is bouncing in a polygon, and painting a portion of the edge it touches. The algorithm should termina