0
$\begingroup$

I am trying to solve for h1 and h2 using function solve as in below code, Expression in solve has two equation each equates sum of two expression. Both left hand and right hand side of second expression is the sum of eight quantities. h1 is used for first $4$ and h2 is used for next $4$ for second expression in both left and right hand side. Fist expression in solve is also very similar to second except that it is sum of four quantities and uses just h1.

I am getting correct value of h1 if I just solve fist equation. However when I am using two expression I am getting error:

Solve[
Sum[50/10000*1/4*1/4*n*97/100*Exp[-h1*1/4*n], {n, 1, 4}] == 
Sum[1/2*1/4*n*97/100*(Exp[-h1*1/4*(n - 1)] - Exp[-h1*1/4*n]), {n, 
1, 4}]  &&   
Sum[77/10000*1/4*1/4*n*97/100*Exp[-h1*1/4*n], {n, 1, 4}] + 
Sum[77/10000*1/4*1/4*n*94/100*Exp[-h2*1/4*n], {n, 5, 8}] == 
Sum[1/2*1/4*n*97/100*(Exp[-h1*1/4*(n - 1)] - Exp[-h1*1/4*n]), {n, 1, 4}] 
Sum[1/2*1/4*n*94/100*(Exp[-h2*1/4*(n - 1)] - Exp[-h2*1/4*n]), {n, 5,8}],   
{h1, h2}, Reals]

The output of Solve is

{{h1 -> 0.00998752, h2 -> 0.00998752}}

The error message observed is :

"The front end encountered an error while processing a "NotebookPredictions" packet".

Can anybody pl help in understanding error and help solving h1 and h2 Please?

$\endgroup$
1
  • $\begingroup$ With Mathematica 10.1, I receive no error messages, but I also receive an empty list for an answer. By the way, please edit your question to remove the single quotes from the beginning and end of your code. $\endgroup$
    – bbgodfrey
    Commented Jun 12, 2015 at 23:51

2 Answers 2

1
$\begingroup$

You wrote:

Both left hand and right hand side of second expression is the sum of eight quantities

So I guessed your Mathematica expression is wrong. You forgot a Plus sign here

Mathematica graphics

So, after correcting:

Solve[.... == ... .. && ... + ... == ... + ...] // N

{{h1 -> 0.00998752, h2 -> 0.017552}, {h1 -> 0.00998752, h2 -> 5.94171}}

The aimless debugger strikes again.

$\endgroup$
1
$\begingroup$

As I noted in a comment, there are no Reals solutions to your equations. There are, however, 17 Complex solutions, obtained by deleting Reals from Solve. One such solution is,

{h1 -> ConditionalExpression[-4 (2 I π C[1] - Log[401/400]), C[1] ∈ Integers], 
 h2 -> ConditionalExpression[-4 (2 I π C[2] + Log[Root[958425069093800 -
          365632940319875 #1^4 + 394755132106120 #1^5 + 488331476140139 #1^6 + 
          581907820174158 #1^7 + 1333623456783952 #1^8 &, 1]]), C[2] ∈ Integers]}

The list of solutions, designated for convenience as s, can be simplified by

N[Simplify[s, C[1] ∈ Integers && C[2] ∈ Integers]] // Expand

yielding

{{h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0260711 + 11.2987 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0260711 - 11.2987 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0694075 + 7.68613 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0694075 - 7.68613 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0484291 + 5.20504 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.0484291 - 5.20504 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.516819 + 1.70172 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> 0.00998752 - (0. + 25.1327 I) C[1], 
  h2 -> (0.516819 - 1.70172 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (2.00463 - 12.5664 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.631895 - 12.5664 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (2.00463 - 12.5664 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 - 6.33258 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (2.00463 - 12.5664 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 + 6.33258 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 - 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.631895 - 12.5664 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 - 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 - 6.33258 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 - 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 + 6.33258 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 + 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.631895 - 12.5664 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 + 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 - 6.33258 I) - (0. + 25.1327 I) C[2]}, 
 {h1 -> (1.77028 + 6.73299 I) - (0. + 25.1327 I) C[1], 
  h2 -> (0.62406 + 6.33258 I) - (0. + 25.1327 I) C[2]}}

Since C[1] and C[2] are integers, none of the h2 are real, as predicted.

With respect to the error you observed, I suggest you restart Mathematica, which often eliminates unusual errors.

$\endgroup$
4
  • $\begingroup$ @belisarius. I am struggling a bit to interpret the result. Can you guys help me to understand. I am using excel goal to get value of h1 and h2 and comparing it with mathematica result. I understand excel goal seek gives real values only. I am applying goal seek on 1st expression to get value of h1 which is 0.03959. I am applying goal seek on 2nd expression and using value of h1 (i.e. 0.03959) to get value of h2. I get h2 to be 0.05631. How come I get so different values from excel goal seek and Mathematica solve please? $\endgroup$
    – Kausik
    Commented Jun 13, 2015 at 11:18
  • $\begingroup$ sorry h1 is 0.01148 and h2 is 0.01451. I a not that worried about but h2 is far off with two different values from mathematica. $\endgroup$
    – Kausik
    Commented Jun 13, 2015 at 11:49
  • $\begingroup$ The solution by @Belisarius to your corrected equations is correct, suggesting that you have a problem with Excel, which is beyond the scope of this site. By the way, your equations can be converted to polynomials by the substitution {h1 -> -4 Log[x1], h2 -> -4 Log[x2]}. $\endgroup$
    – bbgodfrey
    Commented Jun 13, 2015 at 13:48
  • $\begingroup$ Thanks. I am just wondering if Solve is right function to use or I use Minimze function as I am trying to minimize difference between two equation using goal seek in excel. these two equation being nonlinear solve is giving few alternative solutions. I need to extend to h3,h4 and h5. Probably then its impossible to for Solve function find a reasonable solution however excel goal seek keeps minimizing it nicely $\endgroup$
    – Kausik
    Commented Jun 13, 2015 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.