# Revision history [back]

### substitute complex number form in a function

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')
var('Z,z,x_0,y_0,r')
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())


### substitute complex number form in a function

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')
var('Z,z,x_0,y_0,r')
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())