Homework 8, due November 3, 2011.
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Homework 8, due November 3, 2011.
Reading: Chapter 12, Sections 1-5.
Note: for the exercises, if you are asked to write a computer program, you must use a compiled language, such as FORTRAN, C, C++, etc. You may only use matlab to plot your answers or if the problem explicitly says for you to use ode45.
Exercises: 12.1 (number 3 only -- be sure to read the paragraph at the END of the problem), 12.2 (number 6 only), 12.5,12.6 and 12.7.
Also, consider the differential equation
x' = 40 x (1 - x)
where
x(-1) = 1/(1 + exp(40))
Note the initial condition is at t=-1. Use matlab and ode45 to solve this. Compare it with the exact answer, which is
x(t) = 1/(1 + exp(-40 t))
by plotting the two on the same graph. Verify the given exact answer really is the answer by substituting it into the differential equation. Also, on a different graph, plot the error. Does Matlab give a good solution?
Write your own program to use 4th order R-K to solve it. Plot your solution along with the exact solution. Keep reducing the step size until the answer is accurate (it may need to be very small!). Be sure to use double precision if necessary. Note that exp(40) and exp(-40) are huge and tiny numbers, respectively, so be sure your program is able to compute them and not give you Nan or Inf for the former and zero for the latter.
Main point: can you always trust matlab to give the right answer? Look at the original differential equation. Does it look suspicious in any way that would lead you to believe it's problematic? (Answer, no). If you study it further, what is it about the equation that messes stuff up?
Note: for the exercises, if you are asked to write a computer program, you must use a compiled language, such as FORTRAN, C, C++, etc. You may only use matlab to plot your answers or if the problem explicitly says for you to use ode45.
Exercises: 12.1 (number 3 only -- be sure to read the paragraph at the END of the problem), 12.2 (number 6 only), 12.5,12.6 and 12.7.
Also, consider the differential equation
x' = 40 x (1 - x)
where
x(-1) = 1/(1 + exp(40))
Note the initial condition is at t=-1. Use matlab and ode45 to solve this. Compare it with the exact answer, which is
x(t) = 1/(1 + exp(-40 t))
by plotting the two on the same graph. Verify the given exact answer really is the answer by substituting it into the differential equation. Also, on a different graph, plot the error. Does Matlab give a good solution?
Write your own program to use 4th order R-K to solve it. Plot your solution along with the exact solution. Keep reducing the step size until the answer is accurate (it may need to be very small!). Be sure to use double precision if necessary. Note that exp(40) and exp(-40) are huge and tiny numbers, respectively, so be sure your program is able to compute them and not give you Nan or Inf for the former and zero for the latter.
Main point: can you always trust matlab to give the right answer? Look at the original differential equation. Does it look suspicious in any way that would lead you to believe it's problematic? (Answer, no). If you study it further, what is it about the equation that messes stuff up?
Bill Goodwine, 376 Fitzpatrick
Re: Homework 8, due November 3, 2011.
For 12.7 part 2, should each of the graphs have the 4 different methods at one time step, or 1 method at the different time steps?
Re: Homework 8, due November 3, 2011.
Prof., for 12.6 #6, can you give us a hint on how to solve this equation. It's not exact which technically means it's not seperable which means we need an integrating factor. I know in the last paragraph it said IF there is an exact solution etc... so i guess my question is, is there an exact solution? and if so can you give any hints or tricks? thanks!
Re: Homework 8, due November 3, 2011.
Professor,
Could you post the Fortran work you did in class today? As well as the work you did in class on Friday?
Could you post the Fortran work you did in class today? As well as the work you did in class on Friday?
Re: Homework 8, due November 3, 2011.
I think you mean 12.2 #6. If you do mean this, then I believe the answer is that it is separable. It can be rewritten as dx/dt=-x-x^3 then dx/(-x-x^3)=dt.astumpf wrote:Prof., for 12.6 #6, can you give us a hint on how to solve this equation. It's not exact which technically means it's not seperable which means we need an integrating factor. I know in the last paragraph it said IF there is an exact solution etc... so i guess my question is, is there an exact solution? and if so can you give any hints or tricks? thanks!
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
No, it's second order, so you can't solve it by hand.astewar9 wrote:I think you mean 12.2 #6. If you do mean this, then I believe the answer is that it is separable. It can be rewritten as dx/dt=-x-x^3 then dx/(-x-x^3)=dt.astumpf wrote:Prof., for 12.6 #6, can you give us a hint on how to solve this equation. It's not exact which technically means it's not seperable which means we need an integrating factor. I know in the last paragraph it said IF there is an exact solution etc... so i guess my question is, is there an exact solution? and if so can you give any hints or tricks? thanks!
Bill Goodwine, 376 Fitzpatrick
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
I did so today right after class.espinell wrote:Professor,
Could you post the Fortran work you did in class today? As well as the work you did in class on Friday?
Bill Goodwine, 376 Fitzpatrick
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
The only way for there to be four plots with four curves is to plot the exact answer and three different methods for a given time step size on the same plot. Thus one plot should be one time step soze, the next plot another size, &c.Jessie wrote:For 12.7 part 2, should each of the graphs have the 4 different methods at one time step, or 1 method at the different time steps?
Bill Goodwine, 376 Fitzpatrick
Re: Homework 8, due November 3, 2011.
Professor, for problem 12.2 #6, is the differential equation supposed to be second order? That is, should the equation be x’’ + x’ + x^3=0 instead of x’ + x + x^3=0?
Re: Homework 8, due November 3, 2011.
Is the first term in 12.2 #6 supposed to be x double dot rather than xdot?
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
Oops! I totally messed up above. It is only xdot. (That equation with a double-dot is a famous one, which is why I missed it before).jfisher7 wrote:Is the first term in 12.2 #6 supposed to be x double dot rather than xdot?
Bill Goodwine, 376 Fitzpatrick
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
I totally messed this up. You were right before.goodwine wrote:No, it's second order, so you can't solve it by hand.astewar9 wrote:I think you mean 12.2 #6. If you do mean this, then I believe the answer is that it is separable. It can be rewritten as dx/dt=-x-x^3 then dx/(-x-x^3)=dt.astumpf wrote:Prof., for 12.6 #6, can you give us a hint on how to solve this equation. It's not exact which technically means it's not seperable which means we need an integrating factor. I know in the last paragraph it said IF there is an exact solution etc... so i guess my question is, is there an exact solution? and if so can you give any hints or tricks? thanks!
Bill Goodwine, 376 Fitzpatrick
Re: Homework 8, due November 3, 2011.
Do we need to turn in our pages and pages of Fotran/MATLAB code or can we just give the plots?
-
- Site Admin
- Posts: 1596
- Joined: Tue Aug 24, 2004 4:54 pm
- Location: 376 Fitzpatrick
- Contact:
Re: Homework 8, due November 3, 2011.
If you want credit, submit printouts of all of your programs.jmccormi wrote:Do we need to turn in our pages and pages of Fotran/MATLAB code or can we just give the plots?
Bill Goodwine, 376 Fitzpatrick