2

So I have two fuctions like this :-

$f(x) = (x/5)^2$ and $g(x) = \sqrt{(x/5)}$

and a third fuction as a combination of both

$ h(x) = \Biggl[ { }^{ x\; \lt \; 5 : \; f(x) }_{ x \;\ge \; 5: \; g(x)}\Biggr] $

When I put $x =5$ in the first function I get $f(5) = 1$ and in the second one I get $g(5) = 1\;$. That means h(x) is countinous at $x =5$ is there any way I can converge $h(x)$ into a single function??

  • 1
    What do you mean with a "single function"? Btw, you can write $h(x)=f(x)\mathbf1_{x<5}+g(|x|)\mathbf1_{x\geq5}$. This also if $f(5)\neq g(5)$. – drhab Jul 14 '19 at 10:22

4 Answers4

2

Is there any way I can [combine] $h(x)$ into a single function?

You just did. What you just wrote is a completely acceptable definition of one single function $h$.

However, you may be wondering something. Namely, your function is written in a piecewise form (it's defined separately for $x < 5$ and $x > 5$), and you may be wondering if it's possible to write your function in a non-piecewise form.

The answer is no, not really. The function $h$ is sort of an "inherently piecewise function"; in order to define $h$, you pretty much need to either define it as a piecewise function, or define it in terms of another piecewise function (such as the absolute value function).

Tanner Swett
  • 10,624
  • Your last paragraph is not quite true. Using analytic methods, one should be able to write a single formula for the function, although I don't quite see the point here. – Allawonder Jul 14 '19 at 12:42
  • @Allawonder Well, h here isn't an analytic function. Most "normal", non-piecewise ways of defining a function give you an analytic function, so that means that in order to define h other than as a piece wise function, you're going to have to do something "weird". So in practice, the piecewise definition is the best definition. – Tanner Swett Jul 14 '19 at 19:06
  • You must have misunderstood me. I didn't mean analytic as in complex analysis. Hence, I never used the combination analytic function. I said analytic methods, by which I meant methods beyond the elementary. Thus, I didn't mean for example that you could use a power series or something. I meant something like the double limit definition of the Dirichlet function, for example. – Allawonder Jul 14 '19 at 20:27
  • @Allawonder Got it, thanks for clarifying that. – Tanner Swett Jul 14 '19 at 21:37
1

You mean one "formula", not one "function". drhab showed one way to do that, using the functions $1_{x< 5}$, the function that is equal to one if x< 5, 0 otherwise and $1_{x\ge 5}$, the function that is 1 if $x\ge 5$, 0 otherwise.

A different way of writing this is to use the "Heaviside step function", H(x), which is defined to be 0 for x< 0, 1 for $x\ge 0$. H(x-a) is 0 for x< a, 1 for $x\ge a$. A function that has value f(x) for x< a and g(x) for $x\ge a$ is f(x)+ (g(x)- f(x))H(x- a). When x< a, x- a< 0, H(x- a)= 0, so we have f(x)+ (g(x)- f(x))(0)= f(x). When $x\ge a$, H(x- a)= 1, so we have f(x)+ (g(x)- f(x))(1)= g(x).

Here, you want $(x/5)^2+ (\sqrt{x/5}- (x/5)^2)H(x- 5)$.

user247327
  • 18,710
  • Written like this the function is not properly defined for $x <0$. It can be repaired by taking absolute value under the $\sqrt $ sign. – drhab Jul 15 '19 at 06:23
1

Others have shown how you may be able to disguise the piecewise nature of your function e.g. by using the Heaviside step function. If that is too exotic for you then similar tricks may be possible with more familiar functions e.g. absolute value.

An indication that a very nice answer is unlikely is that although your function is continuous at $5$, it is not differentiable there. The derivative (slope) abruptly changes at $5$. Pretty much any nice answer will be differentiable as well as continuous.

To give a more exact answer, we would need to know what you consider acceptable.

badjohn
  • 8,204
  • https://math.stackexchange.com/questions/3218113/write-logical-operator-allxa-in-terms-of-heavyside-functions/3218157#3218157 In fact you can get any indicator function of intervals once allowed to use such discontinuous functions. – zwim Jul 14 '19 at 14:06
  • That was the idea. – badjohn Jul 14 '19 at 14:44
  • I do not care if the function is not differentiable.. – Coding Hub Jul 16 '19 at 06:14
  • I know but most "nice" formula will be. So, the non-differentiability forces either a piecewise definition or hiding it via a function which itself has a piecewise definition e.g. absolute value or the Heaviside function. – badjohn Jul 16 '19 at 07:34
0

$$h(x) = \left ( \frac 1 {10} \left (x - 5 - \sqrt {\strut (x - 5)^2} \right ) + 1 \right )^2 \sqrt {\frac 1 {10} \left (x - 5 + \sqrt {\strut (x - 5)^2} \right ) + 1}$$

Luca Bressan
  • 6,845