Do you mean ? When you perform the integration, there are no x's left.
I posted this problem in a different form a year ago! I have encountered it again and would value any suggestions on what approach i should take or what i should read into
This is a part of my equation. i need to evaluate this
where N and S are constants
my problem is that while i can use numerical integration, if the value of N is very large, then i cannot evaluate the exponent (computers can not have integers greater than 1x10^301)
so i want to take the log of that function. That would be trivial without the integral, but i am not sure how to do it with the integral.
How do i take logs? Thanks for ANY help
Chogo
Well, if you were to look at the indefinite integral, you could differentiate it and then take the log of both sides. You'd get
However, you're ultimately interested in the function f. It's possible to differentiate this equation to obtain the following:
You could then solve this differential equation numerically with the proper initial conditions. Doing this might be more numerically stable than your integration.
I have no idea if this will work. It's just an idea.
I suppose it's related to logarithmic differentiation. I'm not sure this particular method has a name, though. Let me know how it works out for you.
[EDIT]: The integration bounds went away, because in order to take derivatives, I had to have an indefinite integral. You can probably recover the limits by choosing an appropriate initial condition, and probably stopping your numerical solution of the DE at the appropriate location.
Firstly thanks for your help, I will be sure to acknowledge you fully in the publication. I spoke to a colleague and we tried to use your approach. Let me reformulate the question for you in full
this is the function
I need to evaluate this integral (before i gave you just the top part for simplicity, but this is the whole function). The problem is the SAME as before, i need to take logs as i cant evaluate the exponent
so Let me rewrite this as
now using your approach of logarithmic differentiation
Now the key part. I have tried something different (let me know what you think) Consider the numerator
and therefore
if i can find f and f' (which i have done - its long but not hard)
and
so now by integrating f/f' i can say
and so
now i am stuck. I have greatly simplified the expression, but i dont know what do do next. Anyone have any ideas? I still have the exponent
I wanted to go with your changing the integral to a differential equation route but with the full equation i was unable to do it.
This is a lot to read, and i am asking for alot of help. So I will understand if you dont reply or have the time for this. Also apologies for my shoddy mathematics.
Hmm. Unfortunately, you've used several steps that are not permissible mathematically. The goal is to find , which is not a function of x, since x is the variable of integration. It is a function of m and n, however.
We take each integral separately. We examine the first one, and strip away the limits of integration to examine the indefinite integral:
We should note that the goal, then, of this problem is to evaluate
This assumes that the function f is continuous.
Taking the derivative of both sides yields
We take the logarithm of both sides to yield
Finally, we take one more derivative to yield
Solving this numerically shouldn't be difficult in principle. The actual difficulty is in getting initial conditions. You can get the values easily enough from the equation above. But the values are precisely what we are trying to find!
Here is what I recommend: a modified "shooting" algorithm. Normally, when solving a second-order ODE, you need initial conditions on and You have the second, but not the first. However, you do know where you want your algorithm to end up. You can easily evaluate and So, what you do is you take the lower limit of the upper integral, n, as your starting point. You get your for one initial condition. You guess through a whole range of initial values for Whichever one of those values gets you to m with the derivative being was the correct initial condition for and is, incidentally, the value of . Using that numerical solution, you can evaluate to find . Repeat for the to case. You see how this works?
I think this algorithm might just work for you.
One more comment: I would double-check your exponents. They seem to have changed from the original post.
Just as a warning: the 0 to 1 case might give you some convergence trouble. On the other hand, perhaps the original integral there isn't so unstable? If I look at
because the values of x and 1-x are between 0 and 1, I think your exponentiations are going to be smaller.
What are the nominal sizes for n, m, N, and S? What interval of values do they range over?
Hey Ackbeet
I was just trying to progam this up now. Is there a more conventional way of writing the second order DE, ive never seen one in this form and am trying to use the ODE45 solver in MATLAB
0 and 1 will definitely give convergence trouble. The integral is undefined for limit if as the term which is undefined
But I am modelling a biological system and so i can limits 0.001 and 0.999 instead of 0 and 1. This should help i think
these are the interval ranges
N - 5-10,000
s=0.7-2.4
n,m are bin sizes for the integral typically 0.01 or 0.001 with the range {0.001, 0.999} - the same as above
Thanks Again
Samir Bhatt
You can write the DE as
or
The latter is very conventional.
I would concur with your approach to handling 0 and 1. Just go a little inside those boundaries, and hopefully you'll be ok.
Incidentally, I gave the following integral to Mathematica, increased the recursion depth to 15, and got the following result with no complaints:
with the Mathematica command:
NIntegrate[(1 - x)^(10000 - 1)*x^(10000 - 1)*Exp[10000*2.4*x], {x, 0, 1},
MaxRecursion -> 15],
yielded
If that's the worst-case scenario, then maybe you just need to switch over to Mathematica!
I should also mention that Mathematica could easily compute
considerably larger than the limit you mentioned.
I'm running Mathematica Version 4 on Windows XP Professional, in case you want to know.