       Re: Simple Eval Question

• To: mathgroup at smc.vnet.net
• Subject: [mg31901] Re: [mg31883] Simple Eval Question
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Mon, 10 Dec 2001 06:14:45 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```In:=
<<Statistics`ContinuousDistributions`

In:=
W=1; g=0.5; q=0.1; V=2;

In:=
fd[x_]:= PDF[ LogNormalDistribution[0,1],x ] ;

In:=
FindRoot[
Evaluate[Integrate[ ((W +(x-p)*q)^g)/g * fd[x], { x, 0,
Infinity } ]==
V], {p ,1}]//Timing

Out=
{30.93 Second,{p->1.56521}}

Somewhat surprisingly you can get the right answer also using NIntegrate
and much faster although with some error messages:

In:=
FindRoot[
Evaluate[NIntegrate[ ((W +(x-p)*q)^g)/g * fd[x], { x, 0,
Infinity } ]==
V], {p ,1}]//Timing

Out=
{0.45 Second,{p->1.56521}}

Andrzej Kozlowski
Toyama International University
JAPAN
http://platon.c.u-tokyo.ac.jp/andrzej/

On Sunday, December 9, 2001, at 08:07  PM, ivo welch wrote:

> I have a simple problem.  I want to numerically solve
>
>    Solve[  Integrate[ f[x,p]*g[x], {x,0,Infinity}] == V , p ]
>
> where f[] and g[] are defined functions, but the naive solution fails.
>
> W=1; g=0.5; q=0.1; V=2;
> fd[x_]:= PDF[ LogNormalDistribution[0,1],x ] ;
> Solve[ Integrate[ ((W +(x-p)*q)^g)/g * fd[x], { x, 0, Infinity } ]== V,
> p ]
>
> Solve::"tdep": "The equations appear to involve the variables to be
> solved \
> for in an essentially non-algebraic way."
>
> The correct answer seems to be 1.5652 .  How do I ask Mathematica to
> tell me
> this number?
>
> (My ultimate goal is to plot the solved p as a function of q.)
>
> /iaw
>
>
>

```

• Prev by Date: Re: Simple questions about Mathematica
• Next by Date: Re: Simple Eval Question
• Previous by thread: Re: Simple Eval Question
• Next by thread: Re: Simple Eval Question