Rank: Advanced Member Groups: Registered, Advanced Member Joined: 06/04/2023(UTC) Posts: 335 Was thanked: 23 time(s) in 23 post(s)
|
How can we solve this task in SMath? 3-mass.pdf (314kb) downloaded 38 time(s).
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 26/07/2022(UTC) Posts: 34 Location: UK Was thanked: 21 time(s) in 18 post(s)
|
I decided to have some fun by trying to solve this using only SMath basic capabilities. I found it easier to turn everything upside-down (i.e. to pretend that gravity pulled up instead of down!) and only reverted to the normal view when plotting the position graphs. I used an ultra-simple approach based on getting three sets of guesses for each mass coordinate and iterating until their differences were smaller than my specified tolerance. It’s crude, but it worked! Life would be much simpler of course if SMath had its own minimize or maximize function. 3_weights_stvmath.sm (38kb) downloaded 13 time(s).
|
1 user thanked StvMath for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 06/04/2023(UTC) Posts: 335 Was thanked: 23 time(s) in 23 post(s)
|
>Life would be much simpler of course if SMath had its own minimize or maximize function...
...with constrains.
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 06/04/2023(UTC) Posts: 335 Was thanked: 23 time(s) in 23 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 26/07/2022(UTC) Posts: 34 Location: UK Was thanked: 21 time(s) in 18 post(s)
|
Originally Posted by: OchkovVF
Yes. In the loop where it checks for unacceptable y2 values I should have added the line, msg:="Unacceptable y2 values. Try different initial guesses". Additionally, by changing lambda = lambda/2 to lambda = -lambda, it seems to work ok! If you change the initial guess for y2 to 11.5 it also works ok. Note: The method is very crude. It won't work for more than three weights, for example, without significant modification. Edited by user 10 April 2024 00:57:05(UTC)
| Reason: To correct error
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 26/07/2022(UTC) Posts: 34 Location: UK Was thanked: 21 time(s) in 18 post(s)
|
I'm still playing with this example! The attached uses a force-based approach, rather than an energy=based one. I couldn't figure out how to use the in-built Jacobian functions for my forces function, so had to construct it by hand (luckily, it's a very simple task here). 3_weights_stvmath_b.sm (39kb) downloaded 15 time(s).
|
3 users thanked StvMath for this useful post.
|
on 14/04/2024(UTC), on 14/04/2024(UTC), on 14/04/2024(UTC)
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.