# Question:Explicit Midpoint Rule - Runge Kutta

## Question:Explicit Midpoint Rule - Runge Kutta

Maple

Hi all, I'm hopeful someone can help you with this issue I am having in implementing a Maple procedure. I use to have a strong knowledge of the programme, but haven't used Maple in a couple of years and I appear to be more rusty than I recall, I keep hitting dead ends with multiple assignments, missing arguements and so forth, so I was hoping someone can help me smooth the edges!

The problem is as follows:

q1'' - f1(q1,q2) = - q1 / (q1^2 + q2^2) ^ (3/2)

q2'' = f2(q1,q2) = - q2 / (q1^2 + q2^2) ^ (3/2)

Initial conditions: q1(0) = 1-e, q2(0)=0, q1'(0) = 0, Q2'(0) ' sqrt( (1+e) / (1-e))

I have derived a system of 4 first order ODE's from this, these are as follows:

p1 = q1'

p2 = q2'

p1' = q1/((q1^2+q2^2)^(3/2))

p2' = -  q1/((q1^2+q2^2)^(3/2))

With initial conditions:

p1(0) = 0

p2(0) = Sqrt((1 + e) / (1- e))

q1(0) = 1 - e

q2(0) = 0

I need to create a procedure that computes a solution that uses the explicit midpoint rule. I've managed to derive the following:

Gn = -(q1^2,n + q2^2,n)-(3/2)

G~n+1 = - (q1^2~,n + q2^2~,n)-(3/2)

q1,n+1 = q1,n + hp1~,n+1

q2, n+1 = q2,n + hp2~, n+1

p1,n+1 = p1,n + hgn~ + 1q1~,n+1

p2, n+1 = p2,n + hgn~ + q2~,n+1

Where:
q1~,n+1 = q1,n + h/2 p1,n

q2~, n+1 = q2,n + h/2 p2,n

p1~,n+1 = p1,n + h/2 gnq1,n

p2~, n+1 = p2,n + h/2 gnq2,n

Sorry it's incredibly longwinded, don't really expect much of a response! But I've tried implemented this procedure in maple, and I just can't seem to arrive at a suitable set of arrays.

Thanks for any help.

﻿