Skip to content

Instantly share code, notes, and snippets.

@spotco
Last active December 15, 2015 20:19
Show Gist options
  • Save spotco/5318082 to your computer and use it in GitHub Desktop.
Save spotco/5318082 to your computer and use it in GitHub Desktop.
mathematica include
(*GENERAL PURPOSE*)
ee[m_, e_] := m*10^ e;
sci[x_] := ScientificForm[x]; // N
getr[rules_, r_] := Replace[r, rules];
(*Complex*)
imag[a_, b_] := a + I*b;
imagpol[i_] := {Abs[i], ArcTan[Re[i], N[Im[i]]]};
FactorC[p_, x_] := Times @@ Cases[Roots[p == 0, x, Cubics -> False], u_ == v_ -> x - v];
PartialFractionsC[p_, x_] := (Apart[Numerator[#1]/FactorC[Denominator[#1], x], x] &)[Together[p]];
(*EE*)
respar[a_, b_] := (a*b)/(a + b);
(*
PartialFractionsC[(A s)/(s^2+\[Omega]^2),s]
DiscretePlot[fn[k], {k, -10, 10}, PlotStyle -> PointSize[0.02],
PlotRange -> Full]
Periodic`PeriodicFunctionPeriod[(Sin[4*Pi*x]) ˆ2, x]
*)
Solve[
cr == a * fr &&
cg == a * fg &&
cb == a * fb - a + 1 &&
dr == a * fr &&
dg == a * fg - a + 1 &&
db == a * fb,
{a, fr, fg, fb}, MaxExtraConditions -> All]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment