1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Solving a large system of PDEs in Mathematica

  1. Mar 20, 2016 #1
    1. The problem statement, all variables and given/known data
    Imagine a chain with ##n## links across a river. Now imagine, the chain is in a straight horizontal line at time ##t=0##. The problem wants me to calculate the movement of the chain links (center of mass) due to the gravity field. There are other forces in the system but this should give you an idea what I am doing - I am having problems with finding a numerical solution not the physical understanding. My variables are in fact angles between the chain link and horizontal line. Knowing the angles, determines the system completely. Applying equations of motion to each rod should give me a result.

    2. Relevant equations
    I am using the Lagrange's approach with Lagrange's equations of the second kind.

    3. The attempt at a solution
    Sadly the system is a bit more complicated than I described. There are torsional springs between the links and also an external force than leads to energy dissipation.
    This leads to.. well... to some very long and rather complicated partial differential equations. Not something one would like to solve on a paper, so I decided to write something in Mathematica. On my dropbox link you will find my code that works really nicely in case of ##n=4##. LINK: https://www.dropbox.com/s/ev2ig6g5bfybbjd/seminar_1_arbitrary.nb?dl=0

    The problem is that I don't get a solution for ##n## greater than 4. The differential equations and boundary conditions are correct (I checked 235235 times), but as soon as I increase n to 6 or 8 or 10, NDSolve[] doesn't do what it should anymore.

    So my question here is: If there are any Mathematica masters here? - What can I do? And to others: What are the most commonly used methods for solving a rather big system of PDEs? Is Mathematica even the right tool to do this?

    According to google, matlab is a good tool to, but sadly, I have never worked there and I assume would be a nightmare to start with an example like that.
  2. jcsd
  3. Mar 22, 2016 #2

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    I lack access to Mathematica, so cannot open or read your document, and I suspect many other posters are in the same position.

    If you could post something like a pdf version of your problem, I could try to assess if Maple can handle the problem, or look at whether some other, single-purpose DE solving packages are available that might be able to deal with your problem. No promises, though.
  4. Mar 27, 2016 #3
    I usually expect to find one of a handful of common mistakes responsible for things like this. But none of those seem to be present.

    If you look at what is returned from NDSolve, for n even and greater than four, it is just echoing back your problem with minor formatting changes. That is Mathematica's way of saying that a function couldn't deal with the problem. I tried using Simplify[Flatten[Rationalize[equations]]] instead of just Rationalize[equations] as the first argument to NDSolve. That gets rid of some nested braces that worry me a little and for your problem makes system substantially simpler. But it still won't solve.

    I am assuming your problem has exceeded some internal hidden limits. It is odd that it gives no warning or error message to go along with this.

    I would suggest you really really politely see if the folks more closely connected to Wolfram Inc over at http://community.wolfram.com might offer any insight into why there are no warnings and possibly even how to get it to solve.
  5. Mar 27, 2016 #4
    Thank you Bill, for taking a closer look at my code.

    My conclusion is that... I don't have a conclusion. I guess it is simply too much for Mathematica or I am missing quite a lot of knowledge - probably the second.

    Anyhow, the rules of solving this problem changed a day after I published this problem in this forum. I guess mentor realized that several people with several different methods in different programming languages have problems for some reason. We were than told that we were allowed to use approximation for small angles. This massively reduces the amount of cos and sin terms in the DE, therefore all the problems disappear and the system becomes solvable even in Mathematica.

    However at the moment I am working on implementing the idea that Ray Vickson has given me above. I have a strong feeling this approach leads to a lot faster code.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted