I am trying to numerically solve a system of differential equations using NDSolve in which there are some functions which are functions of one variable and there are other functions which are a function of another variable (essentially each of these functions depends on only one variable although the variable in question could be different). I am looking to find the solution for one of these functions.

Can NDSolve be used? In reading Mathematica's tutorial, it seems that NDSolve can only be used if each of the function depends only on one variable?

NDSolve[{Derivative[1, 0, 0][y1][a, b, c] == a, 
  Derivative[0, 1, 0][y2][a, b, c] == b, 
  Derivative[0, 0, 1][y3][a, b, c] == c,
  y1[0, b, c] == 0, 
  y2[a, 0, c] == 0,
  y3[a, b, 0] == 0}, {y1, y2, y3},
  {a, 0, 10}, {b, 0, 10}, {c, 0, 10}]

It is entirely possible to solve multiple equations in multiple independent variables with NDSolve. However, NDSolve expects that every function that it is solving for is being solved over the same domain, so every variable and the order in which they appear should remain constant. This means that as the number of variables increases, the amount of the equation definition that becomes superfluous similarly increases. Furthermore, each solution is sampled over the entirety of the solution space, and even solving these three extremely simple equations in this fashion becomes surprisingly memory intensive.

If you have two differential equations with independent variable sets, then it is generally best to solve them independently.

For more information and examples of more appropriate use cases consult the "Scope > Partial Differential Equations" section of NDSolve's documentation.

  • $\begingroup$ I see, thank you. $\endgroup$ – Vishal Verma Mar 8 '18 at 16:58
  • $\begingroup$ Sorry to press the matter, but here is what the NDSolve manual says:"In a system of ordinary differential equations there can be any number of unknown functions xi, but all of these functions must depend on a single “independent variable” t, which is the same for each function." I am totally new to Mathematica, and if I learn it it will be to solve for a system of equations with about 2-3 independent variables (the domain is the same so that is not an issue). I wanted to be sure that this is actually possible. Thanks again! $\endgroup$ – Vishal Verma Mar 12 '18 at 14:00
  • $\begingroup$ @VishalVerma NDSolve can solve equations in multiple independent variables, such as partial differential equations. My example here is precisely an example of that: note that y1 depends only on a, y2 depends only on b, and y3 depends only on c. However, if the equations (and not just the variables) are independent, then solve them independently. Also look at partial differential equations in the documentation. $\endgroup$ – eyorble Mar 12 '18 at 14:14
  • $\begingroup$ Alright, I will take a look. $\endgroup$ – Vishal Verma Mar 12 '18 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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