We get some expression in Cylindrical coordinates (r, ϕ, z ) like : expr := r*z^2*sin((1/3)*
ϕ)
we need to convert it into Cartesian coordinates and than back to Cylindrical coordinates. How to do such thing?
So I found something like this : eval(expr, {r = sqrt(x^2+y^2), z = z,
ϕ= arctan(y, x)})
but it seems incorrect, how to correct it and how make eval to convert backwords from Cartesian to Cylindrical?
ϕ
== ϕ
So I try:
R := 1;
H := h;
sigma[0] := sig0;
sigma := sigma[0]*z^2*sin((1/3)*`ϕ`);
toCar := eval(sigma, {r = sqrt(x^2+y^2), z = z, `ϕ` = arctan(y, x)});
toCyl := collect(eval(toCar, {x = r*cos(`ϕ`), y = r*sin(`ϕ`), z = z}), `ϕ`)
It looks close to true but look:
why arctan(r*sin(
ϕ), r*cos(
ϕ))
is not shown as ϕ?
Actually it is only begining of fun time for me because I also need to calculate
Q := int(int(int(toCar, x = 0 .. r), y = 0 .. 2*Pi), z = 0 .. H)
and to get it back into Cylindrical coordinates...
simplify(toCyl) assuming r>=0, `ϕ`<=Pi, `ϕ`>-Pi;
Notice,
arctan(sin(Pi/4),cos(Pi/4));
1
- Pi
4
arctan(sin(Pi/4 + 10*Pi),cos(Pi/4 + 10*Pi));
1
- Pi
4
arctan(sin(-7*Pi/4),cos(-7*Pi/4));
1
- Pi
4
arctan(sin(-15*Pi/4),cos(-15*Pi/4));
1
- Pi
4
arctan(sin(-Pi),cos(-Pi));
Pi
K:=arctan(r*sin(Pi/4),r*cos(Pi/4));
arctan(r, r)
simplify(K) assuming r<0;
3
- - Pi
4
simplify(K) assuming r>0;
1
- Pi
4
Once you've converted from cylindrical to rectangular, any information about how many times the original angle" might have wrapped around (past -Pi) is lost.
So you won't recover the original ϕ
unless it was in (-Pi,Pi]. If you tell Maple that is the case (along with r>-0 so that it knows which half-plane), using assumptions, then it can simplify to what you're expecting.