Idli

Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Saransh Sood 15034.

wxmx 1 / 29

Differential Equations Practical File


1 Solution of first order differential equation.
Steps to solve:
- Represent the equation using `'diff`
- Get the solution using `ode2`
- Plot/add values to get graph/particular solution using `ic1`

Commands(BASICs): `depends(y, x)`, `diff`, `ode2`, `ic1`, `wxplot2d`

1.1 Solve the equation `dy/dx - 2 = 0` at value y(0) = 1


depends(y, x);
eq1: diff(y,x) − 2 = 0;
d
[ y ( x )] y−2=0
dx
sol1: ode2(eq1, y,x);
y = 2 x + %c
ps1: ic1(sol1, x= 0, y=1);
y=2 x+1
wxplot2d(rhs(ps1), [x, −10, 10], [y, −10,10], [style, [lines, 3]]);
plot2d: some values will be clipped.

1.2 Solve the equation `dy/dy = -y` for value y(1) = 8


depends(y,x);
eqn2 : diff(y,x) = −y;
d
[ y ( x )] y=−y
dx
Saransh Sood 15034.wxmx 2 / 29

sol2 : ode2(eqn2, y, x);


−x
y = %c %e

ps2: ic1(sol2, x=1, y=8);


1−x
y = 8 %e
wxplot2d(rhs(ps2), [x, 0, 10], [y, 0, 10], [style, [lines, 3]]);
plot2d: some values will be clipped.

1.3 Solve the equation `dy/dy + y = x + 1` for value y(2) = 4


depends(y,x);
eqn3 : diff(y,x) + y = x + 1;
d
[ y ( x )] y+y=x+1
dx
sol3 : ode2(eqn3, y, x);
−x x x
y = %e ( x − 1 ) %e + %e + %c
ps3: ic1(sol3, x=2, y=4);
−x x 2
y = %e ( x %e + 2 %e )

wxplot2d(rhs(ps3), [x, 0, 10], [y, 0, 10], [style,[lines, 3]]);


plot2d: some values will be clipped.
Saransh Sood 15034.wxmx 3 / 29

1.4 Solve the equation `dy/dy + 2sin2πx = 0` for y(0) = 1


depends(y,x);
eqn4 : diff(y,x) + 2·sin(2·π·x) = 0;
d
[ y ( x )] y + 2 sin ( 2 π x ) = 0
dx
sol4 : ode2(eqn4, y, x);
cos ( 2 π x )
y= + %c
π
ps4: ic1(sol4, x=0, y=1);
cos ( 2 π x ) + π − 1
y=
π
wxplot2d(rhs(ps4), [x, 0, 5], [y, 0, 5], [style,[lines, 3]]);
Saransh Sood 15034.wxmx 4 / 29

⟶⟶⟶

2 Plotting of second order solution family of differential


equation.
Steps to solve:
- Represent the second order equation
- Obtain the general and the particular solution
- Plot the curves for a family of points using `ev`

Commands: BASICs + `ev`

2.1 Solve the equation `d²y/dx² + 4y = 0` for y(0) = 1 and plot family of curves.
depends(y, x);

[ y ( x )]
eq: diff(y, x, 2) + 4 ·y = 0;
2
d
y+4 y=0
2
dx
gs: ode2(eq, y, x);
y = %k1 sin ( 2 x ) + %k2 cos ( 2 x )
ps : ic2(gs, x=0, y = 1, diff(y,x)= b);
b sin ( 2 x )
y= + cos ( 2 x )
2
Saransh Sood 15034.wxmx 5 / 29

ps1 : ev(ps, b = −2);


ps2 : ev(ps, b = −1);
ps3 : ev(ps, b = 0);
ps4 : ev(ps, b = 1);
ps5 : ev(ps, b = 2);

y = cos (2 x )− sin(2 x ) y = cos (2 x )−


