MathGroup Archive 2013

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

Search the Archive

Re: Query regarding Function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130142] Re: Query regarding Function
  • From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
  • Date: Thu, 14 Mar 2013 07:12:49 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

Dear all,

Case1:  In the following code

  Clear[f,x,y]
g=Function[{x,y},x^2+2xy][b,a]

 The output is found to be  b^2+2 xy

Case2:  But for the code

 Clear[f,x,y]
g=Function[{x,y},x^2+2y][b,a]

 The output is 2 a+b^2

 Hence my query is why in case 1 x*y is not replaced by b and a whereas in case 2 it got replaced ?

Regards,
 rc

Hi, Rahul,

Mathematica understands xy as a single new symbol, and, therefore, it does not interpret it as a product. If you want it to be multiplication you should make a space between x and y.
Then it works. Compare: this is your function

Clear[f, x, y]
g = Function[{x, y}, x^2 + 2 xy][b, a]

b^2 + 2 xy

and this is the same, but with the space between x and y:

Clear[f, x, y]
g = Function[{x, y}, x^2 + 2 x y][b, a]

2 a b + b^2

However, I prefer to put the sign "*" between x and y. Since it becomes quite clear from the first glance, what is x*y. Like this:

Clear[f, x, y]
g = Function[{x, y}, x^2 + 2 x*y][b, a]

2 a b + b^2

Have fun, Alexei

 

Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone :  +352-2454-2566
Office fax:       +352-2454-3566
mobile phone:  +49 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu






  • Prev by Date: Getting an array into a C program through mathlink
  • Next by Date: Re: Noob requests help with recursive formula
  • Previous by thread: Re: Query regarding Function
  • Next by thread: Cropping image parts through list of lists