Sympy expression as ratio of polynomials

Omegaman

What is the best way to get sympy to rewrite an expression as a ratio of polynomials?

I'm working out the transfer function for a circuit, and would like to determine its poles and zeros which will require factoring the numerator and denominator of the transfer function. As I calculate, I'd like to keep the intermediate results expressed as a ratio of polynomials rather than the 1/1/1/1/1/x form that is naturally the result of parallel impedances.

I could write a function that keeps taking as_numer_denom() at each step and returns the ratio, but that seems cumbersome.

Is there a natural way to do this?

smichr

Perhaps you can use normal at each step?

>>> (1/1/1/1/x + 2/(1+1/x)).normal()
(2*x**2 + x + 1)/(x*(x + 1))

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Sympy expression as ratio of polynomials

From Dev

Ratio of polynomials approximation

From Dev

Sympy polynomials with `mpfr` coefficients?

From Dev

Solving polynomials with complex coefficients using sympy

From Dev

How to combine polynomials in matrix operations in Sympy?

From Dev

Why does sympy.diff not differentiate sympy polynomials as expected?

From Dev

Check if Sympy Expression is Nan?

From Dev

numerical value for an expression in sympy

From Dev

From string to sympy expression

From Dev

Substituting an expression with sympy

From Dev

sympy expression to symbols

From Dev

Sympy - Rename part of an expression

From Dev

numerical value for an expression in sympy

From Dev

sympy expression to symbols

From Dev

Convert a string to a SymPy expression?

From Dev

Simplifying Scala expression calculating ratio

From Dev

Python Sympy Arbitrary Approximation to Arbitrary Sympy Expression?

From Dev

SymPy simplify relational (inequality) expression

From Dev

Sympy Complex Expression To Python Function

From Dev

Evaluating a string with a numerical expression with sympy?

From Dev

Check if sympy expression contains function

From Dev

Sympy: Get functions from expression

From Dev

Render a sympy expression literally, with no simplification

From Dev

Collecting like term of an expression in Sympy

From Dev

How to substitute and simplify an expression in sympy?

From Dev

Factor sympy expression to matrix coefficients?

From Dev

How to substitute and simplify an expression in sympy?

From Dev

Factor sympy expression to matrix coefficients?

From Dev

Extract affine part of SymPy expression

Related Related

HotTag

Archive