Question
The outputs are very close to the correct values so I assume I just typed an equation incorrectly, but I have not been able to find the error.

Courses LMS integration Documentation Write a function to implement the 4th order Runge Kutta method function [ty] - r4(f, ra
Courses LMS Integration Documentation 1 function [t,y] = rk4(f, range, ic,h) 2 %input f is the RHS of the ODE 3 %input rannge
91- YIL k2=f(y1,t(i)); y2=y(i)+k2*h/2; k3=f(y2,t(i)); y3=y(i)+k3*h; k4=f(y3,t(i)); y(i+1)=y(i)+(k1+2*k2+2*k3+4)*h/6; end Code
Output t = 1.0000 1.2500 1.5000 1.7500 2.0000 3.0000 3.5156 4.0770 4.6830 5.3327 Previous Assessment: 0 of 2 Tests Passed ® T
0 0
Add a comment Improve this question Transcribed image text
Answer #1

import math def f(x, y): b=X+y return (math.sqrt(b)) def rk4(f, rangel, ic, h): n = (int((x - range1[0][0])/h)) y = ic range1

just change the value of h to 0.247

Add a comment
Know the answer?
Add Answer to:
The outputs are very close to the correct values so I assume I just typed an...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT