sympy

Python Sympy – Select monomials from ANF of Boolean expression

Python Sympy – Select monomials from the ANF of a Boolean expression Question: I have some truth table in GF(2) and I compute the corresponding Algebraic Normal Form (ANF) or Zhegalkin polynomial. Below a dummy example with two variables. from sympy.logic.boolalg import ANFform from sympy.abc import x, y truth_table = [0, 1, 1, 1] expr …

Total answers: 1

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 do I evaluate a Sympy function in Python?

How do I evaluate a Sympy function in Python? Question: I am facing a major issues in python using sympy. I didn’t find any solutions to my problem or at least, I couldn’t apply the solutions I found on my problem. import sympy as sp import math as ma import numpy as np E1=72500 A1=15 …

Total answers: 1

Solving a large (150 variable) system of linear, ordinary differential equations; running into floating point rounding and/or stiffness problems

Solving a large (150 variable) system of linear, ordinary differential equations; running into floating point rounding and/or stiffness problems Question: EDIT: Original post too vague. I am looking for an algorithm to solve a large-system, solvable, linear IVP that can handle very small floating point values. Solving for the eigenvectors and eigenvalues is impossible with …

Total answers: 1

How to plot radical equations in python

How to plot radical equations in python Question: I have three equations as shown below: How do I plot the graphs of them for a given X1,Y1,X2,Y2,X3,Y3,t1,t2,t3,S in python? I tried removing square roots and finally at an equation in 4th degree and then tried to plot, but still I get 4 solutions out of …

Total answers: 1

Why doesn't Sympy's row_del() method work (example from geeksforgeeeks website)?

Why doesn't Sympy's row_del() method work (example from geeksforgeeeks website)? Question: TL;DR There is an inconsistency when using Sympy’s [Matrix].row_del() method and websites seem to be reporting its use wrongly. Note from the following link from the geeksforgeeks website for an example of deleting matrix rows using sympy: from sympy import * # use the …

Total answers: 1

Simple expression parsing throws a TypeError referencing 'AssumptionKeys'

Simple expression parsing throws a TypeError referencing 'AssumptionKeys' Question: I’m trying to get sympy to calculate the result of what should be a simple expression with three substitutions, but I’m coming up against an error I’ve not encountered before. >>> from sympy import sympify, symbols >>> input_str = ‘100*Q+10*R+5*S+0.6*T’ >>> Q,R,S,T = symbols(‘Q R S …

Total answers: 3

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