I wish to write a function that accepts two lists. The 1st argument is a list of lists, holding the components of a several vectors. Ex.: comp = {{a, b}, {c, d}}
. The 2nd argument would be a list of vector names, as in names = {v1, v2}
.
The function would have the form myVectors[comp_List, names_List]
, and after a call of myVector[comp, names]
(values as above), OverVector[v1]
and OverVector[v2]
should be symbols, with {a, b}
and {c, d}
assigned to them.
The problem I have is in doing programmatic assignment of the vectors {a, b}
and {c, d}
to OverVector[v1]
and OverVector[v2]
, respectively.
This is what I tried so far, without success (example for the assignment to OverVector[v2]
):
Needs["Notation`"]
Symbolize[ParsedBoxWrapper[OverscriptBox[a_, "\[RightVector]"]]]
names = {v1, v2}
name = ToString[names[[2]], InputForm]
ToExpression[
ToString[OverscriptBox[name, "\[RightVector]"], StandardForm] <>
"=" <> "{c,d}"]
The result is an error message:
Set::write: Tag OverscriptBox in OverscriptBox[v2,[RightVector]] is Protected. >>
What should I do to make assignment of {c, d}
to OverVector[v2]
and {a, b}
to OverVector[v1]
work?
v2\[UnderBracket]Overscript\[UnderBracket]RightVector
looks the closest, but only works after initial assignment. $\endgroup$