sin ( 2 x ) sin ( 2 x )
y = cos ( 2 x ) y=
2 2
+ cos ( 2 x ) y = sin ( 2 x ) + cos ( 2 x )
wxplot2d([rhs(ps1), rhs(ps2), rhs(ps3), rhs(ps4), rhs(ps5)], [x, −3, 3], [y, −5, 5], [style, [lines, 2]]);

2.2 Solve the equation `d²y/dx² + 4x = 0` for y(0) = a and dy/dx =1 and plot the
family of curves.
depends(y, x);

[ y ( x )]
eq1: diff(y, x, 2) + 4·x = 0;
2
d
y+4 x=0
2
dx
gs1: ode2(eq1, y, x);
3
y=− 2 x + %k2 x + %k1
3
PS: ic2(gs1, x=0, y = a, diff(y,x)= 1);
3
y=− 2 x +x+a
3
Saransh Sood 15034.wxmx 6 / 29

PS1: ev(PS, a=−1);


PS2: ev(PS, a=0);
PS3: ev(PS, a=1);

3 3 3
2x 2x
y= − +x−1 y=x− y=− 2 x +x+1
3 3 3
wxplot2d([rhs(PS1), rhs(PS2), rhs(PS3)], [x, −3, 3], [y, −5, 5], [style, [lines, 3]]);
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.

2.3 Solve the equation `d²y/dx² + 4y + x = 0` for y(0) = a and dy/dx = b and plot the
family of curves.
depends(y,x);

[ y ( x )]
eq3: diff(y,x,2) + 4·y + x = 0;
2
d
y+4 y+x=0
2
dx
sol3: ode2(eq3, y, x);
x
y = %k1 sin ( 2 x ) + %k2 cos ( 2 x ) −
4
res: ic2(sol, x=0, y=a, diff(y,x) = b);
( 4 b + 1 ) sin ( 2 x ) x
y= + a cos ( 2 x ) −
8 4
Saransh Sood 15034.wxmx 7 / 29

res1: ev(res, a=0, b=1);


res2: ev(res, a=1, b=0);
res3: ev(res, a=1, b=1);
res4: ev(res, a=0, b=0);

y=
5 sin ( 2 x ) x sin ( 2 x ) x 5 sin ( 2 x )
− y= + cos ( 2 x ) − y= + cos ( 2 x ) −
8 4 8 4 8
x sin ( 2 x ) x
y= −
4 8 4
wxplot2d([rhs(res1), rhs(res2), rhs(res3), rhs(res4)], [x,−5, 5], [style, [lines, 2]]);

2.4 Solve the equation `d²y/dx² + 3dy/dx + 2y = 0` for different values of natural
constants and plot the family of curves.
depends(y, x);

[ y ( x )]
eq4 : diff(y, x, 2)+ 3·diff(y, x)+ 2·y = 0;
2
d d
y+3 y +2 y=0
2 dx
dx
sol4: ode2(eq4, y, x);
−x −(2 x)
y = %k1 %e + %k2 %e
pcs: ic2(sol4, x=0, y=1, diff(y,x) = 4);
−x −(2 x)
y = 6 %e − 5 %e
Saransh Sood 15034.wxmx 8 / 29

pcs1: ev(sol4, %k1=0, %k2=1);


pcs2: ev(sol4, %k1=1, %k2=0);
pcs3: ev(sol4, %k1=1, %k2=−1);
pcs4: ev(sol4, %k1=−1, %k2=1);
pcs5: ev(sol4, %k1=1, %k2=1);
−(2 x) −x −x −(2 x) −(2 x) −x
y = %e y = %e y = %e − %e y = %e − %e
−x −(2 x)
y = %e + %e
wxplot2d([rhs(pcs1), rhs(pcs2), rhs(pcs3), rhs(pcs4), rhs(pcs5)], [x, −5, 5], [y, −5, 5], [style, [lines, 2]]);
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.

⟶⟶⟶

3 Plotting of third order solution family of differential


equation.
Steps to solve:
- Represent the third order equation
- Load the `odes` function set.
- Use `odeL` function to get the GS (Mandatory to show)
- Use `odeL_ic` function to get the PS directly from the equation
- Alternatively, substitute values to get PS using `ev`

