Re: display of function
- To: mathgroup at smc.vnet.net
- Subject: [mg58521] Re: display of function
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Tue, 5 Jul 2005 06:34:13 -0400 (EDT)
- References: <dad7oo$t91$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello,
You are confusing two distinct kinds of Mathematica notation here.
Vectors and subscripted variables are not the same thing (at least by
default) even though vector components are often referred to using
subscript notation in conventional mathematics.
You could use either notation consistently, so lets use Mathematica
vector notation:
u[y_]:=Dot[y,p];
p={1,2,3};
y={10000,20000,30000};
u[y]
Alternatively, you may prefer the longer (less efficient) definition for
u because perhaps you really have a more complex summation than that
presented here:
u[y_] := Sum[p[[i]]*y[[i]], {i, 1, Length[y]}]
Working with subscripted variables is slightly trickier, but it is more
visually appealing. I would start with vector notation and think about
subscripted variables a bit later.
David Bailey
http://www.dbaileyconsultancy.co.uk