[Date Index]
[Thread Index]
[Author Index]
Re: Re: unevaluated, hold, holdform
*To*: mathgroup at smc.vnet.net
*Subject*: [mg51015] Re: [mg50983] Re: unevaluated, hold, holdform
*From*: DrBob <drbob at bigfoot.com>
*Date*: Fri, 1 Oct 2004 04:49:37 -0400 (EDT)
*References*: <vas7uiw8wg82@legacy>, <k0gbicmq07vc@legacy> <200409300852.EAA26559@smc.vnet.net>
*Reply-to*: drbob at bigfoot.com
*Sender*: owner-wri-mathgroup at wolfram.com
> Notice that if you make:
> a= unevaluated[[(4*x^2)/(2*x)]
>
> then, Numerator[a] also yields 2x
No, Numerator[a] would yield just "a" from that input, because the previous line has two typos and doesn't get executed. Surely you meant:
a=Unevaluated[(4*x^2)/(2*x)]
Numerator[a]
2 x
2 x
> I wonder if there are other packages which allow to
> work the real form of ratios, specially when considering
> that it is going to be the most important principle
> of modern mathematics in future times.
So reducing fractions was a mistake all these years, huh?
That's very funny.
Bobby
On Thu, 30 Sep 2004 04:52:52 -0400 (EDT), "D. Gomez" <rationalmean at hotmail.com> wrote:
>
> Many thanks. I understand mathematica does not have
> any "switch" to turn such automatic reduce-to-lowest off.
>
> Notice that if you make:
> a= unevaluated[[(4*x^2)/(2*x)]
>
> then, Numerator[a] also yields 2x
>
> I wonder if there are other packages which allow to
> work the real form of ratios, specially when considering
> that it is going to be the most important principle
> of modern mathematics in future times.
>
> Regards,
> D. Gomez
>
>
>
> On 26 Sep 04 13:31:43 -0400 (EDT), highegg wrote:
>> 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
>> any
>>> 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:
>>> (2*x)
>>> 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:
>> Numerator[Unevaluated[(4*x^2)/(2*x)]]
>>
>> but be careful, if you use this as a function:
>> f[x_]:=Numerator[Unevaluated[x]],
>>
>> 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
>> f:
>> AppendTo[Attributes[f],HoldAll]
>>
>> now f[(4*x^2)/(2*x)] will give us what we want!
>> (but note that f[x_]:=Numerator[x] still won't work!)
>
> ~
> ~
> ~
> ~
>
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
**Re: GuiKit, Script[] and external function**
Next by Date:
**Re: Fitting multiple data**
Previous by thread:
**Re: unevaluated, hold, holdform**
Next by thread:
**Suggestion to WRI for notebook navigation (frontend)**
| |