Problems when solving equations that contain improper integral
- To: mathgroup at smc.vnet.net
- Subject: [mg103609] Problems when solving equations that contain improper integral
- From: Béla Személy <bszemely at gmail.com>
- Date: Wed, 30 Sep 2009 04:59:59 -0400 (EDT)
I'm trying to differentiate and solve a system of equations, where some equations contain improper integrals. Specifically I have two variables {c,ap} that are functions of {a,s,\[Chi]} and I'm trying to compute and solve for the first order derivatives of these variables with respect to {a,s,\[Chi]}. While running this code I encountered several problems. First, it takes an unusually long time for Mathematica to load the functions {f1,f2,f3}, in this case on my computer it takes 143.64 seconds. In other situations even with larger systems of equations it takes only a couple of seconds to do so. Second, once it finishes calculating the derivatives and substituting in the parameter values, Mathematica doesn't solve the resulting system of equations. The system of equations in T is correct so I'm not sure why it doesn't work. I also tried NSolve but that doesn't help either. I attached the code below, I would appreciate any comments or suggestions about how to solve this problem. Thanks, B=E9la ssfunrule = Flatten[{gp1[__] -> cs, gp2[__] -> as, gp3[__] -> \[CurlyPhi]s}]; varrule = {a -> as, s -> 0, \[Chi] -> 0}; derivrule = d : Derivative[__][_][__] :> d[[0]]; allrule = Flatten[{derivrule, varrule, ssfunrule}]; t1 = AbsoluteTime[]; sp = \[Rho]*s + \[Chi]*\[Sigma]*ep; c = gp1[a, s, \[Chi]]; cp = gp1[ap, sp, \[Chi]]; ap = gp2[a, s, \[Chi]]; \[CurlyPhi] = gp3[a, s, \[Chi]]; cons = Exp[sp]*w + (1 + r)*ap; f1 = c^-\[Gamma]*(1 - \[Mu]) -\[Beta]*(1 + r)* Integrate[(cons)^-\[Gamma]* Exp[-(ep^2/2)]/Sqrt[2 \[Pi]], {ep, -\[Infinity], \[CurlyPhi]}] - \ \[Beta]*(1 + r)*Integrate[cp^-\[Gamma]*Exp[-(ep^2/2)]/Sqrt[2 \[Pi]], {ep, \[CurlyPhi], \[Infinity]}]; f2 = c + ap - Exp[s]*w - (1 + r)*a; f3 = cp - Exp[sp]*w - (1 + r)*ap /. {ep -> \[CurlyPhi]}; F = {f1, f2, f3}; AbsoluteTime[] - t1 parmrule = {w -> 2.3412, \[Beta] -> 0.96, \[Gamma] -> 3, \[Sigma] -> 0.6, \[Rho] -> 0.5, r -> 0.02}; cs = w; as = 0; \[CurlyPhi]s = 0; \[Mu] = 1 - \[Beta] (1 + r); t1 = AbsoluteTime[]; FirstOrder = Flatten[D[F, {{a, s, \[Chi]}}]]; T = FirstOrder/. allrule /. parmrule /. {ep -> 0}; sol1 = Solve[Thread[ExpandAll[T] == 0]]; Sort[sol1] // MatrixForm AbsoluteTime[] - t1