IVP computer code stuff

110 Views Asked by At

I need help with this following problem:

Write maple code to solve numerically the initial value problem

$\frac{dy}{dt} = g(t)=\int_{0}^{t}f(x) dx$ and $y(0)=0$.

a) Use numerical integration on $f$ to define $g$ and a numerical differential equation solver of your choice.

b) Find and graph numerical solutions for $f(x)=x$ and $f(x)=exp(-x^2)$ on $0\leq t\leq 10$.

c) Compare the solution for $f(x)=x$ with the exact solution $y(t)=\frac{t^3}{6}$

I don't really even know where to begin. .

1

There are 1 best solutions below

2
On

You have a differential equation, $y'(t) = g(t)$ with initial condition $y(0) = 0$. Use a numerical differential equation solver (pick any from Maple or implement your own), and plug in the function $g$, which is also numerically computed as $g(t) = \int_0^t f(x)dx$ (use numerical integration to compute the integral).

Once the code is done, plug in $f_1(x) = x$ and $f_2(x) = e^{-x^2}$ on $t \in [0,10]$ to generate $g_1, g_2$ via numerical integration and $y_1, y_2$ via numerical ODE solution.

Then solve the problem analytically ($g_1(t) = \int_0^t xdx = t^2/2$ so what is $y_1(t)$ - can you deduce it from the differential equation?) and compare the analytic solution to the numerical one you got.