Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cart2esf:= proc(x,y,z)
- local R,theta,phi
- R = sqrt(x^2+y^2+z^2)
- if x ≠ 0 then theta = arctg(y/x)
- else if y = 0 then theta = 0
- else if y > 0 theta = pi/2
- else theta = pi/2
- end if
- if R = 0 then phi = 0
- else
- phi = arccos(z/R)
- Cilindricas2esfericas := (x,y,z)
- Local x,y,z
- R = sqrt(x^2+y^2)
- if x ≠ 0 then theta = arctg(y/x)
- else if y = 0 then theta = 0
- else if y > 0 theta = pi/2
- else theta = pi/2
- end if
- Esf2cart:=(r,theta,phi)
- local x,y,z
- if evalf(r>=0,0<=theta<=2pi,0<=phi<=pi)
- x = R*cos(theta) * sin(phi)
- y = R*sin(theta) * sin(phi)
- z = R*cos(phi)
- return [x,y,z]
- else error "Valores fora do dominio"
- end it
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement