help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: definite numerical integration


From: roberto
Subject: Re: definite numerical integration
Date: Wed, 21 Sep 2005 19:38:53 +0200

On 9/21/05, David Bateman <address@hidden> wrote:
> Then all you can do is something like
>
> x0 = ??;
> y0 =  f(x0);
> a = ??;
> b = ??;
>
> # x0 must be montonically increasing
> [x0, idx] = sort(x0);
> y(idx) = y0;
>
> # Treat core of the integral with simpson's rule
> Istart = find (x0 >= a)(1);
> Istop = find (x0 <= b)(end);
> Int = sum(0.5 * (y0((Istart+1):Istop) + y0(Istart:(Istop-1))) .*
> (x0((Istart+1):Istop) - x0(Istart:(Istop-1))));
>
> # Treat the tail
> if (x0(Istart) != a)
>   Int += 0.5 * (x0(Istart) - a) * (y0(Istart) + y0(Istart-1));
> endif
> if (x0(Istop) != b)
>   Int += 0.5 * (b - x0(Istop)) * (y0(Istop+1) + y0(Istop));
> endif
> D.
well thank you for contribution then;
i'll ask one more point: my function to be integrated has also a parameter "c";
now i want to solve the integral and then find out a value for this
parameter such that the value of the integral when the upper bound of
integration is e.g. "r_s" should be equal to a given value "t_s";
is it possible to solve definite integral of functions depending also
on a parameter to be fixed to satisfy a condition?

thank you very much again,
if the problem is known, please address me to some reference





--
roberto



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]