Message Boards Message Boards

Findroot error: not a list of numbers?

Posted 2 years ago

Hi, Thank you in advance for taking the time to look at my problem. I would be grateful if you could help me with the code. I'm trying to simulate the transitional values for my model after obtaining steady-state values (k = 871.829). However, this is the error msg I have been receiving all the time no matter what I try (within my limited knowledge):

FindRoot[capeq[1] == 0, {k[2], 871.8287954437363}]
FindRoot::nlnum: The function value {-1.013 d[2.]+<<9>>+<<1>>-(1.05 (<<15>>+    <<2>>))/(<<19>>+<<18>>)} is not a list of numbers with dimensions {1} at {k[2]} = {871.829}.

The capeq[1] equation as follows, since t = 1 to 30:

capeq[t_] = 
 a[1, t] + a[2, t - 1]/(1 + n) + a[3, t - 2]/(1 + n)^2 + 
  a[4, t - 3]/(1 + n)^3 + a[5, t - 4]/(1 + n)^4 + 
  a[6, t - 5]/(1 + n)^5 - 
  d[t + 1]*(1 + n) - (1 + n)*
   k[t + 1]*(l[1, t] + l[2, t - 1]/(1 + n) + l[3, t - 2]/(1 + n)^2 + 
     l[4, t - 3]/(1 + n)^3 + l[5, t - 4]/(1 + n)^4 + 
     l[6, t - 5]/(1 + n)^5)

I hope the above information is adequate for you to help me. Much appreciation for your time. Most humbly, Pema

POSTED BY: pemma dorji
2 Replies

FindRoot is for numerical equations. Your equation is symbolic, and you can use Solve:

Solve[capeq[1] == 0, k[2]]
POSTED BY: Gianluca Gorni

My sincere gratitude for taking the time to answer my question.

The actual equation is larger, however, since this error msg was consistently showing up, I wanted to see if I can obtain the value only for k[2] (I'm a novice Mathematica user, so I was trying various things). The actual equation I have is as follows (I reduced the t from 30 to 20):

FindRoot[tranequs, transols]

error msg (which I'm not able to understand what it is) as follows:

FindRoot::nlnum: The function value {5.38502*10^6,610256.,4243.84,<<6>>,8.86757*10^-12,<<47>>} is not a list of numbers with dimensions {57} at {k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],<<47>>} = {871.829,871.829,871.829,<<5>>,871.829,871.829,<<47>>}.

where tranequs and transols are as follows:

 tranequs = {capeq[1] == 0, capeq[2] == 0, capeq[3] == 0, 
      capeq[4] == 0, capeq[5] == 0, capeq[6] == 0, capeq[7] == 0, 
      capeq[8] == 0, capeq[9] == 0, capeq[10] == 0, capeq[11] == 0, 
      capeq[12] == 0, capeq[13] == 0, capeq[14] == 0, capeq[15] == 0, 
      capeq[16] == 0, capeq[17] == 0, capeq[18] == 0, capeq[19] == 0, elemar[1] == 0, elemar[2] == 0, elemar[3] == 0, elemar[4] == 0, elemar[5] == 0, elemar[6] == 0, elemar[7] == 0, elemar[8] == 0, 
      elemar[9] == 0, elemar[10] == 0, elemar[11] == 0, elemar[12] == 0, 
      elemar[13] == 0, elemar[14] == 0, elemar[15] == 0, elemar[16] == 0, 
      elemar[17] == 0, elemar[18] == 0, elemar[19] == 0,
     Gov1[1] == 0, Gov1[2] == 0, Gov1[3] == 0, Gov1[4] == 0, Gov1[5] == 0, 
      Gov1[6] == 0, Gov1[7] == 0, Gov1[8] == 0, Gov1[9] == 0, 
      Gov1[10] == 0, Gov1[11] == 0, Gov1[12] == 0, Gov1[13] == 0, 
      Gov1[14] == 0, Gov1[15] == 0, Gov1[16] == 0, Gov1[17] == 0, 
      Gov1[18] == 0, Gov1[19] == 0}
transols = {{k[2], 871.8287954437363`}, {k[3], 
   871.8287954437363`}, {k[4], 871.8287954437363`}, {k[5], 
   871.8287954437363`}, {k[6], 871.8287954437363`}, {k[7], 
   871.8287954437363`}, {k[8], 871.8287954437363`}, {k[9], 
   871.8287954437363`}, {k[10], 871.8287954437363`}, {k[11], 
   871.8287954437363`}, {k[12], 871.8287954437363`}, {k[13], 
   871.8287954437363`}, {k[14], 871.8287954437363`}, {k[15], 
   871.8287954437363`}, {k[16], 871.8287954437363`}, {k[17], 
   871.8287954437363`}, {k[18], 871.8287954437363`}, {k[19], 
   871.8287954437363`}, {k[20], 871.8287954437363`}, {ef[1], 4.96699}, {ef[2], 4.96699}, {ef[3], 4.96699}, {ef[4], 4.96699}, {ef[5], 4.96699}, {ef[6], 4.96699}, {ef[
     7], 4.96699}, {ef[8], 4.96699}, {ef[9], 4.96699}, {ef[
     10], 4.96699}, {ef[11], 4.96699}, {ef[12], 4.96699}, {ef[
     13], 4.96699}, {ef[14], 4.96699}, {ef[15], 4.96699}, {ef[
     16], 4.96699}, {ef[17], 4.96699}, {ef[18], 4.96699}, {ef[
     19], 4.96699},{d[2], 104.58436298896338`}, {d[3], 
   104.58436298896338`}, {d[4], 104.58436298896338`}, {d[5], 
   104.58436298896338`}, {d[6], 104.58436298896338`}, {d[7], 
   104.58436298896338`}, {d[8], 104.58436298896338`}, {d[9], 
   104.58436298896338`}, {d[10], 104.58436298896338`}, {d[11], 
   104.58436298896338`}, {d[12], 104.58436298896338`}, {d[13], 
   104.58436298896338`}, {d[14], 104.58436298896338`}, {d[15], 
   104.58436298896338`}, {d[16], 104.58436298896338`}, {d[17], 
   104.58436298896338`}, {d[18], 104.58436298896338`}, {d[19], 
   104.58436298896338`}, {d[20], 104.58436298896338`}}

I would appreciate if you could help me understand what that error msg means and if there is any way around fixing the issue. As apprised in my earlier post, I've obtained the steady-state values, however, I'm trying to obtain the transitional values during which I am using the said equation. I have checked the various posts on such error problems, but most have different set up of equations so I'm not able to relate it to my issue. Thank you once again for your time and advice.

POSTED BY: pemma dorji
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract