Question

In: Advanced Math

Homework 1.1. (a) Find the solution of the initial value problem x' = x^(3/8) , x(0)=1...

Homework 1.1. (a) Find the solution of the initial value problem x' = x^(3/8) , x(0)=1 , for all t, where x = x(t). (b) Find the numerical solution on the interval 0 ≤ t ≤ 1 in steps of h = 0.05 and compare its graph with that of the exact solution. You can do this in Excel and turn in a printout of the spreadsheet and graphs.

Solutions

Expert Solution

%Matlab code for numerical solution of ode using RK4 method
clear all
close all
%function for which Solution have to do
fun=@(t,x) x.^(3/8);
%exact solution
y_ext=@(t) (5/8.*t+1).^(8/5);
fprintf('Exact solution for given initial condition is x(t)=')
disp(y_ext)
%initial guess
tinit=0; xinit=1;
tend=1;
    [t_rk4,x_rk4]=RK4(fun,tinit,xinit,tend,0.05);
    x_exact=double(y_ext(t_rk4));
    error=norm(x_exact-x_rk4);
    fprintf('Error norm in Classic RK4 is %e\n',error)
    fprintf('\tFor n=%d value of x(%2.2f) is %f\n',2000,t_rk4(end),x_rk4(end))

plot(t_rk4,x_exact,'linewidth',2)
hold on
plot(t_rk4,x_rk4,'--')

ylabel('t')
xlabel('x(t)')
title('t vs. x(t) plot')
legend('Actual solution','RK4 Solution','location','best')

%%Matlab function for Runge Kutta Method
function [t_rk,y_rk]=RK4(f,tinit,yinit,tend,h)
    % RK4 method
    % h amount of intervals
    t=tinit;         % initial t
    y=yinit;         % initial y
    t_eval=tend;     % at what point we have to evaluate
    n=(t_eval-t)/h; % Number of steps
    t_rk(1)=t;
    y_rk(1)=y;
    for i=1:n
    %RK4 Steps
       k1=h*double(f(t,y));
       k2=h*double(f((t+h/2),(y+k1/2)));
       k3=h*double(f((t+h/2),(y+k2/2)));
       k4=h*double(f((t+h),(y+k3)));
       dy=(1/6)*(k1+2*k2+2*k3+k4);
       t=t+h;
       y=y+dy;
       t_rk(i+1)=t;
       y_rk(i+1)=y;
    end
end
%%%%%%%%%%%%%%%%%%%%%% End of Code %%%%%%%%%%%%%%%%%%%%%%%


Related Solutions

Find the solution of the initial-value problem. y'' + y = 3 + 5 sin(x), y(0)...
Find the solution of the initial-value problem. y'' + y = 3 + 5 sin(x), y(0) = 5, y'(0) = 8
Find the solution of the initial-value problem X′(t) = ( −8 −5 5 2 )X X0...
Find the solution of the initial-value problem X′(t) = ( −8 −5 5 2 )X X0 = ( 0 1)
find the stedy-periodic solution cap of the initial value problem x"+2x'+50x=6cos(4t),x(0)=0,x'(0)=0
find the stedy-periodic solution cap of the initial value problem x"+2x'+50x=6cos(4t),x(0)=0,x'(0)=0
Find the solution of the initial value problem y′′−2y′−3 y=15te2t, y(0)=2, y′(0)=0.
Find the solution of the initial value problem y′′−2y′−3 y=15te2t, y(0)=2, y′(0)=0.
The solution to the Initial value problem x′′+2x′+17x=2cos(6t),x(0)=0,x′(0)=0 is the sum of the steady periodic solution...
The solution to the Initial value problem x′′+2x′+17x=2cos(6t),x(0)=0,x′(0)=0 is the sum of the steady periodic solution xsp and the transient solution xtr. Find both xsp and xtr.
Solve the given initial-value problem. X' = 2    4 −1 6 X, X(0) = −1 8...
Solve the given initial-value problem. X' = 2    4 −1 6 X, X(0) = −1 8 X(t) =
Find the solution of the given initial value problem. 2y''+y'-4y=0 ; y(0)=0 y'(0)=1
Find the solution of the given initial value problem. 2y''+y'-4y=0 ; y(0)=0 y'(0)=1
A) Solve the initial value problem: 8x−4y√(x^2+1) * dy/dx=0 y(0)=−8 y(x)= B)  Find the function y=y(x) (for...
A) Solve the initial value problem: 8x−4y√(x^2+1) * dy/dx=0 y(0)=−8 y(x)= B)  Find the function y=y(x) (for x>0 ) which satisfies the separable differential equation dy/dx=(10+16x)/xy^2 ; x>0 with the initial condition y(1)=2 y= C) Find the solution to the differential equation dy/dt=0.2(y−150) if y=30 when t=0 y=
Consider the initial value problem: y0 = 3 + x−y, y(0) = 1 (a) Solve it...
Consider the initial value problem: y0 = 3 + x−y, y(0) = 1 (a) Solve it analytically. (b) Solve it using Euler’s method using step size h = 0.1 and find an approximation to true solution at x = 0.3. (c) What is the error in the Euler’s method at x = 0.3
find the solution of the given initial value problem. y′′−2y′−3y=3te^2t y(0)=1 y′(0)=0
find the solution of the given initial value problem. y′′−2y′−3y=3te^2t y(0)=1 y′(0)=0
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT