symbolic-math

Anyway to get rid of `math.floor` for positive odd integers with `sympy.simplify`?

Anyway to get rid of `math.floor` for positive odd integers with `sympy.simplify`? Question: I’m trying to simplify some expressions of positive odd integers with sympy. But sympy refuses to expand floor, making the simplification hard to proceed. To be specific, x is a positive odd integer (actually in my particular use case, the constraint is …

Total answers: 2

how to change int to Binary value

how to change int to Binary value Question: I have a problem changing my data into binary. It’s not so complicated just using basic math; like if a = 60, then the result is "good", and when a >= 60, then it is "very good", but this is implemented in the data below: This is …

Total answers: 2

Python's sympy struggling to solve simple equality

Python's sympy struggling to solve simple equality Question: I’m solving a problem and have a simple equality which I can solve on my calculator. Sympy, for some reason, struggles. These are the problematic lines of code: import sympy V = sympy.symbols(‘V’) eq = sympy.Eq(1.0 – 1.0*sympy.exp(-0.00489945895346184*V), 0.98) sol = sympy.solve(eq,V) I get no errors or …

Total answers: 3

How to fix the error name 'phi' is not defined?

How to fix the error name 'phi' is not defined? Question: I’m trying to solve the following laplace transform: f(t) = sen(ωt + φ) I wrote the following code to solve the problem import sympy as sym from sympy.abc import s,t,x,y,z from sympy.integrals import laplace_transform from sympy.integrals import inverse_laplace_transform omega = sympy.Symbol(‘omega’, real=True) sin = …

Total answers: 1

Cannot evaluate the trace in sympy

Cannot evaluate the trace in sympy Question: I’m trying to get a symbolic expression for the trace of a matrix in sympy, like this: from sympy import * A, B = symbols(‘A B’) M = Matrix([[A, 0], [0, B]]) t = Trace(M) print(t) And the output is as follows: Trace(Matrix([ [A, 0], [0, B]])) Whereas …

Total answers: 1

Sympy linsolve with empty output for a system of overdetermined equations

Sympy linsolve with empty output for a system of overdetermined equations Question: I have a system of 6 linear equations with 4 variables (a4,a5,a6,a7). I tried to solve the system for these variables with sympy linsolve, however the output is empty. Here is my working example: from sympy import symbols, linsolve, Eq, sqrt b4, b5, …

Total answers: 1