MathGroup Archive 2000

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

Search the Archive

Re: LeafCount Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25804] Re: [mg25782] LeafCount Question
  • From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
  • Date: Sat, 28 Oct 2000 01:40:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

If you wish to have "traditional" looking formulas you have to use
TraditionalForm. In particular, TraditionalForm[-A+B] will come out as A-B
etc. As long as you do not intend to copy your outputs and use them again as
inputs you can set all your output come out in TraditionalForm using the
Default Output Format submenu of the Cell menu.

-- 
Andrzej Kozlowski
Toyama International University
JAPAN

http://platon.c.u-tokyo.ac.jp/andrzej/
http://sigma.tuins.ac.jp/

on 00.10.25 4:53 PM, Dana at dana_news at hotmail.com wrote:

> Hello.  Using Mathematica 4.0  When one solves equations, I get a little
> frustrated
> when the answers come out as
> -A +B, when the answer looks much better as...
> B - A
> 
> I was hoping that the "LeafCount" would be smaller with my "preferred" way,
> but for some reason, it does not look like there is a difference.
> 
> In[19]:=
> {LeafCount[-B + D], LeafCount[D - B]}
> 
> Out[19]=
> {5, 5}
> 
> 
> Here is a simple Solve, and it is a little embarrassing to say the answer is
> (-B + D)..Etc when  everyone else will have to change this  manually to (D -
> B)...ect.
> 
> Is there a way around this?  Again, I was hoping LeafCount would do the
> trick, but it apparently does not.
> Thank you in advance.  Dana.
> 
> FullSimplify[Solve[{Y == A*X + B, Y == C*X + D}, {X, Y}],
> ComplexityFunction -> LeafCount]
> 
> {{X -> (-B + D)/(A - C), Y -> (-(B*C) + A*D)/(A - C)}}
> 
> 
> 
> Since I am new to Mathematica, I noticed the following...
> Internally, it looks like no difference.  It is just frustrating.
> 
> In[25]:=
> {FullForm[(-B + D)], FullForm[(D - B)]}
> 
> Out[25]=
> {Plus[Times[-1, B], D], Plus[Times[-1, B], D]}
> 
> 
> 
> 





  • Prev by Date: NIntegrate v.s. NonlinerFit
  • Next by Date: Re: LeafCount Question
  • Previous by thread: RE: LeafCount Question
  • Next by thread: Re: LeafCount Question