rules for using functions as basis vectors
- To: mathgroup at smc.vnet.net
- Subject: [mg67064] rules for using functions as basis vectors
- From: Kenny Stephens <kstephens at hsutx.edu>
- Date: Thu, 8 Jun 2006 04:53:58 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I am trying to establish some rules to use a triad of functions as a triad of basis vectors (i.e., Frenet-Seret formalism). I have achieved most of the desired functionality but I can not get Mathematica to properly expand dot products across parantheses. Here is my code. (* define the tangent vector of the curve r[u] *) r /: D[r[u_], u_] := t[u]; (* define the dot product relations between the triad vectors *) {t /: t[u_].t[u_] := 1, t /: t[u_].n[u_] := 0, t /: t[u_].b[u_] := 0, n /: n[u_].t[u_] := 0, n /: n[u_].n[u_] := 1, n /: n[u_].b[u_] := 0, b /: b[u_].t[u_] := 0, b /: b[u_].n[u_] := 0, b /: b[u_].b[u_] := 1}; (* define the Frenet-Seret relations *) {Derivative[1][t][u_] := \[Kappa][u] n[u], Derivative[1][n][u_] := \[Tau][u] b[u] - \[Kappa][u] t[u], Derivative[1][b][u_] := -\[Tau][u] n[u]}; (* how to distribute the triad vectors across multiplication *) {b /: Dot[b[u_], Times[a_, f_]] := Dot[b[u], ExpandAll[Times[a, f]]], t /: Dot[t[u_], Times[a_, f_]] := Dot[t[u], ExpandAll[Times[a, f]]], n /: Dot[n[u_], Times[a_, f_]] := Dot[n[u], ExpandAll[Times[a, f]]]}; (* how to distribute the dot product across additions *) {b /: Dot[b[u_], Plus[y_, z_]] := Dot[b[u], ExpandAll[y]] + Dot[b[u], ExpandAll[z]], n /: Dot[n[u_], Plus[y_, z_]] := Dot[n[u], ExpandAll[y]] + Dot[n[u], ExpandAll[z]], t /: Dot[t[u_], Plus[y_, z_]] := Dot[t[u], ExpandAll[y]] + Dot[t[u], ExpandAll[z]]}; (* how to neglect the curvature and torsion from dot products *) {b /: Dot[b[u_], \[Tau][u_]] := 0, b /: Dot[\[Tau][u_], b[u_]] := 0, t /: Dot[t[u_], \[Tau][u_]] := 0, t /: Dot[\[Tau][u_], t[u_]] := 0, n /: Dot[n[u_], \[Tau][u_]] := 0, n /: Dot[\[Tau][u_], n[u_]] := 0}; {b /: Dot[b[u_], \[Kappa][u_]] := 0, b /: Dot[\[Kappa][u_], b[u_]] := 0, t /: Dot[t[u_], \[Kappa][u_]] := 0, t /: Dot[\[Kappa][u_], t[u_]] := 0, n /: Dot[n[u_], \[Kappa][u_]] := 0, n /: Dot[\[Kappa][u_], n[u_]] :=0}; (* how to distribute dot products across multiplication of several *) (* terms; this is necessary to avoid exceeding iteration limits *) {b /: Dot[b[u_], Times[a_, b[u_], g_[u_]]] := a g[u] b[u].b[u], b /: Dot[b[u_], Times[a_, t[u_], g_[u_]]] := a g[u] b[u].t[u], b /: Dot[b[u_], Times[a_, n[u_], g_[u_]]] := a g[u] b[u].n[u]}; {t /: Dot[t[u_], Times[a_, b[u_], g_[u_]]] := a g[u] t[u].b[u], t /: Dot[t[u_], Times[a_, t[u_], g_[u_]]] := a g[u] t[u].t[u], t /: Dot[t[u_], Times[a_, n[u_], g_[u_]]] := a g[u] t[u].n[u]}; {n /: Dot[n[u_], Times[a_, b[u_], g_[u_]]] := a g[u] n[u].b[u], n /: Dot[n[u_], Times[a_, t[u_], g_[u_]]] := a g[u] n[u].t[u], n /: Dot[n[u_], Times[a_, n[u_], g_[u_]]] := a g[u] n[u].n[u]}; Now the following expression works (copied straight from Mathematica): \!\(b[u\_1] . \( (t[u\_1] - n[u\_1]\ u\_3\ \[Tau][u\_1] + u\_2\ \((\(-t[u\_1]\)\ \[Kappa][u\_1] + b[u\_1]\ \[Tau][u\_1]) \))\) \) giving the correct result \!\(u\_2\ \[Tau][u\_1]\) However, exchanging the order of the arguments to the dot product does not work (having b[u\_1] on the right side of the dot product instead of the left). Mathematica simply returns the input. Furthermore, if one dots the argument in parantheses with itself, the input is likewise returned. What am I missing? Any suggestions on how to get this to work would be greatly appreciated. Thanks.