Ask Your Question
1

problem with conjugate() of a function

asked 2016-10-08 05:42:29 -0600

magarto gravatar image

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[0] is the conjugate of polef[2] to verify this i have print polef[0](C_1=6*10^-15, C_2 = 3*10^-12, L_1 = 4.2217,R_1 = 1000,omega=2*pi*1000000).n() and polef[0].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 ?

thank you in advance :)

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2016-10-09 16:07:26 -0600

updated 2016-10-09 16:43:48 -0600

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.

edit flag offensive delete link more
0

answered 2016-10-13 13:24:20 -0600

magarto gravatar image

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

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-10-08 05:42:29 -0600

Seen: 53 times

Last updated: Oct 13 '16