Re: Problem using Solve or Nsolve
- To: mathgroup at smc.vnet.net
- Subject: [mg124754] Re: Problem using Solve or Nsolve
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sat, 4 Feb 2012 06:29:33 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201202030710.CAA12005@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
This may be more efficient:
Clear[a, f, g]
f[x_] = (4^x)*E^-4/Gamma[x + 1];
g = g /. First@NDSolve[{g'[x] == f[x], g[0] == 0}, g, {x, 0, 5}];
a = a /. FindRoot[g[a] == 0.5, {a, 2}]
{g@a, NIntegrate[f@x, {x, 0, a}]}
3.86298
{0.5, 0.5}
You can solve for other values without using NDSolve again:
FindRoot[g[x] == 0.3, {x, 2}]
{x -> 2.85784}
Bobby
On Fri, 03 Feb 2012 01:10:12 -0600, droopy <tototo at yopmail.com> wrote:
> Dear all,
>
> I am a new user of mathematica and i am trying to find the upper limit
> of an integrate such as it is equal to a certain value.
>
> Therefore, for the moment i did :
> f = (4^x)*E^-4/Gamma[x + 1]; Reduce[{Integrate[f, {x, 0, A}] == 0.5},
> {A}]
>
> But it doesn't work, I did the same thing with Solve :
> Solve[Integrate[f, {x, 0, A}] == 0.5, A]
> but it doesn't work.
>
> The only way that i found to obtain a solution was with
> FindRoot[Integrate[f, {x, 0, A}] == 0.5, {A, 2}]
>
> Do you have a solution?
>
> Thanks !
>
--
DrMajorBob at yahoo.com
- References:
- Problem using Solve or Nsolve
- From: droopy <tototo@yopmail.com>
- Problem using Solve or Nsolve