Switch Function: Interval Restriction for Functions

In summary, the speaker is looking for a function or operator that can restrict a function within a given interval. They do not want to use a piecewise function and instead propose using operators, &{} and %{}, to switch the function for a given interval. They mention using the sgn(x) function and the Kronecker delta function to achieve this. They also provide the equations for two functions, f(x) and g(x), that can be used to achieve this. However, they mention that these functions are indeterminate at x=0 and suggest using the tanh(1000000x) function to handle this issue. They finally mention that the final function will be R(x) = xf(x) + sqrt(x)g
  • #1
pondzo
169
0
Hi i was wondering if there is such a function/operator/something that restricts a function within an interval. I know that doesn't make a lot of sense but ill show you what i mean;

Say i want to define f(x) = x for 0<x<a and f(x) = sqrt(x) for x>a. Now i know this is easily represented as a piecewise function, but i do not want this to be a pieceswise function.

So instead I define g(x) = &{x} + %{sqrt(x)} where the &{} is some type of operator that is 1 when 0<x<a and 0 elsewhere and the %{} is a similar operator that is 1 when x>a and 0 elsewhere. What this 'operator' (probably not the right term) is effectively doing is switching the function for a given interval... i apologise for the abstractness.
 
Mathematics news on Phys.org
  • #3
HEY! I know about this! I hope you're still watching this thread. I frequently need "mathematical cheat codes" which implement weird functions in terms of what you normally put into a calculator.

Consulting my recipe book, there's a few ways to do this. For clarity, I'll name the function which is 1 until x, then turns to 0, f(x); and the function which is 0 until x, then turns to 1, g(x).

You can derive these both from the sgn(x) function, which you can implement with f(x) / |f(x)|. Using the rules for translating and stretching functions, you end up with:

f(x) = (x-A)/(2abs(x-A)+(1/2)

g(x) = (A-x)/(2abs(A-x)+(1/2)

If you aren't allowed to use the absolute value function, you can implement that with sqrt(f(x)^2). Due to how only the principal value is taken.

Note, the above functions are indeterminate at x = 0. You can use the Kronecker delta function to get a function which is 0 at all points except A, where it is some number you specify. This is 0^abs(x), assuming your use-case assumes indeterminate values to be zero, and not, say, an error.

If indeterminate values are a problem, you can use the particularly evil identity sgn(x) = tanh(1000000x).

So, the most rigorous function I can give is f(x) = tanh(1000000(x-A))/2+1/2 and g(x) = tanh(1000000(A-x))/2+1/2

Your final function R(x) will just be xf(x)+sqrt(x)g(x).
 
  • #4
pondzo said:
but i do not want this to be a pieceswise function.
Why?
 
  • #5

What is a switch function and how does it work?

A switch function, also known as a step function, is a type of mathematical function that has a specific output for a given input. It works by dividing the input domain into distinct intervals, and for each interval, it has a constant value as the output. When the input falls within a certain interval, the function switches to that specific output value.

Why is interval restriction important for functions?

Interval restriction is important for functions because it allows us to define a function over a specific range of values. This can be useful for modeling real-world phenomena or simplifying complex functions. It also helps to avoid undefined or infinite values, which can cause errors in calculations.

How do you determine the intervals for a switch function?

The intervals for a switch function can be determined by looking at the domain of the function. Each interval should cover a distinct range of values within the domain. It is also important to consider any discontinuities or points of non-differentiability in the function, as these may require separate intervals.

What are some examples of real-life applications of switch functions?

Switch functions are commonly used in economics and finance to model changes in prices or interest rates. They are also used in computer science, such as in programming languages to control flow or in digital signal processing to filter out noise. In physics, switch functions can be used to model the behavior of systems with sudden changes or discontinuities.

Can switch functions be differentiable?

Yes, switch functions can be differentiable if they have a continuous derivative at each interval boundary. However, they are typically not differentiable at the points where the function switches values, as these are points of discontinuity.

Similar threads

Replies
3
Views
221
  • General Math
Replies
4
Views
763
Replies
4
Views
899
  • General Math
Replies
5
Views
2K
Replies
4
Views
411
Replies
2
Views
682
  • General Math
Replies
4
Views
2K
  • General Math
Replies
23
Views
1K
  • General Math
Replies
5
Views
950
Replies
3
Views
706
Back
Top