Message Boards Message Boards

0
|
3943 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Sum and Derivate

Posted 10 years ago
 I want to programm a N-Pendulum(the Idea comes from the Doublependulum). And i have the following Problem:

v[q_]:=Sum[Subscript[l, n]Sin[Subscript[\[Phi], n][t]],{n,1,q,1}]

w[q_]:=Sum[-Subscript[l, n]Cos[Subscript[\[Phi], n][t]],{n,1,q,1}]

vko=Subscript[l, 1]Sin[Subscript[\[Phi], 1][t]]

wko=-Subscript[l, 1]Cos[Subscript[\[Phi], 1][t]]
These are the Koordinates of for the mass of the first pendulum. But what happens now is more a technical problem of mathematica, i think.
I put the first point (v,w) in to the kinetic energy:
Tkin = Sum[

  Subscript[m, q]/2 (D[v[q], t]^2 + D[w[q], t]^2), {q, 1, 1, 1}]
Out:
 1/2 Subscript[m, 1] (Cos[Subscript[\[Phi], 1][t]]^2
 
 \!\(\*SubsuperscriptBox[\(l\), \(1\), \(2\)]\) Derivative[1][
 
      Subscript[\[Phi], 1]][t]^2 + Sin[Subscript[\[Phi], 1][t]]^2
 
 \!\(\*SubsuperscriptBox[\(l\), \(1\), \(2\)]\) TextCell[
 
     ""]^2 Derivative[1][Subscript[\[Phi], 1]][t]^2)
The Second Point (vko,wko)
Tkin = Sum[

  Subscript[m, q]/2 (D[vko, t]^2 + D[wko, t]^2), {q, 1, 1, 1}]
Out:
 1/2 Subscript[m, 1] (Cos[Subscript[\[Phi], 1][t]]^2
 
 \!\(\*SubsuperscriptBox[\(l\), \(1\), \(2\)]\) Derivative[1][
 
      Subscript[\[Phi], 1]][t]^2 + Sin[Subscript[\[Phi], 1][t]]^2
 
 \!\(\*SubsuperscriptBox[\(l\), \(1\), \(2\)]\) Derivative[1][
 
      Subscript[\[Phi], 1]][t]^2)
In the first Out u see: mathematica put  " ^2" in the solution. But when i give mathematica the koord without the sum, it gives the correct solution without the Textcell[""]^2.
How can i bring mathematica to stop generating this Textcell?
POSTED BY: Simon Baumgarten
Compare the formulation of a triple pendulum in the demonstrations project http://demonstrations.wolfram.com/TriplePendulum/ occasionally I faced problems with sub- and/or superscripted variable and function names; in such cases instead of
Subscript[f, i]
the
f[i]
does a better job.
POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract