MathGroup Archive 2002

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

Search the Archive

Functions with vector arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36192] Functions with vector arguments
  • From: anhjunk at hotmail.com (anhjunk)
  • Date: Mon, 26 Aug 2002 04:16:15 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Some functions with vector arguments work as expected and some give
errors. I would appreciate if someone can clarify why.

First an example of a function definition that works fine :
f[u_,v_] := u.v
Calling it with f[{x1,y1},{x2,y2}] gives the expected result x1 x2 +
y1 y2.

Now an example that does not work :
g[u_,v_] := u-v
Calling it with g[{x1,y1},{x2,y2}] one would expect the answer {x1-x2,
y1-y2} but instead one gets error messages.

Why ? And how do I fix g (i.e write a function that outputs the
difference of 2 vectors).

Thanks


  • Prev by Date: Export and ImageSize
  • Next by Date: Re: Mathematica 4.2: Problem with online help.
  • Previous by thread: Re: Export and ImageSize
  • Next by thread: Re: Functions with vector arguments