Message Boards Message Boards

0
|
14645 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

An error message "Encountered non-numerical value" when using NDSolve

Posted 10 years ago

I attached my program. It is a problem of solving 22 second-order ODEs with 44 boundary conditions. When using different versions of MM, it reports different error messages, and the common error message is "Encountered non-numerical value for a derivative at x == 0." But after checking for many times, I believe that numerical values have been assigned to all symbolic parameters in my code. So why this error message occurs? What's wrong with my code? Many thanks!!

Attachments:
POSTED BY: Hui Sun
2 Replies

At first sight you are not providing an interval on which to solve numerically. Also, ther is a typo: in the last equation you write u20a[a]. If you replace that with u20a[x] you get an answer:

NDSolve[{u1a''[x] == 2 \[Kappa]2^2 (u1a[x] - u2b[x]), 
  u2b''[x] == 2 \[Kappa]2^2 (u2b[x] - u1a[x]), 
  u4a''[x] == 2 \[Kappa]2^2 (u4a[x] - u6b[x]), 
  u6b''[x] == 2 \[Kappa]2^2 (u6b[x] - u4a[x]), 
  u4b''[x] == 2 \[Kappa]2^2 (u4b[x] - u2a[x]), 
  u2a''[x] == 2 \[Kappa]2^2 (u2a[x] - u4b[x]), 
  u8a''[x] == 2 \[Kappa]2^2 (u8a[x] - u10b[x]), 
  u10b''[x] == 2 \[Kappa]2^2 (u10b[x] - u8a[x]), 
  u8b''[x] == 2 \[Kappa]2^2 (u8b[x] - u6a[x]), 
  u6a''[x] == 2 \[Kappa]2^2 (u6a[x] - u8b[x]),
  u10a''[x] == 2 \[Kappa]2^2 (u10a[x] - u12b[x]), 
  u12b''[x] == 2 \[Kappa]2^2 (u12b[x] - u10a[x]),
  u14b''[x] == 2 \[Kappa]2^2 (u14b[x] - u12a[x]), 
  u12a''[x] == 2 \[Kappa]2^2 (u12a[x] - u14b[x]),
  u14a''[x] == 2 \[Kappa]2^2 (u14a[x] - u16b[x]), 
  u16b''[x] == 2 \[Kappa]2^2 (u16b[x] - u14a[x]),
  u18b''[x] == 2 \[Kappa]2^2 (u18b[x] - u16a[x]), 
  u16a''[x] == 2 \[Kappa]2^2 (u16a[x] - u18b[x]),
  u18a''[x] == 2 \[Kappa]2^2 (u18a[x] - u20b[x]), 
  u20b''[x] == 2 \[Kappa]2^2 (u20b[x] - u18a[x]),
  u22b''[x] == 2 \[Kappa]2^2 (u22b[x] - u20a[x]), 
  u20a''[x] == 2 \[Kappa]2^2 (u20a[x] - u22b[x]),
  u1a[0] == 0, u2b'[0] == 0, u4a[1] == u4b[1], 
  u2a'[1] == \[Kappa]1 (u6b[1] - u2a[1]), 
  u6b'[1] == \[Kappa]1 (u6b[1] - u2a[1]), u4b'[1] == u4a'[1], 
  u1a'[1/2] == \[Kappa]1 (u4b[1/2] - u1a[1/2]), 
  u4b'[1/2] == \[Kappa]1 (u4b[1/2] - u1a[1/2]), 
  u2a'[1/2] == u2b'[1/2], u2a[1/2] == u2b[1/2], u8a[2] == u8b[2], 
  u6a'[2] == \[Kappa]1 (u10b[2] - u6a[2]), 
  u10b'[2] == \[Kappa]1 (u10b[2] - u6a[2]), u8b'[2] == u8a'[2], 
  u4a'[3/2] == \[Kappa]1 (u8b[3/2] - u4a[3/2]), 
  u8b'[3/2] == \[Kappa]1 (u8b[3/2] - u4a[3/2]), 
  u6b'[3/2] == u6a'[3/2], u6b[3/2] == u6a[3/2], u12b[3] == u12a[3], 
  u10a'[3] == \[Kappa]1 (u14b[3] - u10a[3]), 
  u14b'[3] == \[Kappa]1 (u14b[3] - u10a[3]), u12b'[3] == u12a'[3], 
  u8a'[5/2] == \[Kappa]1 (u12b[5/2] - u8a[5/2]), 
  u12b'[5/2] == \[Kappa]1 (u12b[5/2] - u8a[5/2]), 
  u10b'[5/2] == u10a'[5/2], u10b[5/2] == u10a[5/2], 
  u16b[4] == u16a[4], u14a'[4] == \[Kappa]1 (u18b[4] - u14a[4]), 
  u18b'[4] == \[Kappa]1 (u18b[4] - u14a[4]), u16b'[4] == u16a'[4], 
  u12a'[7/2] == \[Kappa]1 (u16b[7/2] - u12a[7/2]), 
  u16b'[7/2] == \[Kappa]1 (u16b[7/2] - u12a[7/2]), 
  u14b'[7/2] == u14a'[7/2], u14b[7/2] == u14a[7/2], 
  u20b[5] == u20a[5], u18a'[5] == \[Kappa]1 (u22b[5] - u18a[5]), 
  u22b'[5] == \[Kappa]1 (u22b[5] - u18a[5]), u20b'[5] == u20a'[5], 
  u16a'[9/2] == \[Kappa]1 (u20b[9/2] - u16a[9/2]), 
  u20b'[9/2] == \[Kappa]1 (u20b[9/2] - u16a[9/2]), 
  u18b'[9/2] == u18a'[9/2], u18b[9/2] == u18a[9/2], 
  u22b[11/2] == 11 \[Epsilon]/2, 
  u20a[11/2] == 11 \[Epsilon]/2}, {u1a[x], u2b[x], u4a[x], u6b[x], 
  u4b[x], u2a[x], u8a[x], u10b[x], u8b[x], u6a[x], u10a[x], u12b[x], 
  u14b[x], u12a[x], u14a[x], u16b[x], u18b[x], u16a[x], u18a[x], 
  u20b[x], u22b[x], u20a[x]}, {x, -1, 2}]
POSTED BY: Gianluca Gorni

Many thanks!! I'm always bad at finding typos...

POSTED BY: Hui Sun
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