Mth21202f08 – Week 1

I am working on the differential equation \frac{dy}{dx}=-x(y+1)

0 0
0.1 0
0.2 -0.01
0.3 -0.0298
0.4 -0.058906
0.5 -0.09654976
0.6 -0.141722272
0.7 -0.193218936
0.8 -0.24969361
0.9 -0.309718121
1 -0.37184349
1.1 -0.434659141
1.2 -0.496846636
1.3 -0.55722504
1.4 -0.614785784
1.5 -0.668715775
1.6 -0.718408408
1.7 -0.763463063
1.8 -0.803674342
1.9 -0.839012961
2 -0.869600498
2.1 -0.895680399
2.2 -0.917587515
2.3 -0.935718262
2.4 -0.950503061
2.5 -0.962382327
2.6 -0.971786745
2.7 -0.979122191
2.8 -0.9847592
2.9 -0.989026624
3 -0.992208903
3.1 -0.994546232
3.2 -0.9962369
3.3 -0.997441092
3.4 -0.998285532
3.5 -0.998868451
3.6 -0.999264493
3.7 -0.999529276
3.8 -0.999703444
3.9 -0.999816135
4 -0.999887842
4.1 -0.999932705
4.2 -0.999960296
4.3 -0.999976972
4.4 -0.999986874
4.5 -0.999992649
4.6 -0.999995957
4.7 -0.999997817
4.8 -0.999998843
4.9 -0.999999398
5 -0.999999693
5.1 -0.999999847
5.2 -0.999999925
5.3 -0.999999964

Second, I used MatLab to creat a direction, or slope, field for the differential equation.

>> [X, Y] = meshgrid(-7:.6:7 , -7:.6:7);

>> S = -X.*(Y + 1);

>> L = sqrt( 1 + S.^2);

>> quiver(X, Y, 1./L, S./L, .5), axis tight

Thirdly, I used the code dsolve to exactly solve the equation in MatLab, and then used ezplot. The codes were as followed:

>> SOL = dsolve(‘Dy = -x * ( y + 1)’, ‘y(0) = 0′, ‘x’)

>> ezplot(SOL [0 10])

Which resulted in the following graph:

\frac{dy}{dx}=-x(y+1)

\frac{dy}{y+1}=-x*dx

ln(y+1)=-\frac{x^2}{2}

y+1=e^{-\frac{x^2}{2}}

y=e^{-\frac{x^2}{2}}-1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.