MathGroup Archive 2003

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

Search the Archive

RE: how to change arguments of standard functions ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44979] RE: [mg44962] how to change arguments of standard functions ?
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Fri, 12 Dec 2003 04:41:15 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: Nakhova, Irina [mailto:I.Nakhova at gcal.ac.uk]
To: mathgroup at smc.vnet.net
>Sent: Thursday, December 11, 2003 11:28 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg44979] [mg44962] how to change arguments of standard functions ?
>
>
>Dear group,
>
>I need  to  implement the following function
>
>trans[pol_]:=If[PolynomialQ[pol,t],PolynomialQuotient[pol,t+t1,t]
>(t+t1)+PolynomialRemainder[pol,t+t1,t],pol]
>
>to expressions like Sin[pol] + Cos[pol] + Log[pol]. For 
>example, i want to
>get Sin[2t+t1] in the form Sin[2(t+t1)-t1]. 
>
>Can you help me with this, please.
>
>Regards,
>
>Irina
>

Perhaps you might like to try

trans[pol_] /; PolynomialQ[pol, t] := 
  PolynomialQuotient[pol, t + t1, t] (t + t1) + 
    PolynomialRemainder[pol, t + t1, t]

trans[Sin[arg_]] := Sin[trans[arg]]
trans[Cos[arg_]] := Cos[trans[arg]]
trans[Log[arg_]] := Log[trans[arg]]
trans[Unevaluated[Plus[summands__]]] := 
  Thread[Unevaluated[trans[Plus[summands]]], Plus]

?trans

Such trans is threaded over Plus, Sin, etc.
Then e.g.

In[36]:= Cos[2t + t1] // trans
Out[36]= Cos[t1 - 2 (t + t1)]

In[37]:= Sin[2t + t1] + Log[15 t + 2 t1] // trans
Out[37]= Log[-13 t1 + 15 (t + t1)] - Sin[t1 - 2 (t + t1)]

In[47]:= a t^2 + b t + c // trans
Out[47]= c - b*t1 + a*t1^2 + (t + t1)*(b + a*t - a*t1)

(But this is just a hack, you might get better answers.)


--
Hartmut Wolf


  • Prev by Date: Re: Re: motifps or equivalent for MacOS X
  • Next by Date: RE: Part assignment
  • Previous by thread: how to change arguments of standard functions ?
  • Next by thread: RE: how to change arguments of standard functions ?