Re: Solving this in mathematica?
- To: mathgroup at smc.vnet.net
- Subject: [mg128077] Re: Solving this in mathematica?
- From: Dana DeLouis <dana01 at me.com>
- Date: Fri, 14 Sep 2012 00:22:15 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
> B[h_, r_] := Exp[(-alpha1[h]) (r) - psi[h]] > > Exp[Cbar - beta] Sum[(Pi^x) B[x, r], {x, 1, 1000}] Hi. I don't have a solution, but perhaps some random suggestions: > alpha1[n_] := alpha1[n] = alpha1[n - 1] + alpha2[n - 1] I might break the problem down by rewriting some functions as follows: For example: equ = { alpha1[n]==alpha1[n-1]+alpha2[n-1], alpha2[n]==k *alpha2[n-1], alpha1[0]==0, alpha2[0]==1}; RSolve[equ,{alpha1[n],alpha2[n]},n] { alpha1[n] -> (-1+k^n)/(-1+k), alpha2[n] -> k^n } I don't believe you gave a starting value for psi[0], so we're stuck at this point. Another observation: > Exp[Cbar - beta] Sum[(Pi^x) B[x, r], {x, 1, 1000}] If we just look at this: (B for the function B[x,r]) Sum[(Pi^x) B, {x, 1, 1000}] With a specific value for the upper limit (ie 1000), you are solving: (I'll use 10) Sum[Pi^x*B, {x, 1, 10}] B*Pi + B*Pi^2 + B*Pi^3 + B*Pi^4 + B*Pi^5 + B*Pi^6 + B*Pi^7 + B*Pi^8 + B*Pi^9 + B*Pi^10 Sometimes (but not always) it's better to give a symbolic upper limit, then go back and change it: Sum[B*Pi^x, {x, 1, ul}] /. ul -> 1000 (Pi*(Pi^1000 - 1)*B) / (Pi - 1) However, that equation numerically is: N[%] 2.071503628841560*10^ 497 B This is a very large number. I would assume your B[x,r] would have to be very small. Your variable inputs are all machine precision, so I wonder how accurate the solution would be. ?? Again, just some random thoughts. Good luck. = = = = = = = = = = HTH :>) Dana DeLouis Mac & Mathematica 8 = = = = = = = = = = On Wednesday, September 12, 2012 3:03:51 AM UTC-4, Leon wrote: > I have following code in mathematica: > > > > ------------------------------------------------------------ > > rbar = 0.006236 > > rt = r_bar > > k = 0.95 > > sigmar = 0.002 > > betazr = -0.00014 > > sigmaz = 0.4 > > pi = 0.99 > > chi = 0.05 > > Cbar = -3.7 > > > > alpha1[n_] := alpha1[n] = alpha1[n - 1] + alpha2[n - 1] > > alpha2[n_] := alpha2[n] = k (alpha2[n - 1]) > > sigma1sq[n_] := > > sigma1sq[n] = sigma2sq[n - 1] + 2 sigma12[n - 1] + sigmaz^2 > > sigma12[n_] := > > sigma12[n] = k (sigma12[n - 1]) + k (sigma2sq[n - 1]) + betazr > > sigma2sq[n_] := sigma2sq[n] = (k^2) (sigma2sq[n - 1]) + sigmar^2 > > phi1[n_] := phi1[n] = phi1[n - 1] + phi2[n - 1] + (0.5) (sigmaz^2) > > phi2[n_] := phi2[n] = k (phi2[n - 1]) + (1 - k) (rbar) > > psi[n_] := psi[n] = phi1[n] - (0.5) (sigma1sq[n]) > > > > alpha1[0] = 0 > > alpha2[0] = 1 > > sigma1sq[0] = 0 > > sigma12[0] = 0 > > sigma2sq[0] = 0 > > phi1[0] = 0 > > phi2[0] = 0 > > > > B[h_, r_] := Exp[(-alpha1[h]) (r) - psi[h]] > > Exp[Cbar - beta] Sum[(Pi^x) B[x, r], {x, 1, 1000}] > > > > ---------------------------------------------------------------------- > > > > and I am wondering if it is possible to solve the last line such that I have "r" as a function of "beta", satisfying > > > > Exp[Cbar - beta] Sum[(Pi^x) B[x, r], {x, 1, 1000}] = 1 > > > > Because ultimately, I would need to integrate a function J[r] over "beta", so if I don't have "r" as a function of "beta", I don't know how to do the integration of J[r]. > > > > Thank you!! L.