klil(all)$

math : maxima : appendix : integral for reactor design,version 1.0
peter.vlasschaert@gmail.com,07/08/2021

assume(ε>0);

1e) integral:
----------------

p1:'integrate(1/(1-x),x)=integrate(1/(1-x),x);

math: ln  → maxima : log

rem : log (x/y)= log(x)-log(y)
          log(x*y)= log(x)+log(y)
→ - log(1-x) = log(1/(1-x))

2e) integral:
----------------

p2:'integrate((1+ε*x)/(1-x),x);

p2a:args(p2);

p2b:[num(p2a[1]),denom(p2a[1])];

p2b1:part(p2b[1],1)/(1-x);

p2b2:part(p2b[1],2)/(1-x);

assume(m>1);

p2c:integrate(p2a[1],x,0,m);

p2c1:facsum(subst([m=x],p2c),1+ε);

p2d:p2=p2c1;

integration : x=0  → x=x

p2e::(subst([x=x],rhs(p2d))-subst([x=0],rhs(p2d)));

p2e1:facsum(p2e);

p2e1a:args(expand(p2e1));

(-1)*(logcontract(log(x-1)*ε-log(-1)*ε));

p2e2:log(1/(1-x))*ε;

(-1)*(logcontract(log(x-1)-log(-1)));

p2e3:log(1/(1-x));

p2e4:p2e1a[1]+(1+ε)*'log(1/(1-x));

'integrate(p2a[1],x,0,x)=p2e4;

rem : -log(1-x) = log(1/(1-x))

log(1);

rem: log(1)-log(1-x)=log(1/(1-x))

3e) integral:
----------------

p3a:p2a[1]*p2b2;

p3:'integrate(p3a,x);

p3b:ev(p3,integrate);

p3c:p3=p3b;

integration : x=0  → x=x

p3d:(subst([x=x],rhs(p3c))-subst([x=0],rhs(p3c)));

p3d1:args(p3d);

p3d2:(-1)*(p3d1[3]-p3d1[2]);

p3d3:facsum(%);

p3d4:logcontract(p3d3);

? why logcontract doesn't work::(log(x-1)-log(-1))

p3d5:-ε*log(1/(1-x));

p3e1:p3d1[1]+p3d1[4]+p3d1[5];

p3e2:facsum(ratsimp(p3e1));

p3f:'integrate(p3a,x,0,x)=p3e2+p3d5;

rem :-ε*log(1/(1-x))=log(1-x)*ε

4e) integral:
----------------

p4a:p3a*p2b[1];

p4:'integrate(p4a,x);

p4b:p4=(ev(p4,integrate));

p4b1:combine(p4b);

p4b2:args(rhs(p4b1));

p4b3:makelist(facsum(p4b2[i]),i,1,length(p4b2));

p4b4:sum(p4b3[k],k,1,length(p4b3));

p4c:p4=p4b4;

integration : x=0  → x=x

p4c1:(subst([x=x],rhs(p4c))-subst([x=0],rhs(p4c)));

p4c1a:args(p4c1);

p4c1a1:facsum(p4c1a[1]+p4c1a[2]);

p4c1a2:facsum(p4c1a[4]+p4c1a[5]);

? why logcontract doesn't work::(log(x-1)-log(-1))

p4c1a2:2*log(1-x)*ε*(ε+1);

p4d:'integrate(p4a,x,0,x)=p4c1a2+p4c1a[3]+p4c1a1;

5e) integral:
----------------

p5a:p2b2*1/(θ-x);

p5:'integrate(p5a,x);

p5b:p5=facsum(ev(p5,nouns));

assume(θ≠1)

p5b1:lhs(p5b)=logcontract(rhs(p5b));

integration : x=0  → x=x

p5b1:ratsimp(subst([x=x],rhs(p5b))-subst([x=0],rhs(p5b)));

p5b2:logcontract(p5b1);

'integrate(p5a,x,0,x)=p5b2;

→ other types :integrals 'quadraic'

integral : 1a
=========

pi1:gg(a1,b1,c1):=a1*x^2+b1*x+c1;

definition : discriminant (p2)
-------------------------------------

pi2:dis(a1,b1,c1):=b1^2-4*a1*c1;

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

a11:1;
b11:2;
c11:1;

pia1:'dis(a11,b11,c11 )=dis(a11,b11,c11 );

pia2:'integrate(1/gg(a11,b11,c11),x,0,m)=integrate(1/gg(a11,b11,c11),x,0,m);

a12:2;
b12:3;
c12:1;

pib1:'dis(a12,b12,c12 )=dis(a12,b12,c12 );

pib2:'integrate(1/gg(a12,b12,c12),x,0,m)=integrate(1/gg(a12,b12,c12),x,0,m);

pib3:lhs(pib2)=ev(rhs(pib2),logcontract);

rem : discriminant ≥ 0 otherwise complex (not needed:for reactor design)
→ dis(a1,b1,c1):=b1^2-4*a1*c1

integral : 1b
=========

pi3a:(a+b*x)/(c+d*x);

assume(d*(d*m+c)>0,(c*d)>0);

pi3b:'integrate(pi3a,x,0,m)=integrate(pi3a,x,0,m);

pi3c:lhs(pi3b)=ev(rhs(pi3b),logcontract);

pi4d:subst([m=x],lhs(pi3b))=ev(subst([m=x],rhs(pi3c)),expand);

pi4e:ev(pi3c,m=x,expand);