Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.2K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Nonlinear system of equations

Posted 10 years ago

How to solve the following nonlinear system of equations ???

mm = 10; h = 1/mm; nn = 10000; k = 0.1/nn;

(*initial condition*)
Table[w[i, 0] = N[Sin[\[Pi]*i*h]], {i, 0, mm}];

(*boundary condition*)
Table[w[0, j] = 0, {j, 0, nn}];

(*boundary condition*)
Table[w[mm, j] = 0, {j, 0, nn}];

(*varables*)
vars = Table[w[i, j], {i, 1, mm - 1}, {j, 1, nn}] // Flatten;

(*equations*)
eqs = Table[(1 + (2 k)/h^2) w[i, j + 1] == (
      w[i + 1, j] + w[i - 1, j])/2 - 
      k/h (w[i + 1, j]^2 - w[i - 1, j]^2) - 
      k/h^2 (w[i + 1, j] + w[i - 1, j]), {i, 1, mm - 1}, {j, 0, 
     nn - 1}] // Flatten;

(*solution*)
sol = Flatten[NSolve[eqs, vars, Reals]];
POSTED BY: Imran Khan
3 Replies

Iteration, in this (uncommon) case. You have a number of equations of the form constant*variable==constant2, SOlve those first, plug solutions into the rest of the equations. Now observe that a number of these become of the same form. Solve for this set, plug into the rest, continue in that way. My guess is you get a full solution set without ever solving anything nonlinear.

POSTED BY: Daniel Lichtblau

Your code works fine with smaller values of nn (I tried with nn=100). Perhaps your full problem is too big with your approach.

POSTED BY: Gianluca Gorni

enter image description here

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