MathGroup Archive 2005

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

Search the Archive

Re: Transformation rule problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg58201] Re: Transformation rule problem
  • From: "Peltio" <peltio at trilight.zone>
  • Date: Wed, 22 Jun 2005 01:55:44 -0400 (EDT)
  • References: <d90slm$8tt$1@smc.vnet.net> <d98p6t$efu$1@smc.vnet.net>
  • Reply-to: "Peltio" <peltioNOSPAM at despammed.com.invalid>
  • Sender: owner-wri-mathgroup at wolfram.com

"Oliver Buerschaper" wrote

>>     rulen[a_, b_][d_] = a^n_*b^m_ :> d*(a^(n - 1)*b^(m - 1));
>>     rulea[a_, b_][d_] = a*b^m_ :> d*b^(m - 1);
>>     ruleb[a_, b_][d_] = a^n_*b :> d*a^(n - 1);
>>
>>     mySimplify[expr_, a_ b_ -> d_] :=
>>         (expr //. rulen[a, b][d]) /. {rulea[a, b][d], ruleb[a, b][d]}
>>
>> This only works when a and b are not "mixable", i.e. they are immediately
>> identifiable by sheer pattern matching.
>
>What do you mean by this?

I gather you want the simplification to work with a and b being functions.
So, take for example a=Sin[x] and b=1/Cos[x], and you want a b -> d
first of all
    the call to the function mySimplify[expr,Sin[x]*1/Cos[x]->d]
    will be automaticall evaluated to mySimplify[expr, Tan[x]->d]
    and this will not be evaluated further since the signature is not
    the same as that of mySimplify
moreover
    even if you define a signature for mySimplify to accept separate
    arguments, such as mySimplify[expr_, a_,b_,d_], the product of
    the two functions can turn into something that has little to do with
    them ("patternwise"). This again is the case for Sin[x] and 1/Cos[x]
and, last but not least,
    suppose you also add a signature to take care of the transformation
    of the product of a and b into c,  you should then add at least a rule
     to make c->d as in
        mySimplify[expr_, c_, { a_, b_ } -> d_] :=
            (expr //. rulen[a, b][d])
            /. {rulea[a, b][d], ruleb[a, b][d]}
            /. c -> d

Now that I think about this, there can also be problems when you work
with symbols and radicals. The substitution Sqrt[a] Sqrt[b] -> Sqrt[d]
won't work. For example:
    a=Sqrt[Sin[x]], b=Sqrt[1/Cos[x] and d=Sqrt[Tan[x]]
will have mySimplify return expr unaffected.
The square root is a well known pattern matching trap : ). So, more
rules are needed, at least with my approach.

I haven't checked the other posters' solutions but, having learnt to
appreciate their skills,  I'm confident that you will find a brilliant
solution to these shortcomings.

cheers,
Peltio
invalid address in reply to. crafty demunging required to mail me.





  • Prev by Date: Re: Re: associative arrays
  • Next by Date: Re: plot
  • Previous by thread: Re: Transformation rule problem
  • Next by thread: can anyone solve this equation?