Polar coordinates to Cartesian co-ordinates

bongiman's picture

I want to convert the following into cartesion:

diff(r(t), t) = sin(Pi*r(t)), diff(theta(t), t) = 1

And then plot the phase portrait.

Could someone help me with this?

Doug Meade's picture

why?

Why do you want to convert this system of ODEs to cartesian coordinates?

As you have presented the system, the two equations are not connected. You can solve the theta equation: theta(t)=t+C1. The r equation is separable, and it's possible to obtain an explicit expression for r(t).

SYS := [ diff(r(t),t)=sin(Pi*r(t)), diff(theta(t),t)=1 ];
SOL := dsolve( SYS, [r(t),theta(t)] );
[                      
[                      
[                      
[{theta(t) = t + _C1}, 
[                      

   /             /   2 exp(Pi t + _C2 Pi)       exp(2 Pi t + 2 _C2 Pi) - 1\\ ]
   |       arctan|--------------------------, - --------------------------|| ]
  <              \1 + exp(2 Pi t + 2 _C2 Pi)    1 + exp(2 Pi t + 2 _C2 Pi)/ >]
   |r(t) = ----------------------------------------------------------------| ]
   \                                      Pi                               /

From here you can find explicit expressions for the Cartesian coordinates

CART := [ x(t)=r(t)*cos(theta(t)),  y(t)=r(t)*sin(theta(t)) ]:
eval( q1, map(op,SOL) );
[       
[       
[       
[x(t) = 
[       

        /   2 exp(Pi t + _C2 Pi)       exp(2 Pi t + 2 _C2 Pi) - 1\               
  arctan|--------------------------, - --------------------------| cos(t + _C1)  
        \1 + exp(2 Pi t + 2 _C2 Pi)    1 + exp(2 Pi t + 2 _C2 Pi)/               
  -----------------------------------------------------------------------------, 
                                       Pi                                        

  y(t) = 

        /   2 exp(Pi t + _C2 Pi)       exp(2 Pi t + 2 _C2 Pi) - 1\             
  arctan|--------------------------, - --------------------------| sin(t + _C1)
        \1 + exp(2 Pi t + 2 _C2 Pi)    1 + exp(2 Pi t + 2 _C2 Pi)/             
  -----------------------------------------------------------------------------
                                       Pi                                      

  ]
  ]
  ]
  ]
  ]

But, if you really want to put these ODEs into cartesian coordinates, here is how I would do it:

POLAR := [ r(t)=sqrt(x(t)^2+y(t)^2), theta(t)=arctan(y(t)/x(t)) ];
dCART := diff( CART, t );
simplify( eval( eval(dCART,SYS), POLAR ), symbolic );
[                 /                  (1/2)\                       (1/2)       
[                 |   /    2       2\     |        /    2       2\            
[ d           -sin\Pi \x(t)  + y(t) /     / x(t) + \x(t)  + y(t) /      y(t)  
[--- x(t) = - --------------------------------------------------------------, 
[ dt                                              (1/2)                       
[                                  /    2       2\                            
[                                  \x(t)  + y(t) /                            

                /                  (1/2)\                       (1/2)     ]
                |   /    2       2\     |        /    2       2\          ]
   d         sin\Pi \x(t)  + y(t) /     / y(t) + \x(t)  + y(t) /      x(t)]
  --- y(t) = -------------------------------------------------------------]
   dt                                           (1/2)                     ]
                                 /    2       2\                          ]
                                 \x(t)  + y(t) /                          ]

 

This looks like a real mess. And, when Maple tries to solve these ODEs, it encounters some difficulties.

dsolve( %, [x(t),y(t)] );
Error, (in dsolve) numeric exception: division by zero

If I have missed something, please do not hesitate to ask again.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.ed

 

Doug Meade's picture

Phase Portrait

The original post included a question about plotting the phase portrait. This is easily obtained, using plots:-odeplot, when working with the ODEs in polar coordinates.

You did not provide any initial conditions, so I will have to make a guess: r(0)=1/2, theta(0)=0.

with( plots ):
SYS := [ diff(r(t),t)=sin(Pi*r(t)), diff(theta(t),t)=1 ];
IC := [ r(0)=0.5, theta(0)=0 ];
SOL := dsolve( [SYS[],IC[]], [r(t),theta(t)], numeric );
odeplot( SOL, [r(t)*cos(theta(t)),r(t)*sin(theta(t))], t=0..10,
         numpoints=1000, scaling=constrained );


This looks believable.

I hope this is helpful.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu       
Phone:  (803) 777-6183         URL:    http://www.math.sc.ed
bongiman's picture

<p>Doug, yes that is

<p>Doug, yes that is brilliant. You have been an excellent help. I think i was chasing a red herring by trying to convert to cartesian.</p>
<p>I predicted that the fixed points occured at r = 0,1,2,3,.... and that Pi*r is unstable when r is even and stable when r is odd. Which is what your phase portrait confirms. Am i correct in saying that this implies that in the xy-plane there will be a unstable spiral at the origin and a stable limit cycle for all odd values of r where r=1,3,5,... and similarly a stable limit cycle for all even values of r, where r=2,4,6,...</p>
<p>Your phase portrait is brilliant. I'm not nearly familiar enough with Maple to come up with such things. Thanks for all your help.</p>
<p>&nbsp;</p>
<p>Regards</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}