kill(all)$

maxima: taylor expantion (first order)=balances(mass,energy,momentum,....),version 1.0
peter.vlasschaert@gmail.com,06/09/2021

1e)  taylor :series
==============

Menu : Maxima
→  Calculus → Get series→ expression =f(x);variable=x,point=0,depth=3

taylor(f(x), x, 0, 3);

Menu : Maxima
→  Calculus → Get series→ expression =f(x);variable=x,point=x0,depth=3

pa:f(x)=taylor(f(x), x, x0, 3);

subst. = (x-x0=Δx)

qa:x-x0=Δx;
qb:solve(qa,x);

p1:subst([qa],rhs(pa));

p2:subst(qb,lhs(pa));

p3:p2=p1;

→ subst. (x0=x)

p4:subst([x0=x],p3);

manual copy :rhs(p4),protect differentation with comma in the front.

r:'((at('diff(f(x),x,3),x=x))*Δx^3)/6+'((at('diff(f(x),x,2),x=x))*Δx^2)/2+'(at('diff(f(x),x,1),x=x))*Δx+f(x);

r1:args(r);

r2:sum(r1[i],i,3,length(r1));

approximation : first order taylor expantion  ( general balances:mass ,energy,momentum)
=====================================================================

p5:lhs(p4)=r2;

p5a:ev(p5);

2e) step :netflow in a direction (example : x-direction)
==========================================
→ 1d flow = one dimensional flow balance.

relation :(in)put & (out)put
--------------------------------------------------------------------
accumulation => net flow  ( x-direction) =netflow(x)

→ input :system

p6a:IN=subst([Δx=0],rhs(p5a));

→output:system

p6b1:OUT=lhs(p5a);
p6b2:OUT=rhs(p5a);

→ net flow in x-direction

p6c: netflow(x)=IN-OUT;

→ result ::netflow(x-direction)

p6d:subst([p6a,p6b2],p6c);

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