MathGroup Archive 2009

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

Search the Archive

Re: Problem on solving nonlinear system

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96069] Re: Problem on solving nonlinear system
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Wed, 4 Feb 2009 05:19:18 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <gm99ut$8o$1@smc.vnet.net>

In article <gm99ut$8o$1 at smc.vnet.net>,
 "tarpanelli at libero.it" <tarpanelli at libero.it> wrote:

> I am trying to solve the following nonlinear system but I am not getting a 
> good solution (I am using the function Solve)
> 
> f1[a_,S_,q_,r_,t_,n_]:=Sum[a_i * S_i * Exp[(r-q_i)*t],{i,1,n}]
> f2[a_,S_,q_,r_,s_,rho_,t_,n_]:=Sum[a_i*a_j*S_i*S_j*Exp[(2r-q_i-
> q_j+rho_ij*s_i*S_j)*t],{i,1,n},{j,1,n}]
> 
> g1[a_,S_,d_,sigma_,t_]:=Sum[a_i*S_i,{i,1,n}]*Exp[(r-d-(sigma^2/2))*t]
> g2[a_,S_,d_,sigma_,t_]:=(Sum[a_i*S_i,{i,1,n}])^2 * Exp[(2r-2d+(sigma^2))*t]
> 
> I would like to solve the nonlinear system
> f1==g1
> f2==g2
> 
> for d and sigma

You should post correct Mathematica code (i.e. syntacticly correct) and 
also comment on the not good solution, that would help people helping 
you. Here is my attempt to mimic what you might have done:

In[1]:= f1[a_, S_, q_, r_, t_, n_] := 
 Sum[a[i]*S[i]*Exp[(r - q[i])*t], {i, 1, n}]
f2[a_, S_, q_, r_, s_, rho_, t_, n_] := 
 Sum[a[i]*a[j]*S[i]*S[j]*
   Exp[(2 r - q[i] - q[j] + rho[i, j]*s[i]*S[j])*t], {i, 1, n}, {j, 1,
    n}]

g1[a_, S_, d_, sigma_, t_] := 
 Sum[a[i]*S[i], {i, 1, n}]*Exp[(r - d - (sigma^2/2))*t]
g2[a_, S_, d_, sigma_, t_] := (Sum[a[i]*S[i], {i, 1, n}])^2*
  Exp[(2 r - 2 d + (sigma^2))*t]

In[5]:= Solve[{f1[a, S, q, r, t, n] == g1[a, S, d, sigma, t], 
  f2[a, S, q, r, s, rho, t, n] == g2[a, S, d, sigma, t]}, {d, sigma}]

During evaluation of In[5]:= Solve::ifun: Inverse functions are being \
used by Solve, so some solutions may not be found; use Reduce for \
complete solution information. >>

Out[5]= 
                               t (r - q[i])
        1                 Sum[E             a[i] S[i], {i, 1, n}]
{{d -> --- (4 r t - 2 Log[---------------------------------------] - 
       4 t                       Sum[a[i] S[i], {i, 1, n}]
 
                t (2 r - q[i] - q[j] + rho[i, j] s[i] S[j])
       Log[Sum[E                                            a[i] a[j] 
 
                                                                       2
           S[i] S[j], {i, 1, n}, {j, 1, n}] / Sum[a[i] S[i], {i, 1, n}] ]
 
       ), sigma -> 
 
             1
    -(--------------- Sqrt[-2 
      Sqrt[2] Sqrt[t]
 
                   t (r - q[i])
              Sum[E             a[i] S[i], {i, 1, n}]
          Log[---------------------------------------] + 
                     Sum[a[i] S[i], {i, 1, n}]
 
                  t (2 r - q[i] - q[j] + rho[i, j] s[i] S[j])
         Log[Sum[E                                            a[i] a[j] 
 
             S[i] S[j], {i, 1, n}, {j, 1, n}] / 
 
                                    2
           Sum[a[i] S[i], {i, 1, n}] ]])}, 
 
                                t (r - q[i])
         1                 Sum[E             a[i] S[i], {i, 1, n}]
  {d -> --- (4 r t - 2 Log[---------------------------------------] - 
        4 t                       Sum[a[i] S[i], {i, 1, n}]
 
                t (2 r - q[i] - q[j] + rho[i, j] s[i] S[j])
       Log[Sum[E                                            a[i] a[j] 
 
                                                                       2
           S[i] S[j], {i, 1, n}, {j, 1, n}] / Sum[a[i] S[i], {i, 1, n}] ]
 
       ), sigma -> 
 
           1
    --------------- Sqrt[-2 Log[
    Sqrt[2] Sqrt[t]
 
               t (r - q[i])
          Sum[E             a[i] S[i], {i, 1, n}]
          ---------------------------------------] + 
                 Sum[a[i] S[i], {i, 1, n}]
 
                t (2 r - q[i] - q[j] + rho[i, j] s[i] S[j])
       Log[Sum[E                                            a[i] a[j] 
 
                                                                       2
           S[i] S[j], {i, 1, n}, {j, 1, n}] / Sum[a[i] S[i], {i, 1, n}] ]
 
       ]}}

Regards,
--Jean-Marc


  • Prev by Date: Re: Re: Re: Simplifying and Rearranging Expressions
  • Next by Date: Re: Re: MCMC in Mathematica
  • Previous by thread: Problem on solving nonlinear system
  • Next by thread: Log[x]//TraditionalForm