MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: equation expression problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101473] Re: [mg101431] equation expression problem
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Wed, 8 Jul 2009 07:10:43 -0400 (EDT)
  • References: <200907070906.FAA22172@smc.vnet.net>

I'm not sure I understand what you're doing=2C but I think perhaps you wish to have Mathematica interpret the n-th element of a

table m as m with a subscript n=2C in additin to m[[n]].



To do this=2C which I can't reproduce in email typing=2C type the following sequence:



a _ Ctrl-minus n _ := a[[n]]



When you type the Ctrl-minus the position to write the subscript will appear highlighted to indicate where you must type n_.



>From there on everytime you write the name of a table with a subscript i it will be interpreted as the i-th element of the table.



Hope this helps.



Tomas Garza





> Hi=2C everyone.
>
> I am now conducting a simulation for spacecraft attitude control. In this
> problem=2C q denotes the attitude which is expressed in quaternion=2C i.e .=2C
> q={Vq=2CSq}=2C where Vq is a vector consisting of the first three elements of q=2C
> and Sq is a scalar which is the last element of q=2C so Vq=q[[1=3B=3B3] ]=2C
> Sq=q[[4]]. The dynamics of the spacecraft consist of Vq =2C Sq=2C and q.
>
> What I want to do is to express the dynamics by q alone=2C therefore=2C in
> constructing the equation table=2C I used the following code:
> eqns[n_Integer] /=3B Positive[n] := Table[{ Subscript[q=2C i][[1=3B=3B3]]'[t]==
> "expression a "=2C Subscript[q=2C i][[4]]'[t]=="expression b"=2C "expression c"==
> " an expression including Subscript[q=2C i][t]" }=2C {i=2Cn}]
> but error occurs=2C
> Part::take:cannot take positions 1 through 3 in q1.
> part::partw:part of q1 does not exist...
>
> It seems that mathematica does not know what q is and therefore can not take
> its elements.
> I know that I can change it into another expression like
>
> Subscript[Vq=2C i]'[t] == "expression a "
> Subscript[Sq=2C i]'[t] == "expression b "
> Subscript[q=2C i][t] == Append[Subscript[Vq=2C i]'[t]=2C Subscript[Sq=2C i][t]].
> ...
> In another word=2C denote the dynamics by Vq and Sq as well as q respectively. > but it is not convenient.
> Is there any suggestion?
>
> Thanks in advance.
> Best regards=2C
>
> Haibo
>
>


  • Prev by Date: Re: Looping- Programming
  • Next by Date: Re: Simplifying with KroneckerDelta
  • Previous by thread: equation expression problem
  • Next by thread: Re: Polynomial rewriting question