File:Covariantcomponents.gif
Summary
Description |
English: Covariant and contravariant components of a vector when the basis is not orthogonal. |
Date | |
Source | https://twitter.com/j_bertolotti/status/1071417492692709376 Category:PNG created with Mathematica#Covariantcomponents.gif |
Author | Jacopo Bertolotti |
Permission (Reusing this file) |
https://twitter.com/j_bertolotti/status/1030470604418428929 |
Mathematica 11.0 code
line[p1_, p2_] := Block[{m, q}, {m, q} /. Solve[{p1[[2]] == m p1[[1]] + q, p2[[2]] == m p2[[1]] + q}, {m, q}][[1]]]; intersection[l1_, l2_] := Block[{x, y}, {x, y} /. Solve[{y == l1[[1]] x + l1[[2]], y == l2[[1]] x + l2[[2]]}, {x, y}][[1]] ]; parallel[l1_, p1_] := {l1[[1]], p1[[2]] - l1[[1]] p1[[1]]}; normal[l1_, p1_] := {-1/l1[[1]], p1[[2]] + 1/l1[[1]] p1[[1]]}; o = {0, 0}; pe1 = {1, 10^-5}/Norm[{1, 0.1}]; v = {2.1, 1}; plots = Table[ pe2 = {10^-5 + j, 1}/Norm[{10^-5 + j, 1}]; GraphicsRow[{ Graphics[{ Thick, Dashed, Gray, Line[{o, 3 pe1}], Line[{o, 3*pe2}], Line[{v, intersection[normal[line[o, pe1], v], line[o, pe1]]}], Line[{v, intersection[normal[line[o, pe2], v], line[o, pe2] ]}] , Dashing[None], Black, Arrow[{o, pe1}], Arrow[{o, pe2}], Blue, Arrow[{o, v}] , Black, Disk[o, 0.05], Disk[intersection[normal[line[o, pe2], v], line[o, pe2] ], 0.05], Disk[ intersection[normal[line[o, pe1], v], line[o, pe1] ], 0.05], Text[Style["O", Bold, FontSize -> 14], o - {0.2, 0.2}], Text[Style[ "\!\(\*SubscriptBox[OverscriptBox[\(e\), \(^\)], \(x\)]\)", Bold, FontSize -> 14], pe1 - {0, 0.15}], Text[Style[ "\!\(\*SubscriptBox[OverscriptBox[\(e\), \(^\)], \(y\)]\)", Bold, FontSize -> 14], pe2 + {0, 0.15}], Text[Style["\!\(\*SubscriptBox[\(v\), \(x\)]\)", Bold, FontSize -> 14], intersection[normal[line[o, pe1], v], line[o, pe1] ] + {0.2, 0.2}], Text[ Style["\!\(\*SubscriptBox[\(v\), \(y\)]\)", Bold, FontSize -> 14], intersection[normal[line[o, pe2], v], line[o, pe2] ] + {0.1, 0.2}], Blue, Text[Style["\!\(\*OverscriptBox[\(v\), \(\[Rule]\)]\)", Bold, FontSize -> 14], v + {0.1, 0.1}] }, PlotRange -> {{-0.5, 2.5}, {-0.5, 2}}, PlotLabel -> "Covariant components", LabelStyle -> {Black, Bold}, ImageSize -> Medium] , Graphics[{ Thick, Dashed, Gray, Line[{o, 3 pe1}], Line[{o, 3*pe2}], Line[{v, intersection[parallel[line[o, pe1], v], line[o, pe2]]}], Line[{v, intersection[parallel[line[o, pe2], v], line[o, pe1] ]}] , Dashing[None], Black, Arrow[{o, pe1}], Arrow[{o, pe2}], Blue, Arrow[{o, v}] , Black, Disk[o, 0.05], Disk[intersection[parallel[line[o, pe1], v], line[o, pe2] ], 0.05], Disk[ intersection[parallel[line[o, pe2], v], line[o, pe1] ], 0.05], Text[Style["O", Bold, FontSize -> 14], o - {0.2, 0.2}], Text[Style[ "\!\(\*SubscriptBox[OverscriptBox[\(e\), \(^\)], \(x\)]\)", Bold, FontSize -> 14], pe1 - {0, 0.15}], Text[Style[ "\!\(\*SubscriptBox[OverscriptBox[\(e\), \(^\)], \(y\)]\)", Bold, FontSize -> 14], pe2 + {0, 0.15}], Text[Style["\!\(\*SubscriptBox[\(v\), \(x\)]\)", Bold, FontSize -> 14], intersection[parallel[line[o, pe2], v], line[o, pe1] ] + {0.2, 0.2}], Text[ Style["\!\(\*SubscriptBox[\(v\), \(y\)]\)", Bold, FontSize -> 14], intersection[parallel[line[o, pe1], v], line[o, pe2] ] + {0.1, 0.2}], Blue, Text[Style["\!\(\*OverscriptBox[\(v\), \(\[Rule]\)]\)", Bold, FontSize -> 14], v + {0.1, 0.1}] }, PlotRange -> {{-0.5, 2.5}, {-0.5, 2}}, PlotLabel -> "Contravariant components", LabelStyle -> {Black, Bold}] }] , {j, 0, 1.8, 0.05}]; ListAnimate[Join[plots, Reverse@plots]]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
![]() ![]() |
This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication. |
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
|
![]() |
This file, which was originally posted to
https://twitter.com/j_bertolotti/status/1030470604418428929, was reviewed on 10 December 2018 by reviewer Ronhjones, who confirmed that it was available there under the stated license on that date. |