08-04-03.mw

> xphug:= [ diff(theta(t),t) = ( v(t)^2 - cos(theta(t))) / v(t),
        diff(v(t),t)     = -sin(theta(t)) - R*v(t)^2 ,
        diff(x(t),t)     = v(t)*cos(theta(t)),
        diff(y(t),t)     = v(t)*sin(theta(t))];
with(DETools):with(plots):
 

[diff(theta(t), t) = `/`(`*`(`+`(`*`(`^`(v(t), 2)), `-`(cos(theta(t))))), `*`(v(t))), diff(v(t), t) = `+`(`-`(sin(theta(t))), `-`(`*`(R, `*`(`^`(v(t), 2))))), diff(x(t), t) = `*`(v(t), `*`(cos(theta(t...
[diff(theta(t), t) = `/`(`*`(`+`(`*`(`^`(v(t), 2)), `-`(cos(theta(t))))), `*`(v(t))), diff(v(t), t) = `+`(`-`(sin(theta(t))), `-`(`*`(R, `*`(`^`(v(t), 2))))), diff(x(t), t) = `*`(v(t), `*`(cos(theta(t...
(1)
 

> bisector := proc( f, low, high, epsilon)
  local mid, lo, hi;
  lo := evalf(low);
  hi := evalf(high);
  if (f(lo)>0) then error("f not neg at lo=",lo, "f=",f(lo)); fi;
  if (f(hi)<0) then error("f not pos at hi=",hi, "f=",f(hi)); fi;
  mid := evalf((lo+hi)/2);
  while ( abs(f(mid))>epsilon) do
     if ( f(mid) > 0) then
        hi:= mid;
     else
        lo:= mid;
     fi;
     mid := (lo+hi)/2;
print( [lo, hi], mid, "f(mid)=", f(mid));
  od;
  return(mid);
end:
 

> R:=0.3;
 

.3 (2)
 

> sol:=dsolve({op(xphug), theta(0)=0, v(0)=2, x(0)=0, y(0)=1},
               numeric,  range=0..10,output=procedurelist);
 

proc (x_rkf45) local res, data, vars, solnproc, outpoint, ndsol, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if... (3)
 

> sol(4);
 

[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
(4)
 

> sol(5);
 

[t = 5., theta(t) = -.138321763929649760, v(t) = 1.05397720830789443, x(t) = 4.11407991711292897, y(t) = .404937110660214983]
[t = 5., theta(t) = -.138321763929649760, v(t) = 1.05397720830789443, x(t) = 4.11407991711292897, y(t) = .404937110660214983]
(5)
 

> saul:=dsolve({op(xphug), theta(0)=0, v(0)=2, x(0)=0, y(0)=1},
               numeric,  range=0..10, output=listprocedure);
 

[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
(6)
 

> yt:=saul[5];
 

y(t) = proc (t) local res, data, solnproc, outpoint, `y(t)`; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvIn... (7)
 

> yt(5);
 

(y(t))(5) = .404937037647910891 (8)
 

> sol(4);
 

[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
(9)
 

> saul(4);
 

[t(4) = 4., (theta(t))(4) = -.426684274979198364, (v(t))(4) = 1.19052265914011636, (x(t))(4) = 3.01841295140325050, (y(t))(4) = .695118852807888543]
[t(4) = 4., (theta(t))(4) = -.426684274979198364, (v(t))(4) = 1.19052265914011636, (x(t))(4) = 3.01841295140325050, (y(t))(4) = .695118852807888543]
(10)
 

> sol[5](4);
 

[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
[t = 4., theta(t) = -.426684274979198364, v(t) = 1.19052265914011636, x(t) = 3.01841295140325050, y(t) = .695118852807888543]
(11)
 

> saul[5](4);
 

(y(t))(4) = .695118852807888543 (12)
 

> DEplot(xphug, [ theta(t), v(t), x(t), y(t) ], t=0..8,
 

>          [seq([theta(0)=(Pi*(i/10)), v(0)=2, x(0)=0, y(0)=1 ], i=-3..2)],
 

>         theta=-Pi/2..3*Pi, v=0..3, x=-1..6, y=-1..3,
        scene=[x,y], title="path of glider",
 

>         linecolor=[cyan,blue,violet,red,yellow,green]);
 

>
 

Plot_2d
 

> moses:=dsolve({op(xphug), theta(0)=-Pi/5, v(0)=2, x(0)=0, y(0)=1},
               numeric,  range=0..10, output=listprocedure);
 

[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
(13)
 

> moses[5](8);
 

(y(t))(8) = -.662146784734351068 (14)
 

> moses[5](6);
 

(y(t))(6) = -.142486077002186157 (15)
 

> rhs(roses=red);
 

red (16)
 

> rhs(moses[5](5));
 

0.502658421957553822e-1 (17)
 

> plot(rhs(moses[5](t)),t=4..6);
 

Plot_2d
 

> rhs(moses[5](5.22));
 

-0.881041685420765009e-3 (18)
 

> rhs(moses[5](5.21));
 

0.125656370195269674e-2 (19)
 

> bisector(t->rhs(moses[5](t)), 5.22, 5.21, .000001);
 

 

 

 

 

 

 

 

 

 

[5.22, 5.215000000], 5.217500000,
[5.217500000, 5.215000000], 5.216250000,
[5.216250000, 5.215000000], 5.215625000,
[5.216250000, 5.215625000], 5.215937500,
[5.215937500, 5.215625000], 5.215781250,
[5.215937500, 5.215781250], 5.215859375,
[5.215937500, 5.215859375], 5.215898438,
[5.215898438, 5.215859375], 5.215878907,
[5.215878907, 5.215859375], 5.215869142,
5.215869142 (20)
 

> moses[4](5.215869142);
 

(x(t))(5.215869142) = 4.98456639903459653 (21)
 

> xphug:= [ diff(theta(t),t) = piecewise(y(t)>0,( v(t)^2 - cos(theta(t))) / v(t),0),
        diff(v(t),t)     = piecewise(y(t)>0,-sin(theta(t)) - R*v(t)^2 ,0),
        diff(x(t),t)     = piecewise(y(t)>0, v(t)*cos(theta(t)), 0),
        diff(y(t),t)     = piecewise(y(t)>0, v(t)*sin(theta(t)), 0)];
 

[diff(theta(t), t) = piecewise(`<`(0, y(t)), `/`(`*`(`+`(`*`(`^`(v(t), 2)), `-`(cos(theta(t))))), `*`(v(t))), 0), diff(v(t), t) = piecewise(`<`(0, y(t)), `+`(`-`(sin(theta(t))), `-`(`*`(.3, `*`(`^`(v(...
[diff(theta(t), t) = piecewise(`<`(0, y(t)), `/`(`*`(`+`(`*`(`^`(v(t), 2)), `-`(cos(theta(t))))), `*`(v(t))), 0), diff(v(t), t) = piecewise(`<`(0, y(t)), `+`(`-`(sin(theta(t))), `-`(`*`(.3, `*`(`^`(v(...
(22)
 

> crash:=dsolve({op(xphug), theta(0)=-Pi/5, v(0)=2, x(0)=0, y(0)=1},
               numeric,  range=0..10, output=listprocedure);
 

[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 15); if _EnvInFsolve ...
(23)
 

> crash[5](8);
 

(y(t))(8) = -0.480033813404428549e-5 (24)
 

> crash(8);
 

[t(8) = 8., (theta(t))(8) = -.203962215418803355, (v(t))(8) = 1.05464661853757002, (x(t))(8) = 4.98458992116906607, (y(t))(8) = -0.480033813404428549e-5]
[t(8) = 8., (theta(t))(8) = -.203962215418803355, (v(t))(8) = 1.05464661853757002, (x(t))(8) = 4.98458992116906607, (y(t))(8) = -0.480033813404428549e-5]
(25)
 

> splat:=Theta->dsolve({op(xphug), theta(0)=Theta, v(0)=2, x(0)=0, y(0)=1},
               numeric,  range=0..10, output=listprocedure)(10);
 

proc (Theta) options operator, arrow; (dsolve({op(xphug), v(0) = 2, x(0) = 0, y(0) = 1, theta(0) = Theta}, numeric, range = 0 .. 10, output = listprocedure))(10) end proc
proc (Theta) options operator, arrow; (dsolve({op(xphug), v(0) = 2, x(0) = 0, y(0) = 1, theta(0) = Theta}, numeric, range = 0 .. 10, output = listprocedure))(10) end proc
(26)
 

> splat(-Pi/5);
 

[t(10) = 10., (theta(t))(10) = -.203962215418803355, (v(t))(10) = 1.05464661853757002, (x(t))(10) = 4.98458992116906607, (y(t))(10) = -0.480033813404428634e-5]
[t(10) = 10., (theta(t))(10) = -.203962215418803355, (v(t))(10) = 1.05464661853757002, (x(t))(10) = 4.98458992116906607, (y(t))(10) = -0.480033813404428634e-5]
(27)
 

> splat(-Pi/5+.01);
 

[t(10) = 10., (theta(t))(10) = -.198149660853020548, (v(t))(10) = 1.04896075078679862, (x(t))(10) = 5.01857451106581287, (y(t))(10) = -0.222401956158692811e-5]
[t(10) = 10., (theta(t))(10) = -.198149660853020548, (v(t))(10) = 1.04896075078679862, (x(t))(10) = 5.01857451106581287, (y(t))(10) = -0.222401956158692811e-5]
(28)
 

>