MathGroup Archive 2000

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

Search the Archive

Re: A Functional Programming Question


In a message dated 8/4/2000 1:33:06 AM, djmp at earthlink.net writes:

>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]] = (#1/a & ) /@ eqns[[1]];
>eqns[[2]] = (#1/b & ) /@ eqns[[2]];
>eqns[[3]] = (#1/c & ) /@ eqns[[3]];
>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?

eqns = {a * x == 0, b * y == 0, c * z == 0};

FullSimplify[eqns, a != 0 && b != 0 && c != 0]

{x == 0, y == 0, z == 0}


Bob Hanlon


  • Prev by Date: Re: Correlation function and data
  • Next by Date: Re: The Del operator
  • Previous by thread: Re: A Functional Programming Question
  • Next by thread: Re: A Functional Programming Question