       Re: A Functional Programming Question

• To: mathgroup at smc.vnet.net
• Subject: [mg24708] Re: [mg24705] A Functional Programming Question
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Wed, 9 Aug 2000 02:31:08 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```The simplest "functional" soution that comes to my mind is:

In:=
List @@ Last[Reduce[eqns, {x, y, z}]]
Out=
{x == 0, y == 0, z == 0}

However, it is not quite claer if using a "mathematical" function like
Reduce should be considered an example of "functional programming". So here
is a more "conventional" solution:

In:=
Inner[MapAt[Function[y, y/#1], #2, {1, 1}] &, {a, b, c}, {a x == 0, b y ==
0, c z == 0}, List]
Out=
{x == 0, y == 0, z == 0}

e
Andrzej Kozlowski
Toyama International University, JAPAN

For Mathematica related links and resources try:
<http://www.sstreams.com/Mathematica/>

on 8/4/00 7:19 AM, David Park at djmp at earthlink.net wrote:

> Dear MathGroup,
>
> Suppose I have three equations.
>
> eqns = {a x == 0, b y == 0, c z == 0};
>
> I want to divide out the constants a, b, and c. I can do it this way:
>
> eqns[] = (#1/a & ) /@ eqns[];
> eqns[] = (#1/b & ) /@ eqns[];
> eqns[] = (#1/c & ) /@ eqns[];
> eqns
>
> {x == 0, y == 0, z == 0}
>
> Is there a simpler method for doing the calculation in one statement with
> functional programming, say using MapThread over eqns and {a,b,c}? Is there
> any other simple approach?
>
> David Park