       Re: expressions list -> equations list

• To: mathgroup at smc.vnet.net
• Subject: [mg83997] Re: expressions list -> equations list
• From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
• Date: Thu, 6 Dec 2007 02:49:06 -0500 (EST)
• Organization: The Open University, Milton Keynes, UK
• References: <fj6404\$em9\$1@smc.vnet.net>

```Hauke Reddmann wrote:

> 1st of all THX to all who answered my last question. Just one other before
> I lend a Mathematica manual from the public lib and pester you no more :-)
>
> So. Now that I have a tensor it must vanish identically. I Flatten[] it first
> and then I have a list of equations...oh, stop, I haven't. REDUCE (if I may
> mention the name of a competition :-) could take a Solve[] now because it
> automatically assumes a "=0" as default but Mathematica is anally-retentive
> (a good thing :-) and I somehow must turn {a,b,c} into {a=0,b=0,c=0}.
> Convert to string, global change "," -> "=0," and "}" -> "=0}", reconvert
> to list? Is that possible? Or is there a less LISP-hack-style solution?

The following examples, all using pure functions --- equivalent to
anonymous functions in LISP, should fulfill your needs.

lst = {a, b, c};

Thread[# == Table[0, {Length@#}]] &@lst

Thread[# == Array[(0 &), Length@#]] &@lst

Thread[# == ConstantArray[0, Length@#]] &@lst

Cases[lst, x_ -> Equal[x, 0]]

(* Each expressions yield {a == 0, b == 0, c == 0} *)

lst = {x^2, Sin[x]^2 + Cos[x]^2, (x + 1)/x};

Thread[# == Table[0, {Length@#}]] &@lst
Thread[# == Array[(0 &), Length@#]] &@lst
Thread[# == ConstantArray[0, Length@#]] &@lst
Cases[#, x_ -> Equal[x, 0]] &@lst

(* Each of the above expression returns

2             2         2       1 + x
{x  == 0, Cos[x]  + Sin[x]  == 0, ----- == 0}
x
*)

Regards,
--
Jean-Marc

```

• Prev by Date: MathLink and VC++ 2008
• Next by Date: Re: Convert Binary Image to Column Vector
• Previous by thread: Re: expressions list -> equations list
• Next by thread: Re: expressions list -> equations list