kill(all)$

maxima :programming general function ,version 1.0
peter.vlasschaert@gmail.com,07/06/2020

package for 'lratsubst'

load(lrats)$

m+1 :dimensional function xi ;i=0...m
============================
→  example : x0=t ; xi ,i = 1,2

m : function ,aren't expliciet function of time

l:[x1-2*x2,x2];

l1:append([x0],listofvars(l));

p2:makelist(concat(x,i),i,0,length(l));

f(q,pe,pl,pv,r):=block([],
    s1:pe[q],
    s2:map("=",pl,pv),
    r:ev(lratsubst(s2,s1),nouns)
)$

grind(%)$

s1;
s2;

first function :        list 'l'
=================

→ f1(x1,x2)

f(1,l,l1,[0,4,1],r);

second function : list 'l'
=================

→ f2(x1,x2)

f(2,l,l1,[0,4,1],r);

m+1 :dimensional function xi ;i=0...m
============================
→  example : x0=t  xi ,i = 1,2

m : function ,are expliciet function of time

lt:[x1-2*x2*x0,x2*x0];

p1a:listofvars(lt);

p2a:sort(p1a);

first function :        list 'lt'
=================
x0 =time =t

→ f1(x0,x1,x2)

f(1,lt,p2a,[1,4,1],r);

second function : list 'lt'
=================
x0 =time =t

→ f2(x0,x1,x2)

f(2,lt,p2a,[1,4,1],r);

general values : t,a,b for pv,example : list 'lt'
=================================

f(1,lt,p2a,[t,a,b],r);
f(2,lt,p2a,[t,a,b],r);

only difference: find list variables : use sort 
================================
→ time depent list 'lt', time = x0

rem : values t,a,b from different matrix :implement 
======================================
general : multiple differential equation : solve : matrix version, rk4
use : also time depent function .
=================================================
one differential equation: dx/dt =F(x,t)
=================================================
example:
------------
two differential equations: dx1/dx0 =lt[1]
                                             dx2/dx0 =lt[2]



---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
build function 'maxima': rk 
------------------------------------
example:
------------
one differential equation: dx/dt =F(x)
example:
------------
two differential equations: dx/dt =G1(x,y) =l[1]
                                             dy/dt =G2(x,y) =l[2]
----------------------------------------------------------------------------------------
t=x0, x=x1,y=x2
----------------------------------------------------------------------------------------

intermezzo: 
=========

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

→1e step :initial 
=============

a) generation :list
------------------------

d1:makelist(0,j,1,2);

dt:3;

b) generation :matrix
-----------------------------

xx: genmatrix(lambda([i,j], 0), 3, 3);

→2e step :computation
==================
use : function f

for j:1 thru length(lt) do(
 d1[j]: f(j,lt,p2a,[t,a,b],r)*dt,
    xx[1,1]:x0,
    xx[1,j+1]:d1[j]
)$

d1;

→  every row in the matrix 'xx' :→ new time step.'dt'

xx;

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