Commands: BASICs + `load(odes)`, `odeL`, `odeL_ic`

3.1 Solve the third order equation `dy³/d³x + y = xe^xsin²x` for the values y(0)=1,
y'(0)=2, y''(0)=3 and hence obtain the curve.
Saransh Sood 15034.wxmx 9 / 29

depends(y, x);
Eq: diff(y, x, 3) + y = x·(%e^x) · (sin(x))^2;
3
d x 2
[y (x )] y + y = x %e sin ( x )
3
dx
load(odes);
So: odeL(Eq, y, x);
x/2
C:/maxima−5.47.0/share/maxima/5.47.0/share/contrib/odes/odes.mac y = C3 %e
x/2 −x
3 x 3 x
sin + C2 %e cos + C1 %e
2 2
sol1: ev(So, C1 =1, C2= 2, C3=3);
x/2 x/2 −x
3 x 3 x
y = 3 %e sin + 2 %e cos + %e
2 2
so1: odeL_ic(Eq, y, x, [0, 1, 2, 3]);
x/2 x/2
3 x 3 x
5 %e sin %e cos −x
2 2 2 %e
y= + +
3 3 3
wxplot2d(rhs(so1), [x, −10, 10], [y, −100, 100], [style, [lines, 4]]);
plot2d: some values will be clipped.

3.2 Solve the equation `dy³/d³x + 3dy/dx - 4y = 0` as an IVP for the values y(0)=1,
y'(0)=2, y''(0)=3.
depends(y, x)$
e2: diff(y, x, 3) + 3·diff(y, x) − 4·y = 0;
Saransh Sood 15034.wxmx 10 / 29

3
d d
y+3 y −4 y=0
3 dx
dx
load(odes)$
sol : odeL(e2, y, x);
x x
− −
2 3 5 x 2 3 5 x x
y = C3 %e sin + C2 %e cos + C1 %e
2 2
s1: odeL_ic(e2, y, x, [0, 1, 2, 3]);
x x
− −
2 2
3 5 x 3 5 x
%e sin %e cos x
2 2 3 %e
y= − +
2 3 5 2 2
wxplot2d(rhs(s1), [x, −5, 5], [style, [lines, 4]]);

3.3 Solve the third order equation `dy³/d³x + y = xe^xsin²x` as an initial value
problem for values y(0)=4, y'(0)=-7 and y"(0)=23.
depends(y, x)$
e1: diff(y, x, 3) + y = x· e^x·(sin(x))^2;
3
d x 2
y + y = e x sin ( x )
3
dx
load(odes)$
gs1: odeL(e1, y, x);
x/2 x/2 −x
3 x 3 x
y = C3 %e sin + C2 %e cos + C1 %e
2 2
Saransh Sood 15034.wxmx 11 / 29

s1: odeL_ic(e1, y, x, [0, 1, −7, 23]);


x/2 x/2
3 x 3 x
16 %e sin 28 %e cos −x
y= 2 2 31 %e
− +
3 3 3
wxplot2d(rhs(s1), [x, −5, 5], [style, [lines, 4]]);

⟶⟶⟶

4 Solution of differential equation by variation of parameters


method.
Steps to Solve:
- Represent the equation and find the Yc (`expand` and `rhs`)
- Determine Y1, Y2 (using `coeff`) and R (directly).
- Find the wronskian, w of the matrix given by Y1 and Y2 (`matrix`)
- Determine U1, U2 and hence Yp by using formulas (`integrate`)
- U1 = - ∫ (Y2 R / w) - U2 = ∫ (Y1 R / w) - Yp = Y1 U1 + Y2 U2
- Get the final solution, y = Yc + Yp

Commands in use: BASICs + `expand` `rhs` `coeff` `matrix` `determinant` `integrate`

4.1 Solve the equation `d²y/dx² - 2dy/dx + y = 0` using VOP.


