MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simple Eval Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31889] Re: [mg31883] Simple Eval Question
  • From: BobHanlon at aol.com
  • Date: Mon, 10 Dec 2001 06:14:27 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 12/9/01 6:50:44 AM, ivo.welch at anderson.ucla.edu writes:

>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.)
>

Solve is primarily for polynomials;  use FindRoot.

Needs["Graphics`Colors`"];
Needs["Statistics`ContinuousDistributions`"];

Clear[fd, pe, q];

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

W=1; g=0.5; V=2;

pe[q_] := (p /. 
        FindRoot[Integrate[((W+(x-p)*q)^g)/g*fd[x],
              {x, 0, Infinity}] == V, 
          {p, 1.64-0.901q+1.11q^2}]);

The starting value expression (quadratic estimate of p as a function of q) is 
developed below.

pe[0.1]

1.56521

data = Table[{q, pe[q]}, {q, 0.02, 0.2, 0.02}];

quadEst[q_] := Evaluate[Fit[data,{1,q,q^2},q]];

Plot[quadEst[q], {q, 0.02, 0.2}, 
     PlotStyle -> Blue,
    Epilog -> {Red, AbsolutePointSize[4], Point /@ data}];


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: Simple Eval Question
  • Next by Date: Re: Re: scope all wrong? in Mathematica 4.1
  • Previous by thread: Re: Simple Eval Question
  • Next by thread: Re: Simple Eval Question