घातीय रूप से बेहतर हुई rotation तकनीक (2022)
(thenumb.at)- 3D rotations में हर representation की अपनी ताकत होती है: point transformation के लिए rotation matrix सुविधाजनक है, लेकिन interpolation, composition और averaging के लिए अलग tools चाहिए
- Euler angles इंसानों के लिए संभालना आसान हैं, लेकिन gimbal lock, non-constant angular velocity, और linear interpolation में shortest path छूट जाने जैसी समस्याएँ हो सकती हैं
- unit quaternion slerp के जरिए constant-speed shortest-path interpolation देता है, लेकिन यह vector space नहीं है, इसलिए direct authoring, scalar multiplication और averaging सहज नहीं लगते
- exponential/logarithmic maps axis/angle vector और rotation matrix को जोड़ते हैं, जिससे
R(t) = exp(t log(R1 R0^-1)) R0के रूप में 2D और 3D shortest-path interpolation बनाया जा सकता है - कई rotations का average सिर्फ axis/angle average से निकालने पर catastrophic cancellation हो सकता है; Karcher mean squared angular distances के sum को minimize करने वाली rotation को iteratively खोजकर ज्यादा consistent परिणाम देता है
rotation representations के फायदे और नुकसान
- 3D rotations के लिए कई representations हैं, और transformation, authoring, interpolation या averaging—आप क्या करना चाहते हैं—इसके आधार पर सही चुनाव बदलता है
-
rotation matrix
- सबसे direct linear algebra representation, positive determinant वाली orthonormal 3x3 matrix है
- rotation matrix के तीन columns बताते हैं कि rotation के बाद x, y, z axes कहाँ जाते हैं
- point transformation को matrix multiplication से किया जा सकता है, और अन्य linear transformations के साथ भी matrix multiplication से compose किया जा सकता है
- screen पर draw करते समय rotation matrix इस्तेमाल करने का कारण यह है कि world-space से screen तक points ले जाने के लिए सिर्फ एक matrix multiplication चाहिए होता है
- rotation matrix vector space नहीं है, इसलिए दो rotation matrices को जोड़ने पर फिर से rotation matrix नहीं मिलती
- दो rotation matrices को linearly interpolate करने पर rotation के साथ scaling भी मिल सकती है
-
Euler angles
- Euler angles x, y, z axes के लिए तीन rotations specify करते हैं, और इन्हें pitch, yaw, roll भी कहा जाता है
- तीन component rotations को लागू करने का order convention के अनुसार बदलता है; उदाहरण में x, y, z order इस्तेमाल होता है
- इंसानों के लिए समझना आसान है और rotation authoring में अक्सर इस्तेमाल होते हैं, लेकिन simple interpolation अनचाहे परिणाम दे सकता है
- किसी एक component rotation की वजह से बाकी दो rotation axes parallel हो जाना gimbal lock कहलाता है और यह singularity है
- singularity पर locked दो angles में से किसी को भी बदलने से वही output rotation बन सकती है
- अगर interpolation path singularity तक पहुँच जाए, तो current position को represent करने की degrees of freedom बढ़ जाती हैं, और आगे बढ़ने के लिए कोई arbitrary representation चुनने पर output interpolation discontinuous हो सकता है
- हर component angle cyclic होता है, इसलिए linear interpolation हमेशा दो rotations के बीच shortest path नहीं चुनता
- अगर path singularity से नहीं गुजरता तो interpolation smooth होता है, और अगर “straight up” और “straight down” represent करने की जरूरत नहीं है तो सीमाओं को workaround किया जा सकता है
-
Quaternions
- unit quaternion rotation composition और interpolation के standard tool के रूप में इस्तेमाल होता है
- spherical linear interpolation, यानी slerp, दो quaternions के बीच constant-speed shortest path चुनता है
- unit quaternion भी vector space नहीं है, इंसानों के लिए direct authoring मुश्किल है, और interpolation में computation cost लग सकती है
- scalar multiplication या averaging को लेकर भी intuitive concept की कमी है
- quaternion rotation space को double-cover करता है, इसलिए कुछ स्थितियों में
Q(1)-Q1तक जा सकता है
-
Axis/angle
- axis/angle rotation को real 3D vector से represent किया जाता है
- vector की direction rotation axis बताती है, और magnitude उस axis के लिए rotation angle specify करता है
- इसे
θuके रूप में लिखा जाता है;uunit vector है औरθrotation angle है - 3D vector होने के कारण यह vector space बनाता है, इसलिए addition, scaling और interpolation संभव हैं
- दो axis/angle rotations को linearly interpolate करने पर smooth और constant angular velocity मिल सकती है
- हालांकि target rotation को किस axis/angle representation में specify किया गया है, इस पर निर्भर करते हुए linear interpolation shortest path नहीं चुन सकता
- quaternion की तरह axis/angle vector भी rotation space को double-cover करता है
exponential map और logarithmic map
- अगर अलग-अलग rotation representations के बीच जरूरत के अनुसार आ-जा सकें, तो हर representation की खूबियों को साथ में इस्तेमाल किया जा सकता है
- final transformation के लिए rotation matrix चाहिए, इसलिए matrix को canonical form मानते हैं
- exponential map वह function है जो rotation object लेकर equivalent rotation matrix लौटाता है
- logarithmic map वह corresponding function है जो rotation matrix लेकर वापस rotation object देता है
- यहाँ rotation matrix और axis/angle vector के बीच आने-जाने वाले
expऔरlogmaps की बात की गई है
2D axis/angle से शुरू होने वाली intuition
- 2D में rotation axis केवल एक होता है, जो plane के बाहर की ओर होता है, इसलिए axis/angle rotation को सिर्फ एक angle
θसे represent किया जा सकता है - 2D point
pकोθसे rotate किया गयाpθइस तरह लिखा जा सकता हैpθ = p cosθ + Jp sinθJवह matrix है जो 2D vector को 90 degrees rotate करती है
J[[0, -1], [1, 0]]है, औरJ² = -Iहोने के कारण इसे दो बार apply करने पर 180-degree rotation मिलता है- इस expression को expand करने पर standard 2D rotation matrix
[[cosθ, -sinθ], [sinθ, cosθ]]मिलती है
2D exponential map और logarithmic map
- complex numbers के Euler formula
e^(iθ) = cosθ + i sinθमें जैसेiquarter turn की भूमिका निभाता है, 2D matrix expression मेंJवही भूमिका निभाता है - exponential function की Taylor series में matrix
A = θJडालने पर matrix addition, multiplication और scaling से वही calculation की जा सकती है - expansion के बाद
sinθऔरcosθकी Taylor series दिखाई देती हैं, और यह expression मिलता हैe^(θJ) = [[cosθ, -sinθ], [sinθ, cosθ]]
- इसलिए 2D exponential map angle
θको corresponding rotation matrix में बदलता है - logarithmic map को exponential map के inverse के रूप में define किया जाता है
R = exp(θJ)हो तोlog(R) = θJθ = atan2(R21, R11)से restore किया जा सकता है
- exponential map injective नहीं है
exp(θJ) = exp((θ + 2π)J)है, इसलिए एक पूरा turn जोड़ने पर भी वही rotation matrix मिलती है- logarithmic map को इस तरह define किया जाता है कि वह उस rotation matrix से corresponding सबसे छोटा angle लौटाए
atan2इस definition को implement करता है
exp/log आधारित interpolation
- दो 2D rotation angles
θ0,θ1को सीधे linearly interpolate करके rotation matrix बनाई जा सकती है - लेकिन अगर
θ0औरθ1,πसे ज्यादा दूर हैं, तो angles की cyclic प्रकृति reflect नहीं होती और लंबा path चुना जाता है - exp/log आधारित interpolation दो rotation matrices
R0,R1से सीधे movement rotation compute करता हैR1 R0^-1वह rotation है जो पहलेR0को undo करता है और फिरR1apply करता हैlog(R1 R0^-1)R0सेR1तक जाने का सबसे छोटा angle देता है- इस axis/angle rotation को
tसे scale करकेexpके जरिए फिर matrix में बदलते हैं
- final interpolation formula यह है
R(t) = exp(t log(R1 R0^-1)) R0R(0) = R0,R(1) = R1
- 2D में angle difference directly check किया जा सकता है, लेकिन यह method बिना बदलाव के 3D और arbitrary dimensions में generalize होता है
3D axis/angle और skew-symmetric matrix
- 3D में भी axis/angle
θuको exponentiate करके rotation matrix बनाई जा सकती है - मुख्य बात unit vector
uको axis मानकर quarter turn transformation ढूँढना है - cross product
u × pकोuऔरpसे बने plane के perpendicular vector के रूप में define किया जाता है, लेकिन इसेpकोuके perpendicular plane पर project किए गएp⊥के quarter turn के रूप में भी समझा जा सकता है u × pजैसा result देने वाली matrixûबनाई जा सकती हैû = [[0, -uz, uy], [uz, 0, -ux], [-uy, ux, 0]]ûp = u × p
ûᵀ = -ûहोने के कारणûskew-symmetric matrix है- 2D का
Jभी skew-symmetric है और 2D cross product को represent करता है, इसलिए वही structure आगे चलता है - skew-symmetric matrices का sum और scalar multiplication भी skew-symmetric होता है, इसलिए axis/angle vector space की properties इस matrix representation में भी बनी रहती हैं
- identity
û^(k+2) = -û^kइस geometric interpretation से आती है कि cross product को तीन बार apply करने परp⊥के तीन quarter turns होते हैं, जो negative quarter turn के बराबर है
3D exponential map: Rodrigues’ formula
- axis/angle rotation
θuसेθûबनाकर उसे exponentiate करने पर 3D rotation matrix मिलती है - Taylor series और
û^(k+2) = -û^kका इस्तेमाल करने पर यह formula निकलता हैe^(θû) = I + sin(θ)û + (1 - cos(θ))û²
- यह formula Rodrigues’ formula के नाम से जाना जाता है
θ = 0होने परe^(0û)p = pहोता है, यानी point जस का तस रहता हैθ = π/2होने परu × p + p∥मिलता है, यानी quarter rotation होता हैθ = πहोने पर-p⊥ + p∥मिलता है, यानी half rotation होता है- यह matrix orthonormal है
AᵀA = Icondition कोûᵀ = -ûऔरû^(k+2) = -û^kसे verify किया जाता है
- determinant
θ = 0पर 1 है, determinant कभी 0 नहीं होता, औरexpθऔरûके लिए continuous है, इसलिए यह negative नहीं हो सकता - इसलिए
exp(θû)3D rotation matrix है
3D logarithmic map
- 3D exponential map भी injective नहीं है, इसलिए 3D logarithmic map को इस तरह define किया जाता है कि वह दी गई matrix के corresponding सबसे छोटे magnitude की axis/angle rotation लौटाए
R = exp(θû) = I + sin(θ)û + (1 - cos(θ))û²में trace लेने पर rotation angle मिल सकता है- trace diagonal sum है
tr(I) = 3ûskew-symmetric है, इसलिए diagonal sum 0 हैtr(û²) = -2है- इसलिए
tr(R) = 1 + 2cosθ θ = arccos((tr(R) - 1) / 2)
- rotation axis को
Rको antisymmetrize करके restore किया जाता हैR - Rᵀ = 2 sin(θ)ûû = (R - Rᵀ) / (2 sinθ)u = 1/(2 sinθ) [R32 - R23, R13 - R31, R21 - R12]ᵀ
- इस तरह 3D rotation matrix से axis/angle में लौटने वाला पूरा logarithmic map complete होता है
3D interpolation के परिणाम
- 3D में भी 2D वाला interpolation formula वैसे ही लागू होता है
R(t) = exp(t log(R1 R0^-1)) R0
- यह interpolation axis/angle rotation की खूबियाँ बनाए रखते हुए हमेशा shortest path चुनता है
- Euler angles से वही example smooth नहीं दिख सकता
कई rotations का average
- quaternion इस्तेमाल करने पर अच्छा interpolation मिल सकता है, इसलिए exp/log matrix math के बिना भी interpolation problem हल हो सकती है
- axis/angle rotation से आसान होने वाले कामों में से एक है कई rotation matrices का average
- सबसे simple तरीका है हर matrix को axis/angle में बदलना, vectors का average निकालना, और फिर वापस convert करना
- यह method valid है, लेकिन unintuitive behavior पैदा कर सकता है
- खास तौर पर axis/angle vectors को जोड़ने पर catastrophic cancellation हो सकता है
- उदाहरण में
[π, 0, 0]और[-π, 0, 0]का average लेने पर 0 बन जाता है - दोनों values equivalent rotations हैं, लेकिन average result 0 उन दोनों rotations को represent नहीं करता
- उदाहरण में
Karcher mean
- plane में points का average उन सभी points तक squared distances के कुल योग को minimize करने वाले point के रूप में देखा जा सकता है
- इसे iterative optimization से खोजने की procedure यह है
- initial estimate
x̄ ∈ R²चुनें - हर point से estimate तक की translation
ui = xi - x̄compute करें - vector average
u = (1/n) Σ uiनिकालें x̄ = x̄ + τuसे average direction में move करें- जब तक
|u| > εहो, repeat करें
- initial estimate
- यही idea rotations
R0, ..., Rnपर लागू किया जा सकता है- initial estimated rotation
R̄ ∈ R^(3×3)चुनें - हर matrix के लिए estimate से उस rotation तक का axis/angle
ui = log(Ri R̄^-1)compute करें - vector average
u = (1/n) Σ uiनिकालें R̄ = exp(τu) R̄से average rotation direction में move करें- जब तक
|u| > εहो, repeat करें
- initial estimated rotation
- इस algorithm का result Karcher mean है
- Karcher mean वह rotation है जो बाकी सभी rotations तक squared angular distances को minimize करता है
- यह catastrophic cancellation से प्रभावित नहीं होता और हमेशा non-zero intermediate rotation पर converge करता है
- simple axis/angle average और Karcher mean के results अक्सर मिलते-जुलते होते हैं, लेकिन Karcher mean ज्यादा consistent behavior दिखाता है
Quaternion और exp/log का संबंध
- यह हिस्सा quaternion knowledge मानकर चलता है
- जैसे complex number exponentiation skew-symmetric 2D matrix exponentiation के equivalent था, वैसे ही quaternion exponentiation skew-symmetric 3D matrix exponentiation के equivalent है
- 2D में axis/angle rotation
θसे pure-imaginary complex numberiθबनाकर exponentiate करते हैंe^(iθ) = cosθ + i sinθ- result ऐसा complex number है जो point से multiply करने पर उसे
θसे rotate करता है - norm हमेशा 1 होता है, इसलिए 2D rotation को unit-norm complex number से represent किया जा सकता है
- 3D में axis/angle rotation vector
uसे pure-imaginary quaternionq = ux i + uy j + uz kबनाया जा सकता है - quaternion multiplication rules का इस्तेमाल करने पर
q² = -||q||² = -θ²बनता है, जो skew-symmetric matrix में इस्तेमाल हुई identity जैसा है - exponentiation का result यह है
e^q = cosθ + (q/θ) sinθ- यह 2D formula से लगभग समान है, लेकिन imaginary axis एक नहीं बल्कि तीन हैं
- 3D axis/angle rotation unit-norm quaternion में convert होती है
- अगर rotation matrix की जरूरत नहीं है, तो quaternion exponential map compute करने के लिए आसान option है
- quaternion logarithmic map भी simple है
θ = arccos(Re(q))u = Im(q) / sinθ
- quaternion
qसे pointpको rotate करने के लिए conjugationq p q^-1compute करते हैं- point को pure-imaginary quaternion के रूप में represent करते हैं, जहाँ
p = px i + py j + pz k - conjugation तकनीकी रूप से
uaxis के around2θसे rotate करता है, इसलिए शुरुआत में|u| = θ/2रखना होता है
- point को pure-imaginary quaternion के रूप में represent करते हैं, जहाँ
आगे पढ़ने के लिए
- quaternion सीखने के material के रूप में eater.net के quaternions देखे जा सकते हैं
- geometric algebra ज्यादा intuitive क्यों है, यह Marc ten Bosch के लेख में बताया गया है
- 3D rotation की algebraic structure SO(3) सीखने से axis/angle, quaternion और double-cover संबंध बेहतर समझ में आते हैं
- संबंधित video के रूप में SO(3), SU(2), quaternion और axis/angle संबंध को visually explain करने वाला video है
- SO(3) Wikipedia page axis/angle, topology, SU(2), quaternion और Lie algebra से connections को cover करता है
- skew-symmetric matrices का vector space,
SO(3)से corresponding Lie algebra so(3) बनाता है
1 टिप्पणियां
Hacker News की रायें
Lie group/Lie algebra correspondence उन सबसे शानदार concepts में से एक है जो काश स्कूल में पढ़ाया गया होता। यह लेख में बताए गए exponential map और logarithm map जैसा ही है, लेकिन कहीं ज़्यादा reusable रूप में सामने आता है
अगर 3D rotation जैसी किसी abstract चीज़ को, coordinate की बारीकियों में उलझे बिना, पकड़ें तो वही Lie group है; और उससे अच्छी तरह काम करने वाला coordinate representation निकालें तो संबंधित Lie algebra बनता है
फिर coordinates और abstract object के बीच आना-जाना, composition करना आदि लगभग मुफ्त में मिल जाते हैं, और engineering में अक्सर मिलने वाले मामलों में interpolation और average भी काफ़ी reasonable तरीके से संभल जाते हैं
अगर किसी problem को Lie groups के combination के रूप में व्यक्त किया जा सके, तो हर algebra क्या है यह खोजकर, खुद करने पर लंबा लगने वाला बहुत-सा काम बचाया जा सकता है
यहाँ object में smooth change की अवधारणा और थोड़ी अतिरिक्त structure होनी चाहिए, और आने-जाने की प्रक्रिया में connected components की समस्या भी आ सकती है, लेकिन यही वजह है कि पहले से ज्ञात results उधार लेकर इस्तेमाल करना अच्छा रहता है
एक लंबा हफ्ता लगभग खत्म होने को है, और slider से गाय को rotate करना ठीक वही break था जिसकी जरूरत थी
लंबे समय से शिकायत रही है कि बहुत-से 3D software rotation के लिए Arcball interface इस्तेमाल नहीं करते
Autodesk के products 3DSmax और Maya इसे इस्तेमाल करते हैं, लेकिन Blender और OpenSCAD नहीं; और Roblox में काम करते समय भी मैं PM को मना नहीं पाया, क्योंकि users मौजूदा तरीके से भी काम चला लेते हैं
Arcball quaternion-based है और interpolation के लिए exponential functions इस्तेमाल करता है; एक ही drag में कोई भी rotation संभव है, gimbal lock नहीं होता, और closed loop बनाते हुए drag करने पर वह शुरुआती position पर वापस आ जाता है
इसे mathematically इस fact से prove किया जा सकता है कि unit quaternions, SO(3) का double cover होते हैं; यह कुछ वैसा ही है जैसे circle पर rotations को unit complex numbers ठीक-ठीक represent करते हैं
छूकर आज़माने लायक quaternion/Arcball reference implementation: https://romankogan.net/math/arcball_js/index.html
Code बहुत-सी comments वाला Java है, और Processing library को ProcessingJS के जरिए JavaScript में चलाने के रूप में है
हाथ और शरीर, दिमाग से पहले quaternions को समझ सकते हैं, इसलिए अगर आप 3D software बना रहे हैं तो अच्छा होगा कि यह तरीका अपनाएँ
Arcball: http://courses.cms.caltech.edu/cs171/assignments/hw3/hw3-not...
rotation के लिए quaternions: https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotati...
Processing में Arcball: https://romankogan.net/math/arcball_js/index.html
अभी mobile पर देख रहा हूँ, और https://asliceofrendering.com/camera/2019/11/30/ArcballCamer... ने Arcball समझने में मदद की
इस context में समझ नहीं आता कि quaternions को इतना पसंद क्यों किया जाता है। Matrices को quaternions से कम intuitive मानना मुश्किल है
Matrices vectors पर act करती हैं, और rotations भी vectors पर act करते हैं, तो rotation को matrix के रूप में देखने से ज़्यादा natural क्या होगा
Matrix exponential भी ordinary differential equation से जोड़ें तो intuitive है।
dx/dt = Axका solutionexp(t A)है, और अगर A skew-symmetric हो तो x में change हमेशा x के perpendicular होता है, इसलिए यह length नहीं बदलने वाला rotation बनता हैLie group/Lie algebra इसे बहुत generalize करता है, लेकिन core बात यह है कि perpendicular changes को continuously बनाकर rotation generate किया जाता है और exponential map उस process को explain करता है। यह picture कहीं ज़्यादा geometric और intuitive लगती है
Quaternions का फायदा मुझे यह लगता है कि वही matrix multiplication हाथ से calculate करने की तुलना में, सिर्फ paper और pen से handle करना आसान होता है
निजी तौर पर यह complex numbers जैसे अर्थ में intuitive है। शुरू में अजीब लगा था, लेकिन अब जिन alternatives को जानता हूँ, उनसे ज़्यादा simple लगता है—use करने और reasoning करने दोनों में
यह property animation या 3D spline curves के साथ frames calculate करने वाले graphics work में बहुत महत्वपूर्ण है
यह 2D rotations को complex numbers से handle करने जैसा है: दो complex numbers को multiply करने पर rotations compose होते हैं और 2D में arguments add हो जाते हैं। उसी तरह दो quaternions को multiply करके 3D rotations compose किए जा सकते हैं, और यह 3x3 matrix multiplication से बहुत ज़्यादा efficient है
intuition के लिए कहें तो quaternions का axis-angle representation से गहरा संबंध है, जो Lie algebra so(3) जैसा है
vectors पर act करने के नजरिए से, अलग-अलग rotation parameterizations को उसी abstract
Rotationtrait के implementations की तरह देखा जा सकता है। अंदर implementation matrix, quaternion, Euler vector, Euler angles या Gibbs vector कुछ भी हो, rotation vectors पर act करता है और composition का तरीका समान होता हैUnit quaternions एक Lie group हैं, और अगर आप ऐसी चीज़ चाहते हैं जिसे मनमाने ढंग से जोड़ा जा सके, तो आपको rotation speed को दर्शाने वाले full quaternions के Lie algebra को देखना चाहिए। यह axis-angle rotational velocity को दर्शाने जैसा है
unit quaternions और axis-angle की तुलना करना श्रेणी के लिहाज़ से थोड़ा mismatch है; unit quaternions की तुलना rotation matrices से, और full quaternions की तुलना axis-angle से करना ज़्यादा सही है
quaternions इस्तेमाल करने का एक फायदा यह है कि exponential map आसानी से compute किया जा सकता है, लेकिन quaternions इस्तेमाल करते समय rotation matrices की बहुत कम ज़रूरत पड़ती है। लेख की तरह
pqp^-1से rotation compute किया जा सकता हैquaternions को समझने का सबसे आसान रास्ता मुझे geometric algebra पढ़ना लगता है। quaternions के आविष्कार में सैकड़ों साल लगे, लेकिन हैरान करने वाली सरल geometric algebra समझ लें तो कुछ ही मिनटों में quaternions को फिर से derive कर सकते हैं
कुछ साल पहले जो अच्छा introduction लगा था: https://crypto.stanford.edu/~blynn/haskell/ga.html
geometric algebra की कई formalizations से गुजरने के बाद भी अंत में SO(3)/SE(3) spaces को represent करने के लिए rotors और motors इस्तेमाल करने पड़ते हैं, जो क्रमशः quaternions और dual quaternions के isomorphic हैं
लेकिन उस उद्देश्य के लिए मुझे exponential map के साथ 3x3 rotation matrices और 4x4 transformation matrices अब भी कहीं ज़्यादा उपयोगी लगते हैं। quaternions कम storage लेते हैं और उन्हें आपस में multiply करना भी तेज़ है, लेकिन points transform करते समय matrices तेज़ होती हैं, और कुल efficiency situation पर निर्भर करती है
यूनिवर्सिटी में सीखी गई शानदार चीज़ों में से एक यह थी कि अगर
+operator को matrix और vector-space deltas के हिसाब से, और-operator को दो matrices के हिसाब से redefine कर दें, तो Kalman filter state के अंदर rotation matrix को सीधे रखा जा सकता हैऐसा करने से gimbal lock की चिंता किए बिना rotations estimate किए जा सकते हैं
https://openslam-org.github.io/MTK
+operator implement करना सिर्फ Kalman filters में ही नहीं, बल्कि nonlinear optimization में भी काफ़ी आम है। Ceres library भी इसके लिएLocalParameterizationsupport करती हैयह वाकई अच्छा था, और सिर्फ छोटे हिस्से ही अच्छे नहीं थे
खास तौर पर मुझे यह बात पसंद आई कि ये तरीके आखिर में standard rotation matrix compute करते हैं। अगर आपको दस लाख vectors rotate करने हैं, तो interesting computation सिर्फ एक बार करें, और उसके बाद highly optimized matrix multiplication pipeline चला दें
ब्लॉग शानदार था, लेकिन लेखक की profile पर क्लिक करके दूसरे लेख देखते हुए मुझे यह वाक्य दिखा: “2010 के आसपास, 9 साल की उम्र में पहली बार programming से परिचय हुआ”
मैं 2010 में 13 साल का था और middle-school maths और science दिमाग में भरने की कोशिश कर रहा था
जब भी मैं computer graphics पर कोई शानदार लेख देखता हूँ, लगता है वह मुझसे कम उम्र और कहीं ज़्यादा प्रतिभाशाली व्यक्ति ने लिखा है, और गहरी हीन भावना महसूस होती है
हालांकि मैं यह सलाह ठीक से नहीं दे पाऊँगा कि कैसे करें। मैंने बस उसे सचमुच पसंद किया और करता रहा। फिर भी structured practice जैसी चीज़ें भी काम कर सकती हैं, ऐसा लगता है
कई rotations का average निकालने का तरीका खोजते हुए मुझे https://mathweb.ucsd.edu/~sbuss/ResearchWeb/spheremean/paper... मिला
इस लेख का तरीका, कम-से-कम मेरे math level पर, उस paper से कहीं आसान लगता है
average वह काम है जो addition से किया जा सकता है, और addition में composition का order महत्वपूर्ण नहीं होता। लेकिन rotations commutative नहीं होते, इसलिए average की हमारी सामान्य समझ वैसे ही लागू नहीं होती
फोन हाथ में लेकर screen को 180° घुमाकर दूर की ओर करें, फिर ज़मीन के reference में clockwise 90° घुमाएँ, तो camera बाईं ओर देखेगा। उल्टा, यही दो rotations reverse order में करें तो camera दाईं ओर देखेगा
इन दो rotations के “average” में camera किस ओर देखना चाहिए, इसका कोई एक answer नहीं है; यह इस पर निर्भर करता है कि आप average से कौन-सी properties चाहते हैं
https://news.ycombinator.com/item?id=40333541
core intuition यह है कि addition translation है और multiplication rotation। इसलिए average translation के लिए arithmetic mean और average rotation के लिए geometric mean इस्तेमाल किया जा सकता है
यह समझने में मुझे काफी समय लगा कि math में भी abstractions उसी तरह बनाई जाती हैं जैसे software engineering में abstractions के बारे में सोचते हैं
बचपन में मैं उलझता था कि imaginary numbers क्यों बनाए गए, और matrices का आखिर मतलब क्या है
बाद में समझ आया कि ये representations design की गई हैं। imaginary numbers नाम की चीज़ बनाने से कुछ computations आसान हो जाते हैं, और linear equations को matrix के रूप में लिखना सब कुछ खोलकर लिखने की तुलना में reasoning के लिए कहीं आसान होता है
यह obvious लगता है, लेकिन किसी ने मुझे इस तरह नहीं बताया था
vector spaces, rings, metric spaces और categories के लिए भी यही बात है; math design patterns के रूप में interfaces से भरा है
हालांकि math के interfaces programming inheritance से ज़्यादा type classes जैसे हैं। क्योंकि वही set/type कई तरीकों से group बन सकता है