MathGroup Archive 2008

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

Search the Archive

Re: symbolic evaluation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg87045] Re: symbolic evaluation
  • From: Albert Retey <awnl at arcor.net>
  • Date: Sun, 30 Mar 2008 01:15:40 -0500 (EST)
  • References: <fsl267$g9p$1@smc.vnet.net>

Hi,

> Thank you all for your answers, but they all result in Mathematica "solving" 
 > the equation and giving the answer 2, which is not what I need.
> What I need is for Mathematica to transpose the formula giving as
 > out put x = 14/7.

I'm really wondering why you need Mathematica to do that :-)

> I beginning to believe that mathematica can't do it 
 > because the designer didn't put that capability in it.

Being a full blown programming language, there isn't too much that it 
can't do, you just need to tell it what you want...

> This must be a hard concept for a computer to do.

the problem here is that mathematica knows about rationals, and that 2 
is a simpler and mathematically fully equivalent form of 14/7.

 > It just seems simple to me. What's wrong with
 > "out[1]= {{x -> 14/2}}" Which output I can't seem to get.

nothing wrong with it, but in just every case I can think of, it makes 
sense to simplify this. For all but the most trivial cases you would end 
up with incredible large fractions. Also many of the internals of 
mathematica require expressions to be turned into some standard form, 
e.g. to recognize that two expressions are equal. So basically I think 
it is for practical and performance reasons that simplifying rationals 
is automatic. If you want mathematica to not use it's internal knowledge 
about rationals, you could try to mask the fact that it deals with 
integers, e.g. by turning them into strings:

Solve[7x==14 /. i_Integer:>ToString[i],x]

For a real application (still wondering what that would be...) using a 
more sophisticated way to mask numbers is probably even better:

In[25]:= reseq=Equal@@Solve[7 x==14/.i_Integer:>HoldForm[i],x][[1,1]]
Out[25]= x==14/7

then when the need arises you can switch back to the normal behaviour:

In[26]:= ReleaseHold[reseq]
Out[26]= x==2

If I could convince you that mathematica probably can do what you need 
but you don't understand the details I would strongly suggest to read as 
much from the documentation as you can digest, but at least look at:

tutorial/Evaluation

(type this into the navigation bar of the documentation center). Maybe 
it would also help to describe in more details what exactly you are 
trying to do, my guess is that your actual problem is somewhat more 
complicated than what you have posted, otherwise the use of mathematica 
would be a terrible waste of money and time (cpu and yours)

hth,

albert


  • Prev by Date: Re: Re: Mathematica notebooks the best method
  • Next by Date: Re: Dynamic and J/Link
  • Previous by thread: Re: symbolic evaluation
  • Next by thread: FindMinimum[Print[]]