kill(all)$

load(lrats)$

appendix : desolve with resistance '-k*m*v'
peter.vlasschaert@gmail.com,30/07/2018.

see also : ref : 'appendix : ode2 with resistance '-k*m*v' '   

use : second law of newton ? , ' Force '
=================================
rem :  ' free body diagram equations '.

p1:m*'diff(v,t)=m*g-k*m*v;

p2:p1/m;

p2a:ratsimp(p2);

Newton second law : F=m*a=m*dv/dt
=================================

m : mass
v : velocity
t : time
a : acceleration

assume(k>0,m>0,g>0);

gravitation only : neg , y axis 
========================
gx = 0
gy = - g , g = 9.81m/s^2 ( =>  'MKS units')

differential equation 'x direction' :  v=vx,g=gx=0
========================================

p3:subst([v=vx,g=0],p2a);

differential equation 'y direction' :  v=vy,g=gy=-g
========================================

p3a:subst([v=vy,g=-g],p2a);

p3,p3a  : syntax for ode2  , see 'ref' above.
===================================

desolve :  syntax wrong ('p3','p3a')
How to solve  =>    vx=vx(t),vy=vy(t)

x-direction : differential equation.

p4:subst([vx=vx(t)],p3);

y-direction : differential  equation.

p4a:subst([vy=vy(t)],p3a);

use : command 'desolve ' , Maxima

p5:desolve([p4,p4a],[vx(t),vy(t)]);

solution : ' x direction '  ?

p5a:p5[1];

solution : ' y direction '  ?

p5b:p5[2];

initial condition : ' see  ref ', when , t=0
================================
vx(0) = U*cos(α)
vy(0) = U*sin(α)

x,y direction :

final equations : vx(t),vy(t)
====================

p6a:subst([vx(0) = U*cos(α)],p5a);
p6b:subst([vy(0) = U*sin(α)],p5b);

we want find  x(t),y(t) ?
How to solve :  vx(t) = 'diff(x(t),t);
                             vy(t) = 'diff(y(t),t);

x(t),y(t) :

part 1 : differential equations 
========================

p7: [vx(t) = 'diff(x(t),t),vy(t) = 'diff(y(t),t)];
p7a:subst(p7,p6a);
p7b:subst(p7,p6b);

part 2 : desolve 'use'
=================

p8:[x(t),y(t)];
p8a:desolve([p7a,p7b],p8);

find : x(t)  ?
=========

p9:p8a[1];

find : y(t)  ?
==========

p9a:p8a[2];

initial condition : ' see  ref ', when , t=0,origin
=====================================
x(0) = 0
y(0) = 0

final equations : x(t),y(t)
====================

p10:[x(0)=0,y(0)=0];

p10a:subst(p10,p9);
p10b:subst(p10,p9a);

rem 1 : desolve , math use 'laplace transformation' to solve a system of ode's.
rem 2: initial condition already implemented.  vx(0),vy(0),x(0,y(0).
rem 3: reason for different syntax. ( can't use,p3,p3a) => (p4,p4a),see 'rem 2'

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------