depends(y,x);
eqn: diff(y,x,2) − 2·diff(y, x ) + y = 0;
sol: ode2(eqn, y, x);
2
d d x
[ y ( x )] y−2 y +y=0 y = ( %k2 x + %k1 ) %e
2 dx
dx
Saransh Sood 15034.wxmx 12 / 29

sol1: expand(sol);
yc: rhs(sol1);
x x x x
y = %k2 x %e + %k1 %e %k2 x %e + %k1 %e
y1: coeff(yc, %k1);
y2: coeff(yc, %k2);
r: %e^x·sin(x);
x x x
%e x %e %e sin ( x )
m: matrix([y1, y2], [diff(y1,x), diff(y2, x)]);
w: determinant(m);
x x
%e x %e x x x 2x
%e ( x %e + %e ) − x %e
x x x
%e x %e + %e

u1: −integrate(y2·r/w, x);


u2: integrate(y1·r/w, x);
x cos ( x ) − sin ( x ) − cos ( x )
yp: u1·y1+u2·y2;
x x
%e ( x cos ( x ) − sin ( x ) ) − x %e cos ( x )
y: yc + yp;
x x x x
%e ( x cos ( x ) − sin ( x ) ) − x %e cos ( x ) + %k2 x %e + %k1 %e
kill(all)$

4.2 Solve the equation `d²y/dx² - dy/dx - 2y = e^3x`.


depends(y,x);
eq: diff(y,x,2) − diff(y,x) − 2·y = %e^(3·x);
sol: ode2(eq, y, x);
2 3x
d d 3x %e 2x −x
[ y ( x )] y− y − 2 y = %e y= + %k1 %e + %k2 %e
2 dx 4
dx
sol1: expand(sol);
yc: rhs(sol1);
3x 3x
%e 2x −x %e 2x −x
y= + %k1 %e + %k2 %e + %k1 %e + %k2 %e
4 4
y1: coeff(yc, %k1);
y2: coeff(yc, %k2);
r: %e^(3·x);
2x −x 3x
%e %e %e
m: matrix([y1, y2], [diff(y1, x), diff(y2, x)]);
w: determinant(m);
2x −x
%e %e x
− ( 3 %e )
2x −x
2 %e − %e

u1: −integrate(y2·r/w, x);


u2: integrate(y1·r/w, x);
Saransh Sood 15034.wxmx 13 / 29

x 4x
%e
− %e
3 12
yp: u1·y1 + u2·y2;
3x
%e
4
y: yc + yp;
3x
%e 2x −x
+ %k1 %e + %k2 %e
2
kill(all)$

4.3 Solve the equation `d²y/dx² + y = 0`.


depends(y,x)$
e: diff(y, x, 2) + y = 0;
s: ode2(e, y,x);
2
d
y+y=0 y = %k1 sin ( x ) + %k2 cos ( x )
2
dx
s1: expand(s);
yc: rhs(s1);
y = %k1 sin ( x ) + %k2 cos ( x ) %k1 sin ( x ) + %k2 cos ( x )
y1: coeff(yc, %k1);
y2: coeff(yc, %k2);
r: 0;
sin ( x ) cos ( x ) 0
m: matrix([y1, y2], [diff(y1, x), diff(y2, x)]);
w: determinant(m);

sin ( x ) cos ( x ) 2 2
− sin ( x ) − cos ( x )
cos ( x ) − sin ( x )

u1: −integrate(y2·r/w, x);


u2: integrate(y1·r/w,x);
yp: u1·y1+u2·y2;
0 0 0
y: yc+yp;
%k1 sin ( x ) + %k2 cos ( x )

⟶⟶⟶

5 Solution of systems of ordinary differential equations.


Saransh Sood 15034.wxmx 14 / 29

Steps to solve simultaneous equations:


- Represent the simultaneous equations as functions of the independent variable
- Get the GS by solving the given equations using `desolve`
- Get the PS using `ev` and `at` supplying the values given
- Alternatively, substitute given values for the functions using `atvalue` and then use desolve to get
the PS

New commands: BASICs + `desolve`, `atvalue`, `at`

