College Math Teaching

September 23, 2011

Defeating DFIELD6 (a direction field solver for Matlab)

Filed under: calculus, derivatives, differential equations, mathematics education, uniqueness of solution — collegemathteaching @ 5:01 pm

I was teaching students about the existence and uniqueness theorems for first order differential equations; what I taught was the following version:

Given y'=f(t,y) and an open rectangle R = {(t,y), a<t<b, c < y < d} and an initial point (t_0,y_0) \in R
a) If f(t,y) is continuous over R then there is at least one solution y(t) where y(t_0) = y_0 and the solution is valid so long as the graph of y(t) stays in R .
b) if, in addition, \frac{\partial f}{\partial y} is continuous over R then the solution is unique.

Ok, ok, I know that there are stronger statements of the uniqueness theorem but this is fine for a first pass.

We then talked about what this means: basically, if the conditions of the uniqueness theorem are met, then solution curves for the same differential equation cannot intersect (if they did, this would be a point where uniqueness does not hold).

So, for grins, I plotted the direction field (using Matlab and dfield6) for y' = (ty)^{4/5} and showed how the solver struggled along the y = 0 axis due to the partial derivative not existing there. But then:

Check out the solutions below the y = 0 axis. What is going on there? We should have uniqueness!

Then note:
1. These solutions are NOT following the direction fields…
2. The direction field itself is wrong…do you see why? And
3. Note that the “solution” curves have some local maximums and local minimums…that is impossible!

Let’s look at the differential equation again:
y' = (ty)^{4/5} . We see the following immediately:
1. y' is always greater than or equal to zero and can only equal zero when ty = 0 . Hence the lines with “negative” slope in the the direction field are bogus.
2. Any curve can only have relative maximums or minimums when t = 0 and when y = 0 . Our solver put in some bogus ones.

We can work on this “by hand” and see that the unique solution meeting y(0) = y_0 is y(t) = (\frac{1}{9}t^{\frac{9}{5}} + y_0^{\frac{1}{5}})^5 which is valid so long as y \neq 0

We can also examine the differential equation itself to see that the “curves of constant slope” are of the form ty = \pm c ; example: along the hyperbolas y = 1/t and y = -1/t we should have slopes equal to 1 in the direction field. Clearly this is not being accurately represented by dfield6 for this differential equation!

So what is going on?

Hint: try to solve this differential equations with Matlab Runge-Kutta methods (and others); what you’ll find is that the software is using complex roots for the “raised to the 4-5’ths” function.

Upshot: we are still smarter than the software.

1 Comment »

  1. […] you are interested in the topic, you can read the details here. But one of the problems I gave my class was this one: a solver provided this direction field for […]

    Pingback by Our Sesame Street Society « blueollie — November 12, 2011 @ 4:43 am

RSS feed for comments on this post. TrackBack URI

Leave a Reply

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

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

Google photo

You are commenting using your Google 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

Create a free website or blog at

%d bloggers like this: