# Transform an expression to remove the singularity

I have the expression Sin[c x]/c. Clearly it is undefined at $c=0$, but that is merely a removable singularity, since $$\frac{\sin(cx)}c=x\frac{\sin(cx)}{cx}= x\operatorname{sinc}(cx),$$ which is continuous everywhere. Is it possible to get this sort of transformation automatically in Mathematica using the built-in formula manipulation tools? I tried a few things like FullSimplify, TrigReduce, etc. but nothing helped.

I'd like to be able to do this for (1 - Cos[c x])/c, too; that is, automatically transform it into a form that has no singularity at $c=0$.

• You can go backwards: FunctionExpand[x Sinc[c x]] Feb 20, 2014 at 19:04
• @bill: I suppose what I need is a FunctionReduce along the lines of TrigExpand/TrigReduce. :)
– user484
Feb 21, 2014 at 7:06
• I can't even find a way to go back from Sin[c x]/(c x) to Sinc[c x]. One would think there should be some kind of ComplexityFunction that could be used with FullSimplify to achieve this. Feb 21, 2014 at 16:39
• @Michael, or Cos[z_] :> 1 - (z Sinc[z/2])^2/2 May 20, 2015 at 22:18
• @MichaelE2: Yes, if I do a bunch of trigonometry to derive the appropriate substitution I can then plug it into Mathematica, but it would be nice to have a more automatic solution.
– user484
May 20, 2015 at 22:21

One idea is to extend the domain with a piecewise function by taking limits at singularities.

ExtendFunctionDomain[expr_, vars_] := Module[{domain, antidomain, locassums, lims},
domain = FunctionDomain[expr, vars, Reals] /. {
NotElement[f_, S_] :> Not[f == C[1] && Element[C[1], S]]
};
antidomain = ReduceToDNF[Reduce[!domain, vars, Reals]];

locassums = ExtractRootsAndAssumptions[antidomain];
If[!MatchQ[locassums, {{{_Rule}, _}..}],
Return[expr]
];

lims = ExtendedLimit[expr, ##]& @@@ locassums;
If[!FreeQ[lims, $Failed], Return[expr] ]; Piecewise[MapThread[{#1, (And @@ Equal @@@ #2[[1]]) && #2[[2]]}&, {lims, locassums}], expr] ] ExtractRootsAndAssumptions[HoldPattern[Or][args__]] := iExtractRootsAndAssumptions /@ {args} ExtractRootsAndAssumptions[expr_] := {iExtractRootsAndAssumptions[expr]} iExtractRootsAndAssumptions[expr_] := With[{r = ReduceReduceToRules[expr]}, ( {First[r], expr /. First[r]} ) /; MatchQ[r, {{__Rule}}] ]; iExtractRootsAndAssumptions[_] =$Failed;

ExtendedLimit[expr_, {x_ -> a_}, assum_] := Module[{llim, rlim},
llim = Limit[expr, x -> a, Assumptions -> assum, Direction -> 1];
rlim = Limit[expr, x -> a, Assumptions -> assum, Direction -> -1];

(
{True, True}, (llim + rlim)/2,
{True, False}, llim,
{False, True}, rlim,
_, Undefined
]
) /; FreeQ[{llim, rlim}, Limit]
];
ExtendedLimit[___] = $Failed;  I haven't tested this code on many examples, but here are some. ExtendFunctionDomain[Sin[x c]/c, {x, c}]  ExtendFunctionDomain[(1 - Cos[c x])/c, {x, c}]  ExtendFunctionDomain[2 Cos[x] Sin[x] Csc[2 x], x]  • What's this ReduceToDNF? Could it be replaced with properly documented BooleanConvert? May 24, 2015 at 5:08 • A typo in Switch[FreeQ[#, badTemrs]& /@ {llim, rlim} should be badTerms? @Greg Hurst Aug 13 at 13:58 • Fixed, thanks!$ $Aug 13 at 18:34 Well, if it is only for$\frac{1-cos[c x]}{c}\$, I tried the following which works perfectly (even without assumptions):

FullSimplify[((1 - Cos[c x])/(c x))/ Sinc[c x]] Sinc[c x]


which in turn yields:

Sinc[c x] Tan[(c x)/2]
`

I am not sure about the bigger context where you want to use that, expanding this technique depends on what you want to do exactly.