Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: unevaluated, hold, holdform

  • To: mathgroup at
  • Subject: [mg50912] Re: unevaluated, hold, holdform
  • From: highegg at (highegg)
  • Date: Mon, 27 Sep 2004 00:42:28 -0400 (EDT)
  • References: <vas7uiw8wg82@legacy>
  • Sender: owner-wri-mathgroup at

On 24 Sep 04 09:46:19 -0400 (EDT), D. Gomez wrote:
>Dear all,
>A friend of mine need to get both the numerator and denominator of
>expression but he does not want it to be reduced to its lowest 
>form, i.e.: given the expression (4 x^2)/(2 x), he needs to extract
>its Numerator:
>Numerator[(4*x^2)/(2*x)]= 4 x^2,
>however Mathematica always simplify it to its lowest form yielding:
>as its Numerator, that's not what we are looking for.
>We all know about the Hold, HoldForm, Unevaluated functions but
>don't know how to get the Numerator by using at the same time those
>hold functions.
>Many thanks for your help, indeed.
>D. Gomez

hello Gomez,

might not be what you will need,
but in general, arguments given to a function are evaluated first
(as an expression in brackets)
if you want to prevent an argument from evaluation,
Wrap it with the _Unevaluated_ function:

but be careful, if you use this as a function:

f[(4*x^2)/(2*x)] won't work, the argument is pre-evaluated again!

the best way to sort this out is to assign an argumant to the function

now f[(4*x^2)/(2*x)] will give us what we want!
(but note that f[x_]:=Numerator[x] still won't work!)

  • Prev by Date: RE: PlotRange-> {0, All}
  • Next by Date: Re: A list element replacement.
  • Previous by thread: Re: problem with very slow matrix function
  • Next by thread: Re: unevaluated, hold, holdform