|
[Date Index]
[Thread Index]
[Author Index]
Re: replacement x->y except in Exp[x]
- To: mathgroup at smc.vnet.net
- Subject: [mg110885] Re: replacement x->y except in Exp[x]
- From: Andrzej Kozlowski <akozlowski at gmail.com>
- Date: Sat, 10 Jul 2010 04:00:20 -0400 (EDT)
- References: <i14aij$g0p$1@smc.vnet.net> <201007090034.UAA21449@smc.vnet.net> <i16vm6$iuj$1@smc.vnet.net> <4C3787FD.7010401@cs.berkeley.edu>
On 10 Jul 2010, at 05:35, Richard Fateman wrote:
> Andrzej Kozlowski wrote:
> ....
>
>> Suppose in the expression 2/3 I + x/y I you wish to replace all fractions (that is 2/3 and x/y) by r and I by d. Without worrying about evaluation you can do this as follows:
>> Unevaluated[Unevaluated[2/3 I + x/y I] /. HoldPattern[x_/y_] -> r] /.
>> HoldPattern[I] -> d
>> 2 d r
>> ...
>
>
>> All this is perfectly reasonable, logical and a great deal easier than almost anything in an undergraduate math syllabus at a reasonable university.
>>
> Really?
>
> So if someone gives you a basket of fruit and says to replace the apples with bananas, you explain that it is easy: First you tell that person to throw away that basket and come up with a new basket in which he has wrapped the whole basket in a layer of aluminum foil. You then replace
> "apple-wrapped-in-foil" by banana.
>
> You then proclaim the problem solved.
>
> Unfortunately, if I give you an already unwrapped basket of fruit, it is impossible. (that is, an already simplified Mathematica expression)
>
> Which is presumably the usual state of the basket.
Impossible? For example (just one of many ways to do this):
expr = 1 + I;
ReleaseHold[
ToExpression[ToString[expr, TraditionalForm], InputForm, Hold] /.
HoldPattern[I] -> d]
d+1
etc.
>
>
> A discussion and partial definition of BetterRules, a Mathematica program that does things like this, is in
> http://www.cs.berkeley.edu/~fateman/papers/better-rules.pdf
It's amazing what some people call "papers" these days.
Andrzej Kozlowski
Prev by Date:
Re: image is not graphics
Next by Date:
Re: FittedModel object type
Previous by thread:
Re: replacement x->y except in Exp[x]
Next by thread:
Re: replacement x->y except in Exp[x]
|