5.1 Solve the system of simultaneous equations `dx(t)/dt = t` and `dy(t)/dt = t²` at
value x(0) = 1 and y(0) = 2
eqx: diff(x(t), t) = t;
eqy: diff(y(t), t) = t^2;
d d 2
x ( t )= t y ( t )= t
dt dt
sol: desolve([eqx, eqy], [x(t), y(t)]);
2 3
t t
x ( t )= + x ( 0 ), y ( t )= +y(0)
2 3
atvalue(x(t), t=0, 1);
atvalue(y(t), t=0, 2);
1 2
desolve([eqx, eqy], [x(t), y(t)]);
2 3
t t
x ( t )= + 1 , y ( t )= +2
2 3
ev(sol, at(x(t), t=0) =1, at(y(t), t=0) = 2);
2 3
t t
x ( t )= + 1 , y ( t )= +2
2 3
kill(all)$

5.2 Solve the system of simultaneous equations `dx(t)/dt = 7x - y` and `dy(t)/dt = 2x


+ 5y` at value x(0) = 10 and y(0) = -5
/* 1st way */
eqx1a: diff(x(t), t) = 7·x − y;
eqy1a: diff(y(t), t) = 2·x + 5·y;
d d
x ( t )= 7 x − y y ( t )= 5 y + 2 x
dt dt
desolve([eqx1a, eqy1a], [x(t), y(t)]);

[ x ( t )= − ( t y ) + 7 t x + x ( 0 ), y ( t )= 5 t y + 2 t x + y ( 0 )]
/* 2nd way */
eqx1b: diff(x(t), t) = −y(t) + 7·x(t);
eqy1b: diff(y(t), t) = 5·y(t) + 2·x(t);
d d
x ( t )= 7 x ( t )− y ( t ) y ( t )= 5 y ( t )+ 2 x ( t )
dt dt
atvalue(x(t), t=0, 10);
atvalue(y(t), t=0, −5);
10 −5
Saransh Sood 15034.wxmx 15 / 29

desolve([eqx1b, eqy1b], [x(t), y(t)]);


6t 6t
x (t)= %e ( 15 sin ( t ) + 10 cos ( t ) ) , y ( t ) = %e ( 25 sin ( t ) − 5 cos ( t ) )

/* 3rd way */
eqx1c: diff(x(t), t) = −y(t) + 7·x(t);
eqy1c: diff(y(t), t) = 5·y(t) + 2·x(t);
d d
x ( t )= 7 x ( t )− y ( t ) y ( t )= 5 y ( t )+ 2 x ( t )
dt dt
solu: desolve([eqx1c, eqy1c], [x(t), y(t)]);

6t ( 2 ( − y ( 0 ) − 5 x ( 0 ) ) + 12 x ( 0 ) ) sin ( t ) 6t
[ x ( t ) = %e + x ( 0 ) cos ( t ) , y ( t ) = %e
2

( 12 y ( 0 ) + 2 ( 2 x ( 0 ) − 7 y ( 0 ) ) ) sin ( t )
+ y ( 0 ) cos ( t ) ]
2
ev(solu, at(x(t), t=0) =10, at(y(t), t=0) = −5);
6t 6t
x ( t ) = %e ( 15 sin ( t ) + 10 cos ( t ) ) , y ( t ) = %e ( 25 sin ( t ) − 5 cos ( t ) )

kill(all)$

5.3 Solve the system of simultaneous equations `dy(t)/dt = y(t) + 2x(t)` and `dx(t)/dt
= 4y(t) + 3x(t)` at value x(0) = 1 and y(0) = 0
eqx2: diff(y(t), t) = y(t) + 2· x(t);
eqy2: diff(x(t), t) =4·y(t) + 3· x(t);
d d
y ( t )= y ( t )+ 2 x ( t ) x ( t )= 4 y ( t )+ 3 x ( t )
dt dt
atvalue(x(t), t=0, 1);
atvalue(y(t), t=0, 0);
1 0
desolve([eqx2, eqy2], [x(t), y(t)]);
5t −t 5t −t
2 %e %e %e %e
x ( t )= + , y ( t )= −
3 3 3 3
kill(all)$

