/* -*- Mode: Maxima -*- */ /* ** ** Copyright (C) 2015 Marek Rychlik ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ** */ load("linode.mac"); /* Second order homogenous, constant coefficients, real roots, simple*/ linode('diff(y,x,2)-3*'diff(y,x)+y=0,y,x); /* Second order homogenous, constant coefficients, complex roots, simple */ linode('diff(y,x,2)+y=0,y,x); /* Second order nonhomogenous, constant coefficients, complex roots, simple */ linode('diff(y,x,2)+y=cos(x),y,x); /* Second order nonhomogenous, constant coefficients, complex roots, simple; real solution. */ linode('diff(y,x,2)+y=cos(x),y,x),linode_prefer_real_basis=true; /* Third order, homogenous, constant coefficients, real root of multiplicity 3 */ linode('diff(y,x,3)+3*'diff(y,x,2)+3*'diff(y,x)+y=0,y,x); /* Third order, homogenous, constant coefficients, real roots of multiplicity 1 and 2 */ linode('diff(y,x,3)-4*'diff(y,x,2)+5*'diff(y,x)-2*y=0,y,x); /* A second order equation with a parameter; a=2 yields multiple root (not handled) */ linode('diff(y,x,2)-a*'diff(y,x)+y=0,y,x); /* A second order equation with a parameter; a=2 substitution */ linode('diff(y,x,2)-a*'diff(y,x)+y=0,y,x),a=2; /* Second order, general spring-mass system, no external forcing */ linode(m*'diff(y,x,2)+b*'diff(y,x)+k*y=0,y,x); /* Second order, general spring-mass system, external force, periodic */ linode(m*'diff(y,x,2)+b*'diff(y,x)+k*y=A*sin(w*x),y,x); /* Euler-Cauchy, simple roots */ linode(x^2*'diff(y,x,2)-3*x*'diff(y,x)+y=0,y,x); /* Constant coefficients, third order, non-homogenous */ linode('diff(y,x,3)+y=x,y,x); /* Kreyszig Example 1 in Chapter 3: third order, non-homogenous, const coefficients, multiple root, duplication in the right-hand side */ linode('diff(y,x,3)+3*'diff(y,x,2)+3*'diff(y,x)+y=-30*exp(-x),y,x, x=0, [y=3,'diff(y,x)=-3,'diff(y,x,2)=-47]); /* Kreyszig Example 2 in Chapter 3 */ linode(x^3*'diff(y,x,3)-3*x^2*'diff(y,x,2)+6*x*'diff(y,x)-6*'y=x^4*log(x),y,x); /* Second order homogenous, non-constant coefficients, not Euler-Cauchy */ linode(x*'diff(y,x,2)-3*'diff(y,x)+y=0,y,x); /* Kreyszig Additional Question 01 */ linode(16*x^2*'diff(y,x,3)+48*x*'diff(y,x,2)+15*'diff(y,x)=0,y,x); /* Kreyszig Additional Question 03 */ linode(x*'diff(y,x,4)+'diff(y,x,3)=63*x^4,y,x); /* Kreyszig Additional Question 07 */ linode('diff(y,x,4)+40*'diff(y,x,2)-441*y=40*cosh(x),y,x, x=0, [y=1.9,'diff(y,x)=3,'diff(y,x,2)=-40.1,'diff(y,x,3)=27]); /* Simply supported beam, constant load f0 */ soln:linode(EI*'diff(y,x,4) = f0,y,x,x=0,[y=0,'diff(y,x,2)=0],x=L,[y=0,'diff(y,x,2)=0]); soln:soln,x=L/2+u,factor; /* soln:soln,L=1,f0=-1,EI=1; plot2d(rhs(soln),[u,-L/2,L/2]),L=1; */ /* Damped at both ends, constant load f0 */ soln:linode(EI*'diff(y,x,4) = f0,y,x,x=0,[y=0,'diff(y,x)=0],x=L,[y=0,'diff(y,x)=0]); soln:soln,x=L/2+u,factor; /* soln:soln,L=1,f0=-1,EI=1; plot2d(rhs(soln),[u,-L/2,L/2]),L=1; */ /* Damped at left end, free at the right end, constant load f0 */ soln:linode(EI*'diff(y,x,4) = f0,y,x,x=0,[y=0,'diff(y,x)=0,'diff(y,x,2)=0,'diff(y,x,3)=0]); /* soln:soln,f0=-1,EI=1; plot2d(rhs(soln),[x,0,L]),L=1; */ /* Split solving an equation into finding general solution and satisfying boundary conditions */ soln:linode('diff(y,x,3)+3*'diff(y,x,2)+3*'diff(y,x)+y=-30*exp(-x),y,x); bc(soln,x=0, [y=3,'diff(y,x)=-3,'diff(y,x,2)=-47]); /* Using y(x) in place of y - compatible with 'desolve' */ soln:linode('diff(y(x),x,3)+3*'diff(y(x),x,2)+3*'diff(y(x),x)+y(x)=-30*exp(-x),y(x),x); bc(soln,x=0, [y(x)=3,'diff(y(x),x)=-3,'diff(y(x),x,2)=-47]);