jass

20 Reputation

One Badge

0 years, 292 days

MaplePrimes Activity


These are questions asked by jass

For t not equal to nT,   

dS/dt = delta- mu*S+ omega*V; 

 dV/dt = -(omega+mu)*V

For t=nT, 

 S(nT+)=(1-gamma) S(nT);

V(nT+)=V(nT)+ gamma* S(nT),

with the initial conditions  S(0+)=s0

V(0+)=v0

    how to plot the graph with this system of equations,impulsive points and initial conditions  

restart;
with(Student[NumericalAnalysis]);
with(plots);
with(DEtools);
f := proc(u, r) local res; res := 1/25*r^2 + (sin(u(r)) + sin(diff(u(r), [r $ 1/5])))/(r^2 + 47); return res; end proc;


RK4 := proc(f, u0, r0, h, n) local u, r, i, k1, k2, k3, k4; u := Vector(n + 1); r := Vector(n + 1); u[1] := u0; r[1] := r0; for i to n do k1 := f(u[i], t[i]); k2 := f(u[i] + 1/2*h*k1, r[i] + 1/2*h); k3 := f(u[i] + 1/2*h*k2, r[i] + 1/2*h); k4 := f(u[i] + h*k3, r[i] + h); u[i + 1] := u[i] + 1/6*h*(k1 + 2*k2 + 2*k3 + k4); r[i + 1] := r[i] + h; end do; return [u, r]; end proc;
RK4 := proc (f, u0, r0, h, n) local u, r, i, k1, k2, k3, k4; u 

   := Vector(n+1); r := Vector(n+1); u[1] := u0; r[1] := r0; 

   for i to n do k1 := f(u[i], t[i]); k2 := f(u[i]+(1/2)*h*k1, 

   r[i]+(1/2)*h); k3 := f(u[i]+(1/2)*h*k2, r[i]+(1/2)*h); k4 := 

   f(u[i]+h*k3, r[i]+h); u[i+1] := u[i]+(1/6)*h*(k1+2*k2+2*k3+k4\

  ); r[i+1] := r[i]+h end do; return [u, r] end proc


u0 := cos(abs(0.9))/15;
                      u0 := 0.04144066455

r0 := 0;
                            r0 := 0

h := 0.1;
                            h := 0.1

n := 100;
                            n := 100

solution := RK4(f, u0, r0, h, n)

u := solution[1];
r := solution[2];
plot(u, r, style = line, color = blue, labels = ["Time (r)", "Solution (u)"]);
 is this correct to solve the implicit fractional differential equations using 4th order Runge-Kutta Method. will fsolve command  solve the fractional differential equations ?

Page 1 of 1