# User Portlet

Discussions |
---|

Thank you David for having solved my problem, that example was really helpful for me. Now Mathematica creates the network graph. Regards Filippo |

If you change your definition for U to take patterns: Clear[U]; U[x_, t_] = Sum[(An*Cos[omegan*t] + Bn*Sin[omegan*t])*Sin[n*Pi*x/L], {n, 1, 10 L}] Then Table[Plot[Evaluate[U[x, t]], {x, -10, 10},... |

Thank you S M Blinder. Ok now I can solve the equation, but when i plot the result, it is totally different from which I obtain with NDSolveValue. What do you think about? Thank you Clear["Global`*"]; ... |

Forget to mention that **NDSolveValue[]** can be used to generate data instead of **WhenEvent[]**. The latter is probably more suitable for more sophisticated ''events''. The modified code is a little bit cleaner and tiny bit faster: DATA = ... |

Thank you Paritosh and Ivan. I have expressed L through p because of H(q,p,t)=Sum[q'[t]*p[t]] -L[q,p,t] so I wanted to solve my system in x,y,z,px,py,pz. "IndexReduction" should not be used, Mathematica gave me that suggestion because my code was... |

Your force law is incorrect. For example, your force in the x-direction has only (x(t)-xi)^2 in the denominator. You need (r(t)-ri)^2. Cheers, Kevin |