|
[Date Index]
[Thread Index]
[Author Index]
Re: vector/matrix indexed from zero
- To: mathgroup at smc.vnet.net
- Subject: [mg114692] Re: vector/matrix indexed from zero
- From: Norbert Marxer <marxer at mec.li>
- Date: Mon, 13 Dec 2010 03:52:17 -0500 (EST)
- References: <ie297c$mrj$1@smc.vnet.net>
On 12 Dez., 11:47, "Vasyl'" <vvavryc... at gmail.com> wrote:
> How to create vector in Mathematica index of which will start from
> zero.
>
> Now for x = {0, 1}, x[[1]] gives 0 and x[[2]] gives 1.
>
> I want x[[0]] = 0, x[[1]] = 1.
Hello
I would use OverVector to define a vector and Subscript to extract a
coordinate of a vector.
With the definition Subscript[x_List, n_] := x[[n + 1]] you can shift
the index of your first coordinate.
E.g. in InputForm
Subscript[x_List, n_] := x[[n + 1]]
OverVector[a] = {1, 3}; OverVector[b] = {2, 8};
{Subscript[OverVector[a], 0], Subscript[{3, 4}, 0],
Subscript[OverVector[c], 0]}
OverVector[a] . OverVector[b]
OverVector[a] . OverVector[c]
If you take the above input and transform it into StandardForm
everything looks really nice and the
functions Dot, Cross etc work with your (Over)Vectors.
Best regards
Norbert Marxer
Prev by Date:
Re: Puzzled by IntegerPart
Next by Date:
Re: Silly Problem/Resolution
Previous by thread:
Re: vector/matrix indexed from zero
Next by thread:
VectorPlot on a Circle
|