|
From: | ake |
Subject: | Re: [Help-gsl] Can you do this in GSL? |
Date: | Tue, 18 Jan 2005 10:29:38 +0100 |
At 08:13 PM 1/17/2005, Kenneth Geisshirt wrote:
I wrote the integral wrong. Sorry! The correct function is: 0.067*b^3 = \int_0^b x^2/(exp(x)+1) dx
Assume that F(b) = \int_0^b x^2/(exp(x)+1) dx. Your equation is then 0.067*b^3 = F(b) - F(0) = F(b). Now differentiate wrt b, and you have 0.2*b^2 = F'(b) = f(b).
Since this is an equation it does not hold for every b and consequently you cannot differentiate both sides and retain equality. Example: b^2 = 1 has two possible solutions, b = 1 and b = -1. If you incorrectly differentiate both sides wrt b you get 2*b = 0, thus b = 0.
You can calculate f(b) as a finite difference, f(b) = (F(b+h)-F(b-h))/2h. In general you can calculate F(b) using an integration function found in GSL. Last, your solve the equation G(b) = f(b)-0.2*b^2 = 0 using a nonlinear equation solver in GSL.
If, for some reason, you would like to find f(b) = F'(b) the fundamental theorem of calculus would tell you immediately that f(b) = b^2/(exp(b)+1). You could then solve f(b) = 0.2*b^2 by hand.
Regards,Åke
[Prev in Thread] | Current Thread | [Next in Thread] |