MathGroup Archive 2008

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

Search the Archive

RE: How to substitute a function?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94128] RE: [mg94082] How to substitute a function?
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 5 Dec 2008 05:33:28 -0500 (EST)
  • References: <29071960.1228395614492.JavaMail.root@m02>

Perhaps your 'miracle' answer was all too typical of miracles.

Try this:

expr = \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(y[x]\)\) + a*y[x]^2
expr/.y->Function[x,f[x]Exp[-x]]//Simplify

giving...

a y[x]^2+(y^\[Prime])[x]
E^(-2 x) (-E^x f[x]+a f[x]^2+E^x (f^\[Prime])[x])


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  

From: Alexei Boulbitch [mailto:Alexei.Boulbitch at iee.lu]

Dear crew,

I faced a difficulty when trying to substitute a newly represented
function into an expression containing a sum of differential and
algebraic terms. The difficulty is namely, that Mathematica 6
substitutes the new representation into the algebraic, but not into the
differential part. For example:

(* This is the definition of a simple example of such an expression *)


expr = \!\(
\*SubscriptBox[\(\[PartialD]\), \(x\)]\ \(y[x]\)\) + a*y[x]^2;

(* Here I substitute a new representation of the function  into the \
above expression *)
(* What I expect to get is the following expression: -Exp[-x]*f[x] + \
Exp[-x]*f=B4[x] + a \[ExponentialE]^(-2 x) f[x]^2  *)
(* Instead I get something else. Please have a look and check:  *)
expr /. y[x] -> Exp[-x]*f[x]



(* This is another approach I could think of with even worse result. *)
\

(* Note however, that within this approach a miracle happened: once \
it *)
(* worked as expected (i.e. the substitution of both terms has been \
performed as desired, but only once *)

FullSimplify[expr, y[x] == Exp[-x]*f[x]]


Do you have idea of how to instruct Mathematica to make the substitution
everywhere?

Thank you in advance, Alexei

--
Alexei Boulbitch, Dr., Habil.
Senior Scientist

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg

Phone: +352 2454 2566
Fax:   +352 2454 3566

Website: www.iee.lu

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended =
recipient
and have received this e-mail in error, you are hereby notified that any
review, copying or distribution of it is strictly prohibited. Please =
inform
us immediately and destroy the original transmittal from your system. =
Thank
you for your co-operation.






  • Prev by Date: Re: Re: Copying text out of mathematica
  • Next by Date: Re: How to substitute a function?
  • Previous by thread: Re: How to substitute a function?
  • Next by thread: Re: How to substitute a function?