Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
You can go backwards: FunctionExpand[x Sinc[c x]] – bill s Feb 20 '14 at 19:04
@bill: I suppose what I need is a FunctionReduce along the lines of TrigExpand/TrigReduce. :) – Rahul Feb 21 '14 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. – bill s Feb 21 '14 at 16:39
@Michael, or Cos[z_] :> 1 - (z Sinc[z/2])^2/2 – J. M. May 20 '15 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. – Rahul May 20 '15 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 = 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[#, badTemrs]& /@ {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

share|improve this answer
What's this Reduce`ToDNF? Could it be replaced with properly documented BooleanConvert? – kirma May 24 '15 at 5:08

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.