Re: solving a system of equations involving numerical integration
- To: mathgroup at smc.vnet.net
- Subject: [mg42586] Re: [mg42565] solving a system of equations involving numerical integration
- From: Selwyn Hollis <selwynh at earthlink.net>
- Date: Thu, 17 Jul 2003 03:45:05 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Aside from a missing ? and a bunch of extra brackets, the main problem is that FindRoot needs a pair of initial guesses for each variable, because symbolic derivatives for f and g can't be had. The following runs, but doesn't finish after a long time. Perhaps better initial guesses would help. q[t_, x_, y_] := E^((-(1/2))*(Log[x] - Log[a] - t)^2 - (1/2)*(Log[y] - Log[b] - 0.02)^2)/(2*Pi*(100 + 5*x + 5*y)^0.5); f[(a_)?NumericQ, (b_)?NumericQ] /; a != 0 || b != 0 := NIntegrate[q[0.08,x,y]/y, {x, 0.001, Infinity}, {y, 0.001, Infinity}]; g[(a_)?NumericQ, (b_)?NumericQ] /; a != 0 || b != 0 := NIntegrate[q[0.03,x,y]/x, {x, 0.001, Infinity}, {y, 0.001, Infinity}]; FindRoot[{a == 0.95*f[a, b]*(100 + 5*a + 5*b)^0.5, b == 0.95*g[a, b]*(100 + 5*a + 5*b)^0.5}, {a, 1, 10}, {b, 1, 10}] ----- Selwyn Hollis http://www.math.armstrong.edu/faculty/hollis On Wednesday, July 16, 2003, at 09:13 AM, Vladimira A Ilieva wrote: > Could someone help me with the following code? I am trying to solve a > system of two equations in two unknowns which involve evaluation of > numerical integrals. > > Clear[f]; > Clear[g]; > Clear[a]; > Clear[b]; > > f[a_?NumericQ, b_?NumericQ] /; a != 0 || b != 0 := NIntegrate[1/(100 + > 5*x + 5*y)^0.5*((1/(2*[Pi]* y))*((E^((-((Log[x] - Log[a] - 0.08)^2/2)) > - > ((Log[y] - Log[b] - 0.02)^2/2)))), {x,0.001, [Infinity]}, {y, 0.001, > [Infinity]}]; > > g[a_?NumericQ, b_NumericQ] /; a != 0 || b != 0 := NIntegrate[1/(100 + > 5*x > + 5*y)^0.5*((1/(2*[Pi]*x))*((E^((-((Log[x] - Log[a] - 0.03)^2/2)) - > ((Log[y] - Log[b] -0.02)^2/2)))), {x, 0.001, [Infinity]}, {y, 0.001, > [Infinity]}]; > > > FindRoot[{a == 0.95*f[a, b]*(100 + 5*a + 5*b)^0.5 , b == 0.95*g[a, > b]*(100 > + 5*a + 5*b)^0.5},{a, 1},{b, 1}] > > > > Unfortunately, I get the following error message > > FindRoot::"nlnum"), "The function value (-0.5686685479617104`, - > 9.9636840576164 > 38`) is not a list of numbers with dimensions {2} at {a, b} = {1.`, > 1.`}General > ::nlnum > > I would greatly appreciate any help! > > Sincerely, Vladimira > > >