Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.maple > #1031

Re: Vectors in the Physics package

From Joe Riel <joer@san.rr.com>
Newsgroups comp.soft-sys.math.maple
Subject Re: Vectors in the Physics package
Date 2014-11-15 08:22 -0800
Organization A noiseless patient Spider
Message-ID <87bno8igbq.fsf@san.rr.com> (permalink)
References <m42q2o$6s2$1@news.albasani.net> <m44dev$2lb$1@news.albasani.net> <m44ecn$2lb$2@news.albasani.net> <87sihldc78.fsf@san.rr.com> <m46p22$3ai$1@news.albasani.net>

Show all headers | View raw


rouben@shadow.(none) (Rouben Rostamian) writes:

> In article <87sihldc78.fsf@san.rr.com>, Joe Riel  <joer@san.rr.com> wrote:
>>rouben@shadow.(none) (Rouben Rostamian) writes:
>>
>>> In article <m44dev$2lb$1@news.albasani.net>,
>>> none) (Rouben Rostamian <rouben@shadow.> wrote:
>>>>In article <87oasakjdd.fsf@san.rr.com>, Joe Riel  <joer@san.rr.com> wrote:
>>>>>rouben@shadow.(none) (Rouben Rostamian) writes:
>>>>>
>>>>>> This is a question about Physics[Vectors] package.
>>>>>>
>>>>>> Let's say we want to plot the helix v = [ cos(t), sin((t), t], where
>>>>>> v is given as a Physics Vector.  Here is what I do:
>>>>>>
>>>>>>     restart;
>>>>>>     with(Physics[Vectors]):
>>>>>>     Setup(mathematicalnotation=true):
>>>>>>     with(plots):
>>>>>>     v_ := cos(t)*_i + sin(t)*_j + t*_k;
>>>>>>     spacecurve( [ Component(v_,1), Component(v_,2), Component(v_,3) ],
>>>>>>        t=0..4*Pi);
>>>>>>
>>>>>> This works fine, but the extraction of the components in the last
>>>>>> line looks too clunky to me.  Alternatively we may do
>>>>>>
>>>>>>     spacecurve( [ v_ . _i, v_ . _j, v_ . _k ], t=0..4*Pi);
>>>>>>
>>>>>> which is a bit shorter, but I suspect that I am missing something
>>>>>> more basic.  I tried convert(v_, list) and convert(v_, Vector)
>>>>>> but did not get anything useful.
>>>>>>
>>>>>> So the question is one of:
>>>>>> a) Is there a command to convert v_ to a list or a Vector?
>>>>>> b) Is there some other way to plot the spacecurve given by v_?
>>>>>
>>>>>You could do
>>>>>
>>>>>  basis := [_i,_j,_k]:
>>>>>
>>>>>then
>>>>>
>>>>>  spacecurve( v_.basis, t=0..4*Pi);
>>>>>
>>>>>does what you want.
>>>>
>>>>Perfect!  Thanks for your valuable help, as always.
>>>
>>> Oops, I spoke too soon.  Actually I spoke before trying
>>> the suggested solution.  In Maple 17 and 18 I get:
>>>
>>>   restart;
>>>   with(Physics[Vectors]):
>>>   Setup(mathematicalnotation=true):
>>>   with(plots):
>>>   v_ := cos(t)*_i + sin(t)*_j + t*_k:
>>>   basis := [_i,_j,_k]:
>>>   spacecurve( v_.basis, t=0..4*Pi);
>>>
>>> Error, (in plots/spacecurv) first argument must be array, rtable, list or set
>>>
>>> Perhaps there is a typo in the suggested solution.  
>>
>>Not a typo, but I only tested it on a beta version of Maple.
>>In 18 you can can do map(`.`,basis,v_), which isn't as nice.
>
> OK, good. this one works.  Thanks.
>
> It appears that map(`.`,basis,v_) extracts the components
> of v_ into a list.  A natural way of doing that should
> be convert(v_,list), and that's the first thing I tried.
> But as things are now, convert(v_,list) produces a list of
> vectors rather than scalar components, and which does not
> seem terribly useful.  Perhaps, if it's not too late, the
> behavior of convert(v_,list) can be changed to produce the
> list of components.

I don't foresee that happening; convert(.,list) would have
to specially handle this case, i.e. convert a linear polynomial 
in Physics' unit vectors to a list of the components.  What
is simpler to do is to provide the same functionality, but
as an addition/extension to Physics[Vectors].  For example,
a "Components" command could be added, which returns a list
of the components of a Physics vector, in the usual order.
Alternatively, extend Component so the second argument could
be a list of integers, so Component(v_,[1,2,3]) returns
the desired list of components.  I'll submit an SCR.

-- 
Joe Riel

Back to comp.soft-sys.math.maple | Previous | NextPrevious in thread | Find similar


Thread

Vectors in the Physics package rouben@shadow.(none) (Rouben Rostamian) - 2014-11-13 17:34 +0000
  Re: Vectors in the Physics package Joe Riel <joer@san.rr.com> - 2014-11-13 11:09 -0800
    Re: Vectors in the Physics package rouben@shadow.(none) (Rouben Rostamian) - 2014-11-14 08:11 +0000
      Re: Vectors in the Physics package rouben@shadow.(none) (Rouben Rostamian) - 2014-11-14 08:27 +0000
        Re: Vectors in the Physics package Joe Riel <joer@san.rr.com> - 2014-11-14 07:38 -0800
          Re: Vectors in the Physics package rouben@shadow.(none) (Rouben Rostamian) - 2014-11-15 05:41 +0000
            Re: Vectors in the Physics package Joe Riel <joer@san.rr.com> - 2014-11-15 08:22 -0800

csiph-web