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


Groups > comp.soft-sys.math.maple > #358 > unrolled thread

Question about concatenation “a||b” in Maple?

Started byRex <aoirex@gmail.com>
First post2012-02-08 02:53 -0800
Last post2012-02-08 14:34 -0800
Articles 5 — 3 participants

Back to article view | Back to comp.soft-sys.math.maple


Contents

  Question about concatenation “a||b” in Maple? Rex <aoirex@gmail.com> - 2012-02-08 02:53 -0800
    Re: Question about concatenation “a||b” in Maple? "A. van der Meer" <a.w.j.vandermeer@math.utwente.nl> - 2012-02-08 16:22 +0100
      Re: Question about concatenation “a||b” in Maple? Rex <aoirex@gmail.com> - 2012-02-08 10:57 -0800
        Re: Question about concatenation “a||b” in Maple? Joe Riel <joer@san.rr.com> - 2012-02-08 12:52 -0800
          Re: Question about concatenation “a||b” in Maple? Rex <aoirex@gmail.com> - 2012-02-08 14:34 -0800

#358 — Question about concatenation “a||b” in Maple?

FromRex <aoirex@gmail.com>
Date2012-02-08 02:53 -0800
SubjectQuestion about concatenation “a||b” in Maple?
Message-ID<2c80a9c7-f5c7-4144-8f0a-b4d1d92c1c17@jn12g2000pbb.googlegroups.com>
I test the code

        L=[2,1];
        sum('a||b*L[1]', 'b' = 1 .. 2);

It returns `a1*L[1]+a2*L[1]`, but I expect to get `a1*2+a2*2` after
evaluation of `L[1]`.
Any ideas?

[toc] | [next] | [standalone]


#359

From"A. van der Meer" <a.w.j.vandermeer@math.utwente.nl>
Date2012-02-08 16:22 +0100
Message-ID<dd07b$4f32934a$82593461$731@news1.tudelft.nl>
In reply to#358
Rex wrote:

> I test the code
> 
>         L=[2,1];
>         sum('a||b*L[1]', 'b' = 1 .. 2);
> 
> It returns `a1*L[1]+a2*L[1]`, but I expect to get `a1*2+a2*2` after
> evaluation of `L[1]`.
> Any ideas?

(1) Change L=[2,1]; into L := [ 2,1];
(2) add(a||b*L[1], b = 1 .. 2);

Adri

[toc] | [prev] | [next] | [standalone]


#360

FromRex <aoirex@gmail.com>
Date2012-02-08 10:57 -0800
Message-ID<74fb2a8c-d0dd-444c-bdfd-78eaa5e60857@lr19g2000pbb.googlegroups.com>
In reply to#359
Great thanks Adri. Sorry for my typo for "L:=".

I have one further question. Here's the test code:

        L := [2, 1]
        test := proc (i) local a1; a1 := 1; add(a || b*L[i], b = 1 ..
2) end proc
        test(1);
will result
                          2 a1 + 2 a2
without evaluating `a1` which is a local variable defined in function
test.
I expect to get `2*1+2*a2`.



On Feb 8, 7:22 am, "A. van der Meer"
<a.w.j.vanderm...@math.utwente.nl> wrote:
> Rex wrote:
> > I test the code
>
> >         L=[2,1];
> >         sum('a||b*L[1]', 'b' = 1 .. 2);
>
> > It returns `a1*L[1]+a2*L[1]`, but I expect to get `a1*2+a2*2` after
> > evaluation of `L[1]`.
> > Any ideas?
>
> (1) Change L=[2,1]; into L := [ 2,1];
> (2) add(a||b*L[1], b = 1 .. 2);
>
> Adri

[toc] | [prev] | [next] | [standalone]


#363

FromJoe Riel <joer@san.rr.com>
Date2012-02-08 12:52 -0800
Message-ID<87ty31ujxx.fsf@san.rr.com>
In reply to#360
Rex <aoirex@gmail.com> writes:

> Great thanks Adri. Sorry for my typo for "L:=".
>
> I have one further question. Here's the test code:
>
>         L := [2, 1]
>         test := proc (i) local a1; a1 := 1; add(a || b*L[i], b = 1 ..
> 2) end proc
>         test(1);
> will result
>                           2 a1 + 2 a2
> without evaluating `a1` which is a local variable defined in function
> test.
> I expect to get `2*1+2*a2`.

The catenation operator generates global variables, not locals.
Using indexing if you want to refer to a local by an index.

-- 
Joe Riel

[toc] | [prev] | [next] | [standalone]


#364

FromRex <aoirex@gmail.com>
Date2012-02-08 14:34 -0800
Message-ID<4a682c2c-dcc5-4687-8f82-5f8f3579fe51@ow3g2000pbc.googlegroups.com>
In reply to#363
Got it. Thank you very much, Joe.

Have a nice day.

On Feb 8, 12:52 pm, Joe Riel <j...@san.rr.com> wrote:
> Rex <aoi...@gmail.com> writes:
> > Great thanks Adri. Sorry for my typo for "L:=".
>
> > I have one further question. Here's the test code:
>
> >         L := [2, 1]
> >         test := proc (i) local a1; a1 := 1; add(a || b*L[i], b = 1 ..
> > 2) end proc
> >         test(1);
> > will result
> >                           2 a1 + 2 a2
> > without evaluating `a1` which is a local variable defined in function
> > test.
> > I expect to get `2*1+2*a2`.
>
> The catenation operator generates global variables, not locals.
> Using indexing if you want to refer to a local by an index.
>
> --
> Joe Riel

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.maple


csiph-web