# problem with conjugate() of a function

Hi i want to decompose a rational fraction in partial faction

//define variable of problem
C_1 = var('C_1', domain="real")
C_2 = var('C_2', domain="real")
L_1 = var('L_1', domain="real")
omega = var('omega', domain="real")
R_1 = var('R_1', domain="real")
Amp = var('Amp', domain="real")
t = var('t', domain="positive")
p = var('p', domain="complex")
Z_1 = ((L_1*p + 1/(C_1*p))*(1/(C_2*p)))/((1/(C_2*p)) + ((L_1*p + 1/(C_1*p))))
F = (R_1/(R_1 + Z_1)).full_simplify()
U = omega/((omega^2 + p^2)*p)
f = (F*U)
denf = f.denominator()
numf = f.numerator()
polef=[]
BuffSol = solve(denf==0, p, solution_dict=True)//find pole of function
for s in BuffSol:
polef.append(s[p])
valpolef=[]
for n in range(0,len(polef)):
valpolef.append(polef[n](C_1=6*10^-15, C_2 = 3*10^-12, L_1 = 4.2217,R_1 = 1000,omega=2*pi*1000000).n(digits=25))//print the numerical approx of pole with value of the problem


I am almost certain of polef is the conjugate of polef to verify this i have print polef(C_1=6*10^-15, C_2 = 3*10^-12, L_1 = 4.2217,R_1 = 1000,omega=2*pi*1000000).n() and polef.conjugate()(C_1=6*10^-15, C_2 = 3*10^-12, L_1 = 4.2217,R_1 = 1000,omega=2*pi*1000000).n(), but the real part of this expression is differently. Where i have make a mistake in my code ?

edit retag close merge delete

Sort by » oldest newest most voted

You're just seeing some round-off error. If you increase the number of digits, the real parts get closer together but still show round-off error further out. If you want to make sure two of the roots are complex conjugates, then don't evaluate them numerically.

The factor of U gives you poles at $p=0$ and $p = \pm i \omega$, so that part can be set aside as known. The denominator of F is a cubic polynomial in p, so you know that its roots are either all real or one real plus a complex conjugate pair. The following code

var('C_1 C_2 L_1 omega R_1 Amp t p')
Z_1 = ((L_1*p + 1/(C_1*p))*(1/(C_2*p)))/((1/(C_2*p)) + ((L_1*p + 1/(C_1*p))))
F = (R_1/(R_1 + Z_1)).full_simplify()

show(F.denominator())

G = F.denominator().subs(C_1 = 6*10^-15, C_2 = 3*10^-12, L_1 = 4.2217, R_1 = 1000)
show(G)

H = solve(G,p)
for h in H: show(h.rhs())


displays the denomiator of F before and after substitution of your choice of constants along with the exact roots, as can be seen in the live example here. I've declared all the variables at once for simplicity.

If you compare the first two roots, you'll see that they are exactly complex conjugates. There's no error in your code, just some numerical rounding.

more

Thank you very much for your answer. It helps me a lot!

more