Re: Simple Eval Question
- To: mathgroup at smc.vnet.net
- Subject: [mg31893] Re: Simple Eval Question
- From: bghiggins at ucdavis.edu (Brian Higgins)
- Date: Mon, 10 Dec 2001 06:14:33 -0500 (EST)
- References: <9uvh6m$ibg$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Ivo, You can use FindRoot: << Statistics`ContinuousDistributions` W = 1; g = 0.5; V = 2; q = 0.1; fd[x_] := PDF[ LogNormalDistribution[0, 1], x ] ; FindRoot[NIntegrate[ ((W + (x - p)*q)^g)/g * fd[x], { x, 0, Infinity } ] == V, {p, 1, 2}] {p -> 1.56521} If you need to plot the solution as a function of q here is one way: myfunc[s_] := p /. FindRoot[ NIntegrate[ ((W + (x - p)*s)^g)/g * fd[x], { x, 0, Infinity } ] == V, {p, 1, 2}] Plot[myfunc[s], {s, 0.1, .3}] Cheers, Brian ivo.welch at anderson.ucla.edu (ivo welch) wrote in message news:<9uvh6m$ibg$1 at smc.vnet.net>... > 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