RE: elementwise vector scalar subtraction

• To: mathgroup at smc.vnet.net
• Subject: [mg35648] RE: [mg35625] elementwise vector scalar subtraction
• From: "David Park" <djmp at earthlink.net>
• Date: Wed, 24 Jul 2002 02:06:17 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Oscar,

t = {0, 1, 1.5, 2, 2.5, 4, 6, 8, 10, 15, 20, 30};

u[sub_] := Join[{First[t]}, Rest[t] - sub]

u[0.15]
{0, 0.85, 1.35, 1.85, 2.35, 3.85, 5.85, 7.85, 9.85, 14.85, 19.85, 29.85}

Table[u[sub], {sub, 0.15, 0.30, 0.05}]
{{0, 0.85, 1.35, 1.85, 2.35, 3.85, 5.85, 7.85, 9.85, 14.85, 19.85, 29.85},
{0,
0.8, 1.3, 1.8, 2.3, 3.8, 5.8, 7.8, 9.8, 14.8, 19.8, 29.8}, {0, 0.75,
1.25, 1.75, 2.25, 3.75, 5.75, 7.75, 9.75, 14.75, 19.75, 29.75}, {0, 0.7,
1.2, 1.7, 2.2, 3.7, 5.7, 7.7, 9.7, 14.7, 19.7, 29.7}}

David Park

From: O.A. Linares, M.D., Ph.D. [mailto:divinesaam at aol.com]
To: mathgroup at smc.vnet.net

Dear Colleagues,

I have a t-vector

t = {0, 1, 1.5, 2, 2.5, 4, 6, 8, 10, 15, 20, 30};

I want to subtract 0.15 from each element except the first to get

tc15 = {0, 1 - 0.15, 1.50 - 0.15, 2 - 0.15, 2.5 - 0.15, 4 - 0.15, 6 -
0.15, 8 - 0.15, 10 - 0.15, 15 - 0.15, 20 - 0.15, 30 - 0.15};

I then want to subtract 0.20 to get

tc20 = {0, 1 - 0.20, 1.50 - 0.20, 2 - 0.20, 2.5 - 0.20, 4 - 0.20, 6 -
0.20, 8 - 0.20, 10 - 0.20, 15 - 0.20, 20 - 0.20, 30 - 0.20};

Is there a way to automate this process for n subtractions from 0.15
to 0.30 to yield individual t-vectors for tc15 through tc30 ?

With Much Appreciation,

Oscar

```

• Prev by Date: Substitution!!!
• Next by Date: Re: elementwise vector scalar subtraction
• Previous by thread: RE: elementwise vector scalar subtraction
• Next by thread: Re: elementwise vector scalar subtraction