Tag Info

New answers tagged

1

As another work around, you can create a function idx[i_]:=i+1 and then say v[[idx[0]]] This is similar to indirect addressing. Also, if it's not important to be able to treat the objects as arrays, you can simply do something like v[0] = something where the single [bracket] sets a DownValue.


4

This is comparable to Option 1 from Nasser, but a bit simpler to implement. Try redefining the Subscript symbol to a function, i.e. Subscript[a_,b_]:=a[[b+1]]; c=Range[10]; Enter c then "ctrl -" for the subscript shortcut then your index number. Execute to return the zero indexed list value. This get's the same simple input syntax as Nasser's answer ...


4

Two possible options: option 1 ClearAll[v] Needs["Notation`"] len = 5; v = RandomReal[{0, 1}, len]; And now add notation to shift the indes Notation[NotationTemplateTag[ Subscript[v, i_]] \[DoubleLongLeftRightArrow] NotationTemplateTag[v[[(i_) + 1]]]] The above looks like this in the notebook And now use the subscripted version for ...


2

If I understood you correctly, this set of definitions would do what you wrote: ClearAll[cut] cutFunction[miller_, c_] := miller.{x, y, z} + c >= 0 cutSimplify[expr_] := Simplify[expr /. cut -> cutFunction] cut /: HoldPattern[Times[cut[m_, c_], s_]] /; s > 0 := cut[m, s c]; cut /: HoldPattern[Times[cut[m_, c_], s_]] /; s < 0 := cut[-m, s c]; ...



Top 50 recent answers are included