This is recursive even in standard maths notation (i.e. completely independent of Mathematica) if the left hand side v would be the same symbol as the $v$ in any $v_i$ on the right hand side.
–
István ZacharMar 15 '12 at 12:45

@IstvánZachar How so? I'm curious -- could you explain what you mean a bit more?
–
Andrew MacFieMar 15 '12 at 15:52

@AndrewMacFie: if you assume that the subscript operator is a function, which takes $v$ as an argument (like Part, $sin$, or any function $f$), then writing $v = v_i$ equals writing $v = f(v)$ which is recursive definition (if $=$ stands for assignment and not for testing). Just like @Helen said it.
–
István ZacharMar 15 '12 at 16:19

I hesitated to post this as low-level monkeying can break the system in unexpected, serious, and subtle ways. Nevertheless, since other options have been presented, and I believe that $PreRead is fairly safe as it does not apply to internal operations, I shall.

Actually, I decided the OverVector solution by @Brett Champion is not a good idea after all. The reason is that it deceives you into thinking you can safely distinguish between the vector variable $\vec{v}$ and the variable v. This is not the case: set v = 7 after defining OverVector[v] with its three components, and you lose the vector definition because now OverVector[v] will return OverVector[7].

So my conclusion is that I would definitely stick with the following approach which has worked well for me in the past (the rest is a slightly edited version of my original post):

If you're doing tensor analysis and need symbolic manipulations where the vector components are functions such as $v = \{v_1(x,y,z), v_2(x,y,z), v_3(x,y,z)\}$, you could also make use of the following:

v = Through[Array[Subscript["v", #] &, 3][x, y, z]]

The output is $\{v_1[x,y,z],v_2[x,y,z],v_3[x,y,z]\}$. These can be used in symbolic manipulations: You can now do operations on the components of v, such as D[v[[1]], x], or on the vector v as a whole, such as D[v,x]. In tensor analysis, these symbolically defined components are what you need most. But you can also assign specific functions or constants to these components:

If I were to assign, say, Subscript["v", 1][x, y, z] = x^2, this would define SubValues for the Subscript operator. The latter is similar to OverVector in that it has no pre-defined meaning in Mathematica, see "Operators without Built-in Meanings" in the documentation. The recursion problem is avoided by making the component names into strings, whereas the vector name is a symbol.

To see what other subscripted variables are defined, type SubValues[Subscript] to get variables indexed by [x,y,z] as above, or DownValues[Subscript] to find subscripted variables such as Subscript["v",0] that aren't functions of x,y,z.

my recipe allows you to retain simple notation for your vectors (assuming that you'll mostly be typing their names, not the names of the components).

Edit

In response to the comment by @murray let me add that if you don't like the output with its verbose component form for your vector v, it is always possible to add rules that format the results in a wide variety of ways. For example, assuming my above template for defining vectors, you could define the following rule:

Then compare the output of v and v/.nice. The latter just replaces the list of components by the string name which all components have in common (which is also the name of the vector symbol v). For more on how to work with these objects, you may want to look at this MathGroup post.

There's one trouble with the OverVector solution: you cannot then directly have the stacked notation of the v with the right-vector arrow in it in an evaluated result; rather, that will automatically be replaced by the list of subscripted elements. What's missing, it seems, is an easy-to-use way to have your cake and eat it too: to use the over-vector notation freely, yet get coordinates for the vectors as needed. But I'm not sure what the design should look like overall.
–
murrayMar 15 '12 at 21:33

If I understand your comment correctly, that's independent of the subscripts issue. It is a question of defining a format or rule such that the component-form output is printed as a single variable if possible. I'll add a remark on this to my answer.
–
JensMar 16 '12 at 0:23

I don't understand this use of Notation. If I evaluate the three lines as shown in the block of code I get an infinite recursion. If I do it one line at a time, using the Notation Palette to enter the Symbolize... expression, I get an error that the pattern v_ is too general.
–
murrayMar 15 '12 at 21:38

What version and system do you have. Ever since I first used Symbolize (~10 years ago?) I have always used subscript underscore precisely to make it general. When you say you evaluate the 3 lines in the code block it could be that the process of cutting and pasting has introduced some errors. Generally to use Symbolize you need to use the palette to ensure that it works.
–
Mike HoneychurchMar 15 '12 at 21:42

I'm using Mathematica 8.0.4 under Mac OS X. I $did$ try the three inputs you show as In[1], In[2], and In[3] precisely because I'm wary of using the Notation package in any way except by means of its palette. And for the input Symbolize[v_] I get the error message: Symbolize::ptogen: "The pattern v_ appearing in the symbolize statement Symbolize[\!\(Notation``Private``identityForm[\"v_\"]\)] is too general to be used."
–
murrayMar 16 '12 at 3:32

1

@murray it is subscript underscore, not underscore. i.e. the underscore is a subscript, in other words it is a subscript pattern. Enter "v" then "Control _", this will create the subscript template, now enter _ as the subscript. Alternatively you could paste Symbolize[ParsedBoxWrapper[SubscriptBox["v", "_"]]] into a cell and Convert To > StandardForm.
–
Mike HoneychurchMar 16 '12 at 4:45

Got it now, thanks @Mike Honeychurch. But I sympathize with the original poster: this seems like a roundabout (if necessary) way to do this in Mathematica, given the basic design of the language.
–
murrayMar 16 '12 at 14:28

Mathematica is a registered trademark of Wolfram Research, Inc. While the mark is used herein with the limited permission of Wolfram Research, Stack Exchange and this site disclaim all affiliation therewith.