Last active
November 11, 2021 16:53
-
-
Save lucainnocenti/003e57bed88808adc0b7bfcce66ff028 to your computer and use it in GitHub Desktop.
Dynamically visualise dual and parseval frames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getDualBasis[vecs_List] := With[{ | |
sMatrix = Total[KroneckerProduct[#, Conjugate@#] & /@ vecs] | |
}, | |
Dot[Inverse@sMatrix, #] & /@ vecs | |
]; | |
getParsevalFrame[vecs_List] := With[{ | |
sMatrix = Total[KroneckerProduct[#, Conjugate@#] & /@ vecs] | |
}, | |
Dot[MatrixFunction[Sqrt, Inverse@sMatrix], #] & /@ vecs | |
]; | |
DynamicModule[ | |
{pts = {{1, 0}, {0, 1}, {1, 1}}}, | |
Graphics[{ | |
[email protected], {Gray, Point@{0, 0}}, | |
Dynamic[Point /@ pts], | |
(* draw labels on base vecs *) | |
Dynamic[Text[Style[#, Bold, Italic, Larger], | |
pts[[#]], {-2, -2}] & /@ Range@Length@pts], | |
Locator[Dynamic@pts[[#]], None] & /@ Range@Length@pts, | |
(* draw dual vecs *) | |
Dynamic@With[{dualVecs = getDualBasis@pts}, | |
{ | |
Text[Style[#, Bold, Italic, Orange, Larger], | |
dualVecs[[#]], {-2, -2}] & /@ Range@Length@pts, | |
Orange, {Point@#, Arrow@{{0, 0}, #}} & /@ dualVecs | |
} | |
], | |
(* draw parseval frame *) | |
Dynamic@With[{parsevalVecs = getParsevalFrame@pts}, | |
{ | |
Text[Style[#, Bold, Italic, Cyan, Larger], | |
parsevalVecs[[#]], {-2, -2}] & /@ Range@Length@pts, | |
Cyan, {Point@#, Arrow@{{0, 0}, #}} & /@ parsevalVecs | |
} | |
] | |
}, | |
PlotRange -> ConstantArray[{-2, 2}, 2], GridLines -> Automatic, | |
Frame -> True, Axes -> True | |
] | |
] |
Author
lucainnocenti
commented
Nov 11, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment