Since you've not defined what $U$ and $V$ mean, I can't answer any further than that. Example1- Circle: The python code below plots a circle using polar form. Remember, any mathematical function that can be plotted using the Cartesian coordinate system can be plotted using the polar co-ordinates as well. Now $\hat r$ is the direction that $\vec p$ changes when $r$ increases, and $\hat \theta$ is the direction that $\vec p$ changes then $\theta$ increases: The pyplot module of Python Matplotlib provides the function polar which draws a polar plot. Letting $\vec p = x\hat i y \hat j$ be the position vector, and noting that $x = r\cos \theta, y = r\sin \theta$, we have $$\vec p = r\cos \theta \hat i r\sin \theta\hat j$$. $\vec v = v_r \hat r v_\theta \hat \theta$, where $\hat r$ and $\hat \theta$ are the unit radial vector and unit rotational vector at $(r, \theta)$. Python Source Code: Cartesian to Polar Converting Cartesian Coordinate to Polar Coordinate Importing math library import math Reading cartesian coordinate x float(input('Enter value of x: ')) y float(input('Enter value of y: ')) Converting cartesian to polar coordinate Calculating radius radius math.sqrt( x x y y ) Calculating angle (theta) in radian theta math.atan(y/x) Converting theta from radian to degree theta 180 theta/math.pi Displaying polar.
0 Comments
Leave a Reply. |