⟶⟶⟶

6 Solution of Cauchy problem for first order PDE.


Steps to solve:
- Find characteristic equations for the PDE and the represent them
- Solve them individually and find the values of constants occuring in the solution using `solve`
- Make one of the obtained values as a function of other and solve for u
- Represent the obtained result as a function of u as u(x, y)
- Substitute the given condition for u and solve for f, representing it as a function later
- Obtain the result using the equation 'u(x,y) = u(x,y) and plot the curve for u(x,y) using `wxplot3d`

Commands: BASICs + `solve`, `wxplot3d`

6.1 Solve the PDE `u_x + u_y = 1` for u(0, y) = y² - y


Saransh Sood 15034.wxmx 16 / 29

eq: 'diff(y,x) = 1;
sol: ode2(eq, y, x);
solve(%, %c);
d
y=1 y = x + %c [ %c = y − x ]
dx
eq2: 'diff(u,y) = 1;
sol2: ode2(eq2, u, y);
solve(%, %c);
d
u=1 u = y + %c [ %c = u − y ]
dy
u − y =f(y−x);
solve(%, u);

u−y=f(y−x) [ u = f ( y − x )+ y ]
u(x, y) := f(y−x) + y;
u ( x , y ) := f ( y − x ) + y
u(0, y) = y^2;
solve(%, f(y));
2 2
f ( y )+ y = y f ( y )= y − y
f(y) := y^2 − y ;
2
f ( y ) := y − y
'u(x,y) = u(x,y);
2
u ( x , y )= ( y − x ) + x
wxplot3d(u(x,y), [x, −10, 10], [y, −10, 10]);
kill(all)$
Saransh Sood 15034.wxmx 17 / 29

6.2 Solve the PDE `u_x - u_y = 1` for u(x, 0) = x²


eq: 'diff(y,x) = −1;
sol: ode2(eq, y, x);
solve(%, %c);
d
y=−1 y = %c − x [ %c = y + x ]
dx
eq2: 'diff(u,x) = 1;
sol2: ode2(eq2, u, x);
solve(%, %c);
d
u=1 u = x + %c [ %c = u − x ]
dx
u − x =f(y+x);
solve(%, u);

u−x=f(y+x) [ u = f ( y + x )+ x ]
u(x, y) := f(y+x) + x;
u ( x , y ) := f ( y + x ) + x
u(x, 0) = x^2;
solve(%, f(x));
2 2
f ( x )+ x = x f ( x )= x − x
f(x) := x^2 − x;
2
f ( x ) := x − x
Saransh Sood 15034.wxmx 18 / 29

'u(x,y) = u(x,y);
2
u (x ,y )= (y + x ) − y

wxplot3d(u(x,y), [x, −10, 10], [y, −10, 10]);


kill(all)$

6.3 Solve the PDE `xu_x +yu_y = xe^-u` for u(x, x²) = 0
eq1:'diff(y,x)=y/x;
sol1:ode2(eq1,y,x);
solve(y=c1·x,c1);

d y y
y= y = %c x c1 =
dx x x
eq2:'diff(u,x)=%e^−u;
sol2:ode2(eq2,u,x);
solve(%e^u=x+c2,c2);
d −u u u
u = %e %e = x + %c c2 = %e − x
dx
%e^u−x=f(y/x);
solve(%,u);

u y y
%e − x = f u = log f +x
x x

u(x,y):=log(f(y/x)+x);

y
u ( x , y ) := log f +x
x
Saransh Sood 15034.wxmx 19 / 29

u(x,x^2)=0;
solve(%,(f(x)));
log(f(x )+ x )= 0 [f(x )= 1 − x ]

f(x):=1−x;
'u(x,y)=u(x,y);

y
f ( x ) := 1 − x u ( x , y ) = log − +x+1
x

