# Code Snippets Mathematica

Short texts Mathematica 🧑‍💻 Code snippets Mathematica ✍️ Reading lists Mathematica 👀

## CommutatorPlot.mathematica

CommutatorPlot[group_, ticks_] := Module[ {}, els = GroupElements[group]; n = Length[els]; (* Initial sorting of elements provides a good approximation for \ sorting by conjugacy class, and provides a sorting for the conjugacy classes themselves *) CycleLengths[c_] := Sort[Length /@ c[]]; els = SortBy[GroupElements[group], Function[g, {CycleLengths[g], g}]]; (* Calculating and sorting by conjugacy classes *) […]

## Dynamic visualisation of stereographic projection of the sphere

stereoTo3D[x_, y_] := 1/(1 + x^2 + y^2) {2 x, 2 y, 1 – x^2 – y^2}; DynamicModule[ {pt = {0, 0}}, Row @ { LocatorPane[Dynamic @ pt, Graphics[{Gray, Disk[]}, Frame -> True, ImageSize -> 200] ], Graphics3D[ { {[email protected], Sphere[]}, {[email protected], InfinitePlane[{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}}]}, [email protected], Dynamic @ Point […]

## openAL_RotateSource_17.m

appState->duration = framesToPutInBuffer / convertToDataFormat.mSampleRate;

## sansu1177a.m

In[]:= AbsoluteTiming[ ans = Sum[Binomial[13 – 2 k, k], {k, 1, 4}]] Out[]= {0.0000335, 87}

## Covid19 slope

worlddata = Import[“https://covid.ourworldindata.org/data/owid-covid-data.csv”]; font = “Helvetica Neue”; angle = Pi/4; pos0 = {0, 0}; radius = Log/Pi; slopepos[val_, h_] := pos0 + {Cos[angle]*val + h*Sin[angle], (-Sin[angle])*val + h*Cos[angle]} line[x_, val_] := With[{angle = (val/Log)*Pi}, {{x[] + radius*Cos[-angle + Pi/4], x[] + radius*Sin[-angle + Pi/4]}, {x[] – radius*Cos[-angle + Pi/4], x[] – radius*Sin[-angle + Pi/4]}}]; tag […]