Skip to content

Instantly share code, notes, and snippets.

@ikirill
Created August 13, 2019 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikirill/2ec0ebb547059312b4d680c4a7895fbb to your computer and use it in GitHub Desktop.
Save ikirill/2ec0ebb547059312b4d680c4a7895fbb to your computer and use it in GitHub Desktop.
ClearAll[parts, ii]
parts[expr_Plus] := Distribute[Unevaluated[parts[expr]]]
parts[a_ x_] /; NumericQ[a] := a parts[x]
parts[ii[Sin[t] rest_]] :=
Cos[x] (rest /. t -> x) + ii[Cos[t] D[rest, t] // Simplify]
parts[ii[Cos[t] rest_]] := -Sin[x] (rest /. t -> x) -
ii[Sin[t] D[rest, t] // Simplify]
parts[expr_] := expr
Nest[parts, ii[Log[t] Sin[t]/t], 10];
CoefficientList[% /. ii[_] :> 0, {Cos[x], Sin[x], Log[x]}]
Nest[parts, ii[Log[t] Cos[t]/t], 10];
CoefficientList[% /. ii[_] :> 0, {Cos[x], Sin[x], Log[x]}]
Nest[parts, ii[Sin[t]/t], 10];
CoefficientList[% /. ii[_] :> 0, {Cos[x], Sin[x], Log[x]}]
Nest[parts, ii[Cos[t]/t], 10];
CoefficientList[% /. ii[_] :> 0, {Cos[x], Sin[x], Log[x]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment