I am making an gravity simulation. I hava a problem with the function that calculates a list of accelerations for all my masses
why is it giving me an error?
I am making an gravity simulation. I hava a problem with the function that calculates a list of accelerations for all my masses
why is it giving me an error?
You may get better help at support.desmos.com for calculator specific problems. However, it would be more helpful to (1) post the link as well and, if not, (2) highlight the error to see what it says. My guess here is that you need to surround the whole thing in brackets, or possibly need to index m_ass in your summations else you have a list of lists (which may be indicated by the error message).
That’s the way to write your formulas …
https://www.desmos.com/calculator/l6tilfx9vn
but the simulation is wrong because you cannot calculate the x acceleration and the y acceleration separtedly.
You have to calculate the vector acceleration for each mass and then add everything together.
This is the way to do this simulation:
https://www.desmos.com/calculator/iimwbfhvis
[the reply was meant to Giraffe]
I made this with your graph as inspiration. My points just all go to the center. Do you know why? i have tried starting with more speed but that doesn’t work.
by the way. Thank you for you help.
Two little errors:
https://www.desmos.com/calculator/cfpbm6dryx
There’s also an error that I made. The direction:
(Position[n]-Positiont[i])
should be divided by its length:
distance(Position[n], Positiont[i]))
so the power in the denominator in the main sum should actually be 3, but if you do that the forces get really weak and the system is less interesting.
i now have this. it works but it is not very interresting. what should i do to make it more interresting? I saw you post but i don’t know what you mean.
again. Thank you for all you help and time for my silly little project.
I think the simulation works, what differs from reality is the fact that when two planets crash into each other they just become one big planet.
If you give the planets the correct initial velocities you will see them orbiting around each other.
You could set the force to 0 when two planets clash into each other:
https://www.desmos.com/calculator/18wcszarak
If you want something more fun you can use 1 as exponent instead of 2 … and you get a more springy behaviour:
https://www.desmos.com/calculator/uyly2s0tkh
thanks for your help.