Question

In: Advanced Math

An improvement to the Forward Euler method is Heun’s method, a “predictor-corrector” approach that uses the...

An improvement to the Forward Euler method is Heun’s method, a “predictor-corrector” approach that uses the predicted values at the next time step to create a second improved (“corrected”) approximation.

Given the first order ODE y = f (x, y), and a point on the solution curve (xn ,  yn), we want to estimate the next point at a step size h later. We make a first prediction of the next value, y*, using the forward Euler approach:

xn+1  =  xn + h
y*n+1  =  yn + hf (xn , yn)
But then this predicted value is used to improve our estimate of the slope f . We compute the approximate slope at the end of our timestep as

f (xn+1, y*n+1).
We then go back and produce our better estimate of yn+1 using the average of the two slopes. i.e.,

yn+1  =  yn + h *(1/2)*[ f (xn , yn) + f (xn+1, y*n+1)].
This is Heun's method. It is also identified as one version of the popular and powerful Runge Kutta methods.

Let y(x) be the solution to the following initial value problem,

y  =  (3/10)*[ y + sin(xy)],    y (0)  =  1

Use Heun's method with h = .001 to estimate the value of y(5).

Solutions

Expert Solution


clear all
close all

%Function for which solution have to do
f=@(x,y) (3/10)*(y+sin(x*y));

    h=0.001;         %amount of intervals
    x=0;             % initial x
    y=1;             % initial y
    x_eval=5;        % at what point we have to evaluate
    n=(x_eval-x)/h; %Number of steps
    x_heun(1)=x;
    y_heun(1)=y;
    for i=1:n
    %improved Eular steps
       m1=double(f(x,y));
       m2=double(f((x+h),(y+h*m1)));
       y=y+double(h*((m1+m2)/2));
       x=x+h;
       y_heun(i+1)=y;
       x_heun(i+1)=x;
    end

    plot(x_heun,y_heun)
    title('x vs. y plot using Heun method')
    xlabel('x')
    ylabel('y(x)')
  
    fprintf('Using Heun method with h=0.001 the estimated value y(%1.0f)=%f\n',x_heun(end),y_heun(end))
  
  
                 %%%%%%%%%%% End of Code %%%%%%%%%%


Related Solutions

* explaine Euler method by words. * Advantage of using Euler mehtod * compar between Euler...
* explaine Euler method by words. * Advantage of using Euler mehtod * compar between Euler and Improved Euler method. ______ please dont copy the ans from wep .
The condition stating that the current forward rate is an unbiased predictor of the future spot...
The condition stating that the current forward rate is an unbiased predictor of the future spot exchange rate is called: the unbiased forward rates condition. uncovered interest rate parity. the international Fisher effect. purchasing power parity. interest rate parity.
Improvement requires change, but not every change is an improvement. The approach used by most organizations...
Improvement requires change, but not every change is an improvement. The approach used by most organizations is to adopt a strategy for managing change and train their staff to facilitate the improvement process. How would you engage front line staff in QI programs when the day-to-day functions alone can be so consuming? Your response must be at least one complete paragraph.
Forward Rate as an Unbiased Predictor: Some forecasters believe that foreign exchange markets for the major...
Forward Rate as an Unbiased Predictor: Some forecasters believe that foreign exchange markets for the major floating currencies are "efficient" and forward exchange rates are unbiased predictors of future spot exchange rates. What is meant by "unbiased predictor" in terms of the reliability of the forward rate in estimating future spot exchange rates?
please clearify why the forward exchange rate contract is the best predictor of exchange rate. The...
please clearify why the forward exchange rate contract is the best predictor of exchange rate. The answer must cover pros and cons
Calculate the Euler method approximation to the solution of the initial value problem at the given...
Calculate the Euler method approximation to the solution of the initial value problem at the given x-values. Compare your results to the exact solution at these x-values. y' = y+y^2; y(1) = -1, x = 1.2, 1.4, 1.6, 1.8
MyPhone, Inc. uses the product cost method of applying the cost-plus approach to product pricing. The...
MyPhone, Inc. uses the product cost method of applying the cost-plus approach to product pricing. The costs of producing and selling 5,380 cell phones are as follows: Variable costs per unit: Fixed costs: Direct materials $64 Factory overhead $198,000 Direct labor 31 Selling and administrative expenses 71,300 Factory overhead 23 Selling and administrative expenses 21 Total variable cost per unit $139 MyPhone desires a profit equal to a 16% rate of return on invested assets of $600,700. a. Determine the...
MyPhone, Inc. uses the product cost method of applying the cost-plus approach to product pricing. The...
MyPhone, Inc. uses the product cost method of applying the cost-plus approach to product pricing. The costs of producing and selling 5,380 cell phones are as follows: Variable costs per unit: Fixed costs: Direct materials $64 Factory overhead $198,000 Direct labor 31 Selling and administrative expenses 71,300 Factory overhead 23 Selling and administrative expenses 21 Total variable cost per unit $139 MyPhone desires a profit equal to a 16% rate of return on invested assets of $600,700. a. Determine the...
Modern medicine typically uses a systems-based approach for medical education and practice. This method focuses on...
Modern medicine typically uses a systems-based approach for medical education and practice. This method focuses on learning the nature of each organ system and focusing on the diseases of that system. While a generalist may be able to diagnose across systems, specialists will focus their practice on a single system or a handful of organ systems. Osteopathic medicine tries to promote a more holistic understanding of medicine, focusing on the causes of disease and their effects on the body as...
Use the Euler method to solve the following differential equation for the domain [2,2.5]. Use the...
Use the Euler method to solve the following differential equation for the domain [2,2.5]. Use the step-size ℎ = 0.1. ?′=?ln?/? ;?(2)=?1 b) Use the third order Taylor series method to find ?(0.1) and ?(0.2), where ?′=1+2?? ;?(0)=0. Use the step-size ℎ=0.1. c) Solve the problem in part (ii) using the fourth order Runge – Kutta method. d) Solve the problem in part (ii) using the Predictor – Corrector method.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT