-
Notifications
You must be signed in to change notification settings - Fork 2
ODEnotes
We show three different problems (case 1, 2 and 3 below) that can be solved analytically and then how to solve them using Runge Kutta and finite element method. This shows that some things are easy in FEM and difficult using Runge-Kutta.
Let's say I want to solve this equation on the interval <math>(0, \pi)</math>:
- <math>\frac{d^2}{d x^2} f(x) + f(x) = 0</math>
This has the general solution
- <math>f(x) = A sin(x) + B cos(x)</math>
- <math>f(0) = 0</math>
- <math>f'(0) = 1</math>
- <math>f(0) = f(\pi) = 0</math>
- <math>f(0) = 0</math>
- <math>f'(\pi) = -1</math>
This initial (boundary) condition is used in the runge-kutta integrator and one then integrates the whole equation on the interval <math>(0, \pi)</math>, the result will be <math>f(x)=sin(x)</math>.
I don't know any way how to solve such a problem using runge-kutta. I would just try all possible values for <math>f'(0)</math> and iteratively try to satisfy the second condition at the other end of the interval.
I don't know any way how to solve such a problem using runge-kutta. I would just try all possible values for <math>f'(0)</math> and iteratively try to satisfy the second condition at the other end of the interval.
One substitutes
- <math>f(x)=g(x)+x</math>
- <math>g(x)+g(x)=-x</math>
One needs to first rewrite the equation to the weak formulation
- <math>\int_0^\pi -f'(x)v'(x)dx + \int_0^\pi f(x)v(x) dx = - [f'(x)]^\pi_0</math>
- <math>\int_0^\pi -f'(x)v'(x)dx + \int_0^\pi f(x)v(x) dx = - f'(\pi) v(\pi) + f'(0)v(0)</math>
- <math>\int_0^\pi -f'(x)v'(x)dx + \int_0^\pi f(x)v(x) dx = 0</math>
- <math>Ax=0</math>
Weak formulation:
- <math>\int_0^\pi -f'(x)v'(x)dx + \int_0^\pi f(x)v(x) dx = v(\pi) + f'(0)v(0)</math>
- <math>\int_0^\pi -f'(x)v'(x)dx + \int_0^\pi f(x)v(x) dx = v(\pi)</math>
- <math>Ax=b</math>