# Thread: Integral Equations volterra type 2 using the trapezoid method

1. ## Integral Equations volterra type 2 using the trapezoid method

Hi there, I am trying to find out how to make an approximation to a linear integral equation using the trapezoid method. I need to find something for
y(n+1). I found something on the internet when searching but wasn't sure of whether it was correct or not. It was stating:

y(tn)=g(tn)+h{0.5*K(tn,t0,y(t0))+SUM[j=1 to n-1]K(tn,tj,y(tj))+0.5*K(tn,tn,y(tn)).

sorry if this isn't clear, I am unsure of how to type in maths equations on here.

Could you please either clarify that this is correct or let me know what the correct equation is?

Thanks alot, Chris

2. ## Trapezoid method

SONNYX

First we have to know what does the program need to do.
Let's see guys.

The integral of function y = f(x) on the interval from a to b is a square of the area limited by this function, X-axis and two vertical lines
x = a and x = b.

Computer can evaluate integrals approximately. One of the most frequently used methods is the trapeze method. The interval [a; b] is separated into N equal subintervals.

That's why we should use Mat Lab.
At the begining

function f
f = input('Typing f(x):','s');
a=input('Typing Less a: ');
x=a
f_a=eval(f)
b=input('Typing Up b: ');
x=b
f_b=eval(f)
n=input('Typing Number n ');
h=(b-a)/n
starting=a+h

Now,

You can evaluate integrals of any functions using Tavrida Calculator. You simply enter a function (for example, x^2 - x + 1) in one of the cells, select the Integrate cell option, enter the limits of integration (for example, a = -10, b = 10), the number of intervals (for example, N = 10) and get the result (S = 700 in this case).

for i=1:n-1
x=starting;
xi=eval(f)
next_X=starting+h;
starting=next_X
end
x=linspace(a,b);
z=eval(f);
plot(x,z)

For the error is very simple.

fprintf ('Here is the ERROR')
f = input('Typing f(x) again:','s');
div = diff(f,2)
integral_method=int(f,a,b)
new_f=int((div)/(b-a),a,b)
error=((-new_f)/12)*(b-a)^3

This is not a method that we typically use in practice. Its usefulness is to introduce the subject and provide a general framework for this area of numerical methods.
Using the Euler-Maclaurin formula, the integral of f(x) dx on the interval a to be can be expressed as (note that the concept of expansions is a common technique in mathematics)
where B2n are Bernoulli numbers.
We observe that, if the interval of integration is small enough, the series in the second term above would yield a contribution that is negligible compared to the first term. This is a standard technique in deriving relationships in numerical methods.
As a result the integral of f(x)dx on the interval a to b is approximately equal to the following if b - a is sufficiently small
Note that the above expression is the area of a trapezoid where b - a is the base and f(a) and f(b) are the lengths of the two vertical parallel sides.
Next, recall the additive formula between integrals