MathGroup Archive 2009

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

Search the Archive

Re: using predefined expressions in functions [newbie

  • To: mathgroup at
  • Subject: [mg100211] Re: [mg100167] using predefined expressions in functions [newbie
  • From: Bob Hanlon <hanlonr at>
  • Date: Thu, 28 May 2009 04:28:50 -0400 (EDT)
  • Reply-to: hanlonr at

R1 := {x1, y1, z1}
R2 := {x2, y2, z2}

Don' t use SetDelayed in definition of f

f[x1_, y1_, z1_, x2_, y2_, z2_] = R1.R2;

f[1, 2, 3, 4, 5, 6]


Bob Hanlon

---- ChangMo <nichthierwohne at> wrote: 


I've been trying to write a function using some predefined
expressions, but the function assignment seems to understand the
symbols in the expressions as literals. eg.,

R1 := {x1,y1,z1}
R2 := {x2,y2,z2}
f[x1_,y1_,z1_,x2_,y2_,z2_] := R1 . R2


gives the output
x1 x2 + y1 y2 + z1 z2
instead of
32 ( = 1*4 + 2*5 + 3*6 )

Can anyone help me with this?  Thanks for your attention.


  • Prev by Date: Re: constants
  • Next by Date: Re: Shade area between two polar curves
  • Previous by thread: Re: Tube in ParametricPlot3D with too many details
  • Next by thread: simultaneous equations - eliminating variables and solving