1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Can you please check my work?

  1. Jan 4, 2015 #1
    1. The problem statement, all variables and given/known data
    Use the Runge-Kutta method to find approximate values of the solution of the initial-value problem y'+(x^2)y=sin xy, y(1)=pi; h=0.2 at the points xi=x0+ih, where x0 is the point where the initial condition is imposed and I=1, 2.

    2. Relevant equations
    yn+1=yn+hf(xn+1/2h, yn+(1/2)hf(xn, yn))
    f(x, y)=sin xy-(x^2)y
    h=0.2, x0=1, y0=pi.

    3. The attempt at a solution
    y1=pi+0.2f(1+0.1, pi+0.1f(1, pi))
    =pi+0.2f(1.1, 2.83291)
    =2.4669

    y2=2.4669+0.2f(1.3, 2.4669+0.1f(1.2, 2.4669))
    =2.4669+0.2f(1.3, 2.11683)
    =1.76101

    But the answer is:
    y1=2.475605264, y2=1.825992433.
    I got y1=2.4669 and y2=1.76101.
    Which is the correct answer? Mine or the book's answer? If I'm wrong, please correct me.
     
  2. jcsd
  3. Jan 4, 2015 #2

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member


    Does that formula mean$$y_{n+1} = y_n + hf(x_n + \frac h 2,y_n + \frac h 2f(x_n,y_n))\text{?}$$
     
  4. Jan 4, 2015 #3

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    Using RK2 and OpenOffice Calc, I get y1=2.4636, y2 =1.8181, which are closer to your answers than to the book's.
    However, if I cut the step size to 0.1 and, correspondingly, look at y2, y4 I get nearly the book answers: 2.4734, 1.8247.
    This suggests the book is using a more accurate method than RK2 with step size 0.2 Maybe it uses RK4 with step size 0.2 - I haven't tried that.
     
  5. Jan 5, 2015 #4
    @LCKurtz , yes, that's the right formula that I'm using.
     
  6. Jan 5, 2015 #5

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    OK. I put that formula in Maple and I get: ##(x_1,y_1)= (1.2, 2.463635926),~(x_2,y_2) = (1.4, 1.818074242)## which agree with Haruspex's results.
     
  7. Jan 5, 2015 #6
    So which answer is right? The book's answer or yours?
     
  8. Jan 5, 2015 #7
    By the way, do I need to set the mode to radians or degrees on my calc?
     
  9. Jan 5, 2015 #8
    What's RK2 and RK4?
     
  10. Jan 5, 2015 #9

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    All I can tell you for sure, is that using the formula you gave us, both Haruspex and I get identical answers independently. I doubt we are both wrong. And, speaking for myself, I am assuming the formula you gave is the appropriate one. If it isn't, all bets are off.
     
  11. Jan 5, 2015 #10

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Radians, of course!
     
  12. Jan 5, 2015 #11

    LCKurtz

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

  13. Jan 5, 2015 #12

    haruspex

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member
    2016 Award

    It is RK2.
     
  14. Jan 5, 2015 #13
    Thank you guys for the help!
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Can you please check my work?
  1. Check my work please? (Replies: 4)

  2. Please check my work (Replies: 2)

Loading...