How to remove discontinuity from the equation?

115 Views Asked by At

I have a function $f$, which have two cases:

$$ f(x) = \begin{cases} \frac{ \sin(a + bx) - \sin(a) }{b} &\mbox{if } b \neq 0\\ x \cos(a) &\mbox{if } b = 0 \end{cases} $$

The first part has a discontinuity at $b=0$ because the denominator, that is why the second case is needed.

Is it possible to rearrange the equation in a way, that we do not need cases, only one closed formula? I would like to avoid dividing by near to zero values, because of floating point arithmetic.


What I've tried:

$$ \frac{ \sin(a + bx) - \sin(a) }{b} = \frac{ \sin(a) \cos(bx) + \cos(a) \sin(bx) - \sin(a) }{b} $$

I have no idea how to progress any further

4

There are 4 best solutions below

0
On BEST ANSWER

$\newcommand{mysinc}{\mathop{\rm sinc}}$ You can use the $\mysinc$ function. It is already implemented in some languages, for example see the numpy version.

$$\begin{align}\frac{\sin a \cos bx+\cos a \sin bx-\sin a}{b}&=\sin a\frac{\cos bx -1}{b}+\cos a\frac{\sin bx}{b}\\&=\sin a\frac{-2\sin^2\frac{bx}{2}}{b}+x\cos a\mysinc bx\\&=-x\sin a \sin\frac{bx}{2} \mysinc\frac{bx}{2}+x\cos a\mysinc bx \end{align}\\$$

When $b=0$ the first term vanishes because of the $\sin$, and the second becomes $x\cos a$ since $\mysinc 0=1$.

2
On

Remember for continuity at $p,$

$$\lim_{y\to p}f(y)=f(p)$$

Now using Prosthaphaeresis Formulas and $\lim_{h\to0}\dfrac{\sin h}h=1$

$$\lim_{b\to0}\dfrac{\sin(a+bx)-\sin a}b=x\lim_{b\to0}\dfrac{\sin\dfrac{bx}2}{\dfrac{bx}2}\lim_{b\to0}\cos\left(a+\dfrac{bx}2\right)=x\cos a=f(0)$$

So. $f(x)$ is continuous at $b=0$

0
On

Unless you have a special function such as the Cardinal Sine ($\text{sinc}$, see Andrei's answer) which will absorb the indeterminacy, the answer is negative.

This function has a simple Taylor's development, but this is unsuitable for your purpose if you want to avoid a piecewise definition by all means.

0
On

\begin{align} f(x)&=\int_0^x \cos(a+bt)\,dt \end{align}