Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

using predefined expressions in functions [newbie question]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100167] using predefined expressions in functions [newbie question]
  • From: ChangMo <nichthierwohne at gmail.com>
  • Date: Wed, 27 May 2009 04:05:31 -0400 (EDT)

Hi,

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.,

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

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

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.


-ChangMo


  • Prev by Date: Re: Animated Bubble Chart
  • Next by Date: constants
  • Previous by thread: Re: list manipulation
  • Next by thread: Re: using predefined expressions in functions [newbie