MathGroup Archive 1998

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

Search the Archive

RE: Re: RE-GROUPING OF EXPRESS




Alternatively you can use StandardForm as the default format, and
evaluate  the line below.
If you always want to use this form, you can put it in your (init.m)
file. 
 StandardForm does have the advantage that expressions like ArcTan[x]
are  written in an unambiguous form, and can be used as input without
generating  messages.

In[1]:=
MakeBoxes[(n_Real|n_Integer|n_Rational)*a_.+b_/;
(Head[b]=!=Plus)&&(n<0),form_]:=
RowBox[{MakeBoxes[b,form],"-", MakeBoxes@@{-n*a,form}}];


In[2]:=
b-a

Out[2]=
b-a

I know cryptic code like this makes Jerry Blimbbaum's blood boil.  He
had  that remark about a cryptic post I had earlier, and I am sure
others feel  that way.   Well with Mathematica you can get this via a
method that is more  intuitive (use Traditional Form).   On the other
hand Mathematica also lets  you control things at a very low level. 
Granted the code is cryptic, but it  gives you much more flexibility. 
Also some of us (myself included) like  learning the more advanced
parts of the system as a hobby.

Ted Ersek

 ----------
|
|> My question concerns regrouping of variables, specifically terms |>
like (a-b) become transformed into -b + a  (even though in the original
|> they are entered as a - b) which is a form I dont like nor does one
|> usually write equations that way.  Is there anything one can do |>
about this
|
|If StandardForm is your Default Output FormatType (under the Cell menu)
|you get the behavior you describe:
|
|    In[1]:= b-a
|    Out[1]= -a+b
|
|However, you can convert the output to TraditionalForm manually, e.g.,
|
|    In[2]:= b-a//TraditionalForm
|    Out[2]= b-a
|
|or change your default to be TraditionalForm (which I personally
|prefer).
|
|> or why does Mathematica do it in the first place? |
|Mathematica often needs to do an internal re-ordering of expressions.
|TraditionalForm attempts to display the output in a form that
|corresponds to "standard" mathematical conventions. |
|Cheers,
|Paul Abbott




  • Prev by Date: Mac Mathlink Dev Kit?
  • Next by Date: Compile multiple functions or not?
  • Prev by thread: Re: Mac Mathlink Dev Kit?
  • Next by thread: Compile multiple functions or not?