kill(all)$

appendix : electrical  , solve two differential equation , numerical & symbolic,version 1.0,part1
peter.vlasschaert@gmail.com, 10/01/2020

part1 :symbolic       ( second differential  equatio ,see 'below'        ).
==============
part 2 : numerical    (system of two first order differential equations).
==============

load packages
---------------------

load(lrats)$

see: website**
appendix : electrical  , solve one differential equation , numerical & symbolic,version 1.0
peter.vlasschaert@gmail.com, 06/01/2020

numerical methods : solve only first order equations,see **

second order differential equation : example (RLC serial circuit,Newton's law : F=m*a )
------------------------------------------------------------------------------------------------------------------------

general form : second order differential equation
=====================================

p1:a2*'diff(y,x,2) +a1*'diff(y,x) +a0*y = r(x,y);
p1a:expand(p1/a2);

set :a1/a2 = A1, a0/a2 = A0 ,  r(x,y) /a2 = R(x,y)

p1b:[a1/a2 = A1, a0/a2 = A0 ,  r(x,y) /a2 = R(x,y)];
p1c:subst(p1b,p1a);

subst : doesn't work for the problem.

p1d:lratsubst(p1b,p1a);

example  : A1 = 0 , A0 = 0 , R(x,y) = -x
=============================

function,condition 'p1d:

p2:R(x,y):=-x;
p2a: [A1 = 0 , A0 = 0 ];

p2b:subst(p2a,p1d);

p2c:ev(p2b);

solve : p2c

p2d:ode2(p2c,y,x);

to find : %k1 ,%k2
==============

solution : we need two Initial conditions

Initial Condition : 1e) x = 0  => y =0
                              2e) x = 0  => diff(y,x) = 1

1e) x = 0  => y =0
------------------------
find : %k1

p3a:subst([x=0,y=0],p2d);

p3a1:rhs(p3a) = lhs(p3a);

result : p2d
---------------

p3a2:subst([p3a1],p2d);

2e) x = 0  => diff(y,x) = 1
---------------------------------
find : %k2

p4a:'diff(y,x)  = diff(rhs(p2d),x);

p4b:['diff(y,x)=1,x=0];
p4c:subst(p4b,p4a);

p4d:rhs(p4c) = lhs(p4c);

see :p3a2

p4e:subst([p4d],p3a2);

p4f:rhs(p4e);

plot function  'p4f': 0 ≤ x ≤ 5
=====================

wxplot2d([%], [x,0,5])$

p4g:diff(p4f,x);

plot differentation of  'diff(p4f,x)',0 ≤ x ≤ 5
===============================

wxplot2d([%], [x,0,5])$

p4h:solve(p4g = 0,x)[2];

how to solve : menu : 'p2c'
====================

p5:p2c;

Menu :equations  => Initial Value Problem(2) **
(I)nitial (C)ondition :       1e) x = 0  => y =0
                                         2e) x = 0  => diff(y,x) = 1

p5a:ode2(p5,y,x);

# menu :**
solution: p5a
point :  x=0
value :  y=0
derivative :'diff(y,x,1)=1

ic2(p5a, x=0, y=0, 'diff(y,x)=1);

p5b : rhs(%);

check : p4f ? p5b
=============

p6:is(p4f=p5b);