Solving a large system of PDEs in Mathematica

Click For Summary
The discussion focuses on solving a complex system of partial differential equations (PDEs) related to the movement of a chain with multiple links under gravitational and other forces. The user successfully implemented a solution in Mathematica for four links but encounters issues when increasing the number of links to six or more, with NDSolve failing to provide a solution. Suggestions from other users include simplifying the equations and considering alternative software like Maple or MATLAB for better handling of the problem. A recent update allows for approximations for small angles, which simplifies the equations significantly, making the problem solvable in Mathematica. The user is now exploring this new approach to improve the efficiency of their code.
skrat
Messages
740
Reaction score
8

Homework Statement


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.

Homework Equations


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

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.
 
Physics news on Phys.org
skrat said:

Homework Statement


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.

Homework Equations


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

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.

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.
 
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.
 
  • Like
Likes skrat
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.

cheers,
mitja
 
Question: A clock's minute hand has length 4 and its hour hand has length 3. What is the distance between the tips at the moment when it is increasing most rapidly?(Putnam Exam Question) Answer: Making assumption that both the hands moves at constant angular velocities, the answer is ## \sqrt{7} .## But don't you think this assumption is somewhat doubtful and wrong?

Similar threads

  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K