Rational Polynomial Substitution

Hello there :slight_smile:
I am using some Rational Polynomial object. I want to substitute some variables inside it. How can I do ? Here is the code :

using DynamicPolynomials
@polyvar eta_var
eta = (0.0 + (1.0+0.0im)*eta_var) / (1.0 + (0.0 + 0.0*1im)*eta_var)
subs(eta  , eta_var => inv(eta) ) 

the second line is to declare a variable. The third line is to make a rational polynomial. And the fourth one is a try to substiture (which does not work).
Any idea how to make it work ? Thanks a lot :slight_smile:

The problem is that the substition uses inv(eta), which is not a Polynomial but a Rational Polynomial …

(finally I’ve written it by my way, so that I am not blocked ! But the question is still there :slight_smile: )

If this is all you want to do, Symbolics.substitute handles that. Here are some utilities for working with symbolic transfer functions with Symbolics and SymPy

1 Like