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$.

  • $\begingroup$ You can go backwards: FunctionExpand[x Sinc[c x]] $\endgroup$
    – bill s
    Feb 20, 2014 at 19:04
  • $\begingroup$ @bill: I suppose what I need is a FunctionReduce along the lines of TrigExpand/TrigReduce. :) $\endgroup$
    – user484
    Feb 21, 2014 at 7:06
  • $\begingroup$ 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. $\endgroup$
    – bill s
    Feb 21, 2014 at 16:39
  • 1
    $\begingroup$ @Michael, or Cos[z_] :> 1 - (z Sinc[z/2])^2/2 $\endgroup$ May 20, 2015 at 22:18
  • 2
    $\begingroup$ @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. $\endgroup$
    – user484
    May 20, 2015 at 22:21

2 Answers 2


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 = Reduce`ToDNF[Reduce[!domain, vars, Reals]];

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

  lims = ExtendedLimit[expr, ##]& @@@ locassums;
  If[!FreeQ[lims, $Failed],

  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 = Reduce`ReduceToRules[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];

  badTerms = ComplexInfinity|Indeterminate|Undefined|DirectedInfinity|Interval;

    Switch[FreeQ[#, badTerms]& /@ {llim, rlim},
      {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}]

enter image description here

ExtendFunctionDomain[(1 - Cos[c x])/c, {x, c}]

enter image description here

ExtendFunctionDomain[2 Cos[x] Sin[x] Csc[2 x], x]

enter image description here

  • 2
    $\begingroup$ What's this Reduce`ToDNF? Could it be replaced with properly documented BooleanConvert? $\endgroup$
    – kirma
    May 24, 2015 at 5:08
  • 1
    $\begingroup$ A typo in Switch[FreeQ[#, badTemrs]& /@ {llim, rlim} should be badTerms? @Greg Hurst $\endgroup$
    – lotus2019
    Aug 13 at 13:58
  • $\begingroup$ Fixed, thanks! $ $ $\endgroup$
    – Greg Hurst
    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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.