Ask Your Question
0

substitute complex number form in a function

asked 2020-07-12 10:21:08 +0100

ortollj gravatar image

updated 2020-07-12 10:23:53 +0100

Hi

how can i do so that there is no more $x_0$ nor $y_0$ in f but that $ f (z, \bar z)$ , with $ z=x_0+y_0*I$?

var('Z,z,x_0,y_0,r,rho,theta')
assume(Z,'complex') ;assume(z,'complex')
assume(x_0,'real') ;assume(y_0,'real')
Zr(x_0,y_0,r) = -sqrt(((r^2/(x_0^2 + y_0^2) - 1)*x_0 + r*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*y_0/sqrt(x_0^2 + y_0^2))^2 + (r*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*x_0/sqrt(x_0^2 + y_0^2) - (r^2/(x_0^2 + y_0^2) - 1)*y_0)^2)*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*x_0/sqrt(x_0^2 + y_0^2) + x_0

Zi(x_0,y_0,r)=-I*sqrt(((r^2/(x_0^2 + y_0^2) - 1)*x_0 + r*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*y_0/sqrt(x_0^2 + y_0^2))^2 + (r*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*x_0/sqrt(x_0^2 + y_0^2) - (r^2/(x_0^2 + y_0^2) - 1)*y_0)^2)*sqrt(-r^2/(x_0^2 + y_0^2) + 1)*y_0/sqrt(x_0^2 + y_0^2) + I*y_0
show("Zr",(Zr).simplify_full())
show("Zi",(Zi).simplify_full())

Zr0=(Zr).subs(x_0 + I*y_0==z,x_0^2+y_0^2==z*(z.conjugate()))
#show("Zr0",(Zr0).simplify_full())
Zi0=(Zi).subs(x_0 + I*y_0==z,x_0^2+y_0^2==z*(z.conjugate()))
#show("Zi0",(Zi0).simplify_full())
f=Zr0+Zi0
show("f : ",f.simplify_full())
edit retag flag offensive close merge delete

Comments

like that, I completed the transformation using a text editor : $\frac{z^{2} \overline{z} - \sqrt{z \overline{z}} z \sqrt{-\frac{r^{2} z \overline{z} - z^{2} \overline{z}^{2}}{z \overline{z}}} \sqrt{-\frac{r^{2} - z \overline{z}}{z \overline{z}}}}{z \overline{z}}$

g(z,r)=((z)*z*conjugate(z) - sqrt(z*conjugate(z))*(z)*sqrt(-(r^2*(z*conjugate(z) )- (z*conjugate(z))*z*conjugate(z))/(z*conjugate(z)))*sqrt(-(r^2 - z*conjugate(z))/(z*conjugate(z))))/(z*conjugate(z))
show(g(z,r).simplify_full())
ortollj gravatar imageortollj ( 2020-07-12 10:35:18 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-07-12 11:04:47 +0100

rburing gravatar image

updated 2020-07-12 11:13:51 +0100

Just express $x_0$ and $y_0$ directly in terms of $z$ and $\bar{z}$ (direct subsitution is more reliable than "pattern matching" substitution with $x_0+iy_0$ and $x_0^2+y_0^2$):

Zr0=Zr((z+z.conjugate())/2, (z-z.conjugate())/(2*I), r)
Zi0=Zi((z+z.conjugate())/2, (z-z.conjugate())/(2*I), r)
f=Zr0+Zi0
show(LatexExpr(r"f : (z,\bar{z},r) \mapsto"),f.simplify_full())

$$f : \left( z, \bar{z}, r \right) \ {\mapsto} \ \frac{2 \, z \overline{z} - \sqrt{-4 \, r^{2} + 4 \, z \overline{z}} \sqrt{z \overline{z}} \sqrt{-\frac{r^{2} - z \overline{z}}{z \overline{z}}}}{2 \, \overline{z}}$$

edit flag offensive delete link more

Comments

Thank you @rburing

ortollj gravatar imageortollj ( 2020-07-12 12:19:59 +0100 )edit
1

something that is a little bit surprising :

simplify_full() is not able to simplify the factor 2 of (2a +2bc)/(2d) in f above ;-)

ortollj gravatar imageortollj ( 2020-07-12 21:43:33 +0100 )edit

normally this function f is simplifiable to $f(z,r)= \frac{r^2}{\bar{z} }$

show(((fout.subs(z==(a+b*I)).simplify_full())).simplify_full())

gives $\left( z, r \right) \ {\mapsto} \ \frac{a^{2} + b^{2} - \sqrt{a^{2} + b^{2} - r^{2}} \sqrt{a^{2} + b^{2}} \sqrt{\frac{a^{2} + b^{2} - r^{2}}{a^{2} + b^{2}}}}{a - i \, b}$ which gives r^2/(a-b*I)

but SageMath is not able to simplify it

ortollj gravatar imageortollj ( 2020-07-13 10:45:59 +0100 )edit
1

simplification pb solved see:post :simplify_full-does-not-simplify

ortollj gravatar imageortollj ( 2020-07-16 07:09:18 +0100 )edit

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: 2020-07-12 10:21:08 +0100

Seen: 333 times

Last updated: Jul 12 '20