Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: expressions list -> equations list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83979] Re: expressions list -> equations list
  • From: Szabolcs Horvát <szhorvat at gmail.com>
  • Date: Thu, 6 Dec 2007 02:39:34 -0500 (EST)
  • 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?
> 

Note that in Mathematica a = 0 is an assignment.  If you need to assign 
values to several undefined symbols, then

{a, b, c} = {0, 0, 0}

will work.  If you need to build a list of equations then try
# == 0 & /@ {a, b, c} or Thread[{a,b,c} == 0]
both of which yield {a==0, b==0, c==0}

But Solve[] seems to accept vector-equations too:

In[1]:= Solve[{a, b, c} == 0, {a, b, c}]
Out[1]= {{a -> 0, b -> 0, c -> 0}}

In[2]:= Solve[{a, b, c} == {1, 2, 3}, {a, b, c}]
Out[2]= {{a -> 1, b -> 2, c -> 3}}

If it doesn't work for some reason, then use Thread[]:

In[3]:= Thread[{a, b, c} == {1, 2, 3}]
Out[3]= {a == 1, b == 2, c == 3}

-- 
Szabolcs


  • Prev by Date: Re: Controlling evaluation
  • Next by Date: joint histogram of an three channels of an image
  • Previous by thread: Re: expressions list -> equations list
  • Next by thread: Re: expressions list -> equations list