wxplot3d(u(x,y),[x,−10,10],[y,−10,10]);
kill(all)$
expt: undefined: 0 to a negative exponent.

⟶⟶⟶

7 Plotting the characteristics for the first order PDE.


Steps to solve:
- Represent the characteristic equations of the PDE
- Solve them individually for values of c and then represent one as the function of the other
- Solve the previous equation for u, which gives us u(x, y)
- Make use of `makelist` to get a range of values to plot for the function derived above.
- Plot the curve for the list hence obtained

Commands: BASICs + `makelist`

7.1 Plot the charactertistics of the equation `xu_x + yu_y = u`


Saransh Sood 15034.wxmx 20 / 29

e1: 'diff(y, x) = y/x;


s1: ode2(e1, y, x);
solve(%, %c);

d y y
y= y = %c x %c =
dx x x
e2: 'diff(u, x )= u/x;
s2: ode2(e2, u, x);
solve(%, %c);

d u u
u= u = %c x %c =
dx x x
u/x = f(y/x);
solve(%, u);

u y y
=f u=x f
x x x

u(x,y) := x· f(y/x);
y
u ( x , y ) := x f
x
p: makelist(c1·x, c1, −3, 3);

[−(3 x),−(2 x),−x,0,x,2 x,3 x]


wxplot2d(p, [x, −10, 10], [y, −10,10], [style, [lines, 2]]);
kill(all)$
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.
Saransh Sood 15034.wxmx 21 / 29

7.2 Draw the characteristic curve for the first order PDE `u_x + x*u_y= 0`
eq1: 'diff(y, x) = x;
sol1: ode2(eq1, y, x);
solve(%, %c);
2 2
d x 2 y−x
y=x y= + %c %c =
dx 2 2
eq2: 'diff(u, x) = 0;
sol2: ode2(eq2, u, x);
solve(%, %c);
d
u=0 u = %c [ %c = u ]
dx
u = f((2·y − x^2)/2);
solve(%, u);
2 2
u=f 2 y−x u=f y− x
2 2

Q: makelist((x^2/2)+ c1, c1, 0, 4);


2 2 2 2 2
x x x x x
, +1, +2, +3, +4
2 2 2 2 2
wxplot2d(Q, [x, −5, 5], [y, −5, 10], [style, [lines, 2]]);
plot2d: some values will be clipped.
plot2d: some values will be clipped.
plot2d: some values will be clipped.
Saransh Sood 15034.wxmx 22 / 29

plot2d: some values will be clipped.


plot2d: some values will be clipped.

⟶⟶⟶

8 Plot the integral surfaces of a given first order PDE with


initial data.
Steps to solve:
- Represent the characteristic equations, solve them and use `subst` to substitute constants getting
their values.
- Substitute the parametric conditions for the constants using the `subst` function
- Find the values of x, y, u using the obtained values of constants
- Substitute the constants once again alltogether into the initial equation
- Load the `draw` set of functions
- Plot the initial curve using the `parametric` function passing the parameters
- Plot the integral surface using the `parametric_surface` function.
- Plot the two alltogether to get the resultant surface

Commands: BASICs + `subst`, `parametric`, `parametric_surface`, `load(draw)`

8.1 Find the integral surface of the PDE ux_y + uu_y = 1, so that the surface passes
through initial curve represented parameterically by x(s,0)=2s², y(s,0)=2s ,
u(s,0)=0, where s>0 is parameter.
eq1: 'diff(u,t) = 1;
sol1: ode2(eq1, u,t);
a1:subst( %c=c1, sol1);
solve(a1, c1);
Saransh Sood 15034.wxmx 23 / 29

