Douglas Blumeyer's RTT How-To: Difference between revisions

Cmloegcmluin (talk | contribs)
multicommas: correction
Cmloegcmluin (talk | contribs)
multicommas: add widget for calculating dual
Line 1,407: Line 1,407:
# Even terms become <span><math>+</math></span>'s and odd terms become <span><math>-</math></span>'s.
# Even terms become <span><math>+</math></span>'s and odd terms become <span><math>-</math></span>'s.


Yes, it's a lot of busywork. I could probably write a program to do it faster than I took explaining it. Maybe I will one day.
Alternatively, you can just use this Wolfram Language computable notebook, which can calculate duals for you. It's a little trickier than other Wolfram Language tools shared here. I've basically recreated the multi(co)vector form in Wolfram with a tuple type where the first element is your multi(co)vector as a list of its terms, and the second element is its grade and variance. Variance<ref>(Multi)covectors are covariant, while (multi)vectors are contravariant. This has to do with how vectors vary with respect to the system's units. Covectors vary in the same direction as the units, hence the co- prefix meaning "with", while (contra)vectors vary in the opposite direction to the units, hence the contra- prefix meaning "against".</ref> basically means which side of duality it is on. So variance is encoded via the sign of the grade, i.e. if this is a multivector, the grade is positive, and if it is a multicovector, then the grade is negative<ref>If the grade is zero, you probably don't need this tool, but it is capable of handling this case! When the grade is zero, it has no way to figure the dimensionality of the system (in other cases it calculates it based on the lenght of the multi(co)vector), so you must provide that yourself. So as a second argument, simply provide the grade and variance of the target dual. For example, if you have the multivector for JI (where nothing is tempered out), {{1}, 0}, there's no way to tell what prime limit you're in; so if you're in 5-limit, you would use dual[{{1}, 0}, -3], because you know the grade of the dual multicovector is 3 and it should be negative because multicovectors encode their variance as a negative sign on the grade here. One last point here: multi(co)vectors with grade 0 are neither covariant nor contravariant, in other words they are neither covectors nor vectors; they are simply scalars, and so you can actually call this like dual[{1, 0}, -3] if you prefer.</ref>. Again, grade is just generic rank or nullity, so it will simply be the count of brackets of your multi(co)vector.
 
{| class="wikitable"
|+Wolfram Language code ([https://www.wolframcloud.com/obj/d66b5b53-e816-42bc-b93c-05a24cf05090 try it])
!input
!output
|-
|<code>eaIndices[d_,g_] := Subsets[Range[d],{g}]</code>
 
 
<code>inversePascal[length_, g_] := If[g==0,Error,First[Association[Solve[Binomial[d, g] == length && d >= 0, d, Integers]]]]</code>
 
 
<code>eaFormToTensorForm[{w_, d_, g_}] := SymmetrizedArray[MapThread[Rule[#1,#2]&,{eaIndices[d,g],w}],ConstantArray[d,g],Antisymmetric[All]]</code>
 
 
<code>tensorFormToEaForm[{m_, d_, g_}]:= Module[{assoc},</code>
 
<code>  assoc = Association[SymmetrizedArrayRules[m]];</code>
 
<code>  Map[If[KeyExistsQ[assoc, #],assoc[#], 0]&,eaIndices[d,g]]</code>
 
<code>]</code>
 
 
<code>dual[{w_, g_}, inputDualG_:0] :=Module[{d, absG,signG, absDualG,  dualG, signTweak},</code>
 
<code>  absG = Abs[g];</code>
 
<code>  signG = Sign[g];</code>
 
<code>  d = inversePascal[Length[w], absG];</code>
 
<code>  absDualG = d - absG;</code>
 
<code>  dualG = If[g==0,inputDualG,-signG*absDualG];</code>
 
<code>  signTweak = If[signG==1&&Mod[absG(d-absG),2]==1,-1,1];</code>
 
<code>  If[g==0,{w,dualG},{signTweak*tensorFormToEaForm[{HodgeDual[eaFormToTensorForm[{w,d,absG}]],d,absDualG}], dualG}]</code>
 
<code>]</code>
 
 
<code>dual[{{107,-87,72,-49,31},4}]</code>
 
<code>dual[{{31,49,72,87,107},-1}]</code>
|{{31,49,72,87,107},-1}
{{107,-87,72,-49,31},4}
|}


=== tempered lattice fractions generated by prime combinations ===
=== tempered lattice fractions generated by prime combinations ===