d
u=1 u = t + %c u = t + c1 [ c1 = u − t ]
dt
eq2: 'diff(y,t)=1;
sol2:ode2(eq2,y,t);
a2:subst(%c=c2, sol2);
solve(a2, c2);
d
y=1 y = t + %c y = t + c2 [ c2 = y − t ]
dt
eq3: 'diff(x, t) = t+c1;
sol3: ode2(eq3, x, t);
a3: subst(%c = c3, sol3);
solve(a3, c3);
2 2 2
d t t 2 x − t − 2 c1 t
x = t + c1 x= + c1 t + %c x= + c1 t + c3 c3 =
dt 2 2 2
subst([t=0, x =2·s^2], a3);
subst([t=0, y=2·s], a2);
subst([t=0, u=0], a1);
2
2 s = c3 2 s = c2 0 = c1
'x = t^2/2+2·s^2;
'y = t+2·s;
'u= t;
2
t 2
x= +2 s y=t+2 s u=t
2
subst([c1=0, c2=2·s, c3=2·s^2], [a1, a2, a3]);
2
t 2
u=t,y=t+2 s,x= +2 s
2
load(draw);
C:/maxima−5.47.0/share/maxima/5.47.0/share/draw/draw.lisp
wxdraw3d(color=black,parametric(2·s^2, 2·s, 0, s, −100, 100),
title="Initial curve");
Saransh Sood 15034.wxmx 24 / 29

wxdraw3d(color=cyan, parametric_surface( t^2/2+2·s^2, t+2·s, t, s, −100, 100, t, −100, 100),


title="Integral surface");
Saransh Sood 15034.wxmx 25 / 29

wxdraw3d( color=gold, parametric_surface(t^2/2+2·s^2, t+2·s, t, s, −100, 100, t, −100, 100),


color=black,parametric(2·s^2, 2·s, 0, s, −100, 100), title="Integral surface with initial curve");
kill(all)$
Saransh Sood 15034.wxmx 26 / 29

8.2 Find the integral surface of that PDE u_x - u_y = x + y, so that it passes through
the initial curve represented parametrically by x(s,0) = s^2, y(s,0) = -s, u(s,0) = 0,
where s > 0 is a parameter.
eq1: 'diff(u,t) = x + y;
sol1: ode2(eq1, u,t);
a1:subst( %c=c1, sol1);
solve(a1, c1);
d
u=y+x u = t ( y + x ) + %c u = t ( y + x ) + c1 [ c1 = − ( t y ) − t x + u ]
dt
eq2: 'diff(y,t)= −1;
sol2:ode2(eq2,y,t);
a2:subst(%c=c2, sol2);
solve(a2, c2);
d
y=−1 y = %c − t y = c2 − t [ c2 = y + t ]
dt
eq3: 'diff(x, t) = 1;
sol3: ode2(eq3, x, t);
a3: subst(%c = c3, sol3);
solve(a3, c3);
d
x=1 x = t + %c x = t + c3 [ c3 = x − t ]
dt
subst([t=0, x =s^2], a3);
subst([t=0, y=−s], a2);
subst([t=0, u=0], a1);
Saransh Sood 15034.wxmx 27 / 29

2
s = c3 − s = c2 0 = c1
'x = t+s^2;
'y = −s − t;
'u= −(t·( −s − t)) + t·(t + s^2);
2 2
x=t+s y=−t−s u=t (t+s )−(−t−s) t

subst([c1=0, c2=−s, c3=s^2], [a1, a2, a3]);


2
u=t (y+x),y=−t−s,x=t+s
load(draw);
C:/maxima−5.47.0/share/maxima/5.47.0/share/draw/draw.lisp
wxdraw3d(color=black,parametric(s^2, −s, 0, s, −100, 100),
title="Initial curve");

load(draw)$
wxdraw3d(parametric_surface(t+ s^2, −t−s, t·(t+s^2)−(−s −t)· t , s, −100, 100, t, −100, 100),
title="Integral surface");
Saransh Sood 15034.wxmx 28 / 29

wxdraw3d( color=pink, parametric_surface(t+ s^2, −t−s, t·(t+s^2)−(−s −t)· t , s, −100, 100, t, −100, 100),
color=black,parametric(s^2, −s, 2·s, s, −100, 100), title="Integral surface with initial curve");
Saransh Sood 15034.wxmx 29 / 29

⟶⟶⟶ cc. @specbeck

You might also like