Switch Function: Interval Restriction for Functions

  • Thread starter Thread starter pondzo
  • Start date Start date
  • Tags Tags
    Function Switch
AI Thread Summary
The discussion centers on creating a function that restricts outputs to specific intervals without using piecewise definitions. The proposed solution involves defining two functions, f(x) and g(x), derived from the sgn(x) function, which can switch between outputs based on the value of x. Various mathematical techniques, including the use of the Kronecker delta function and the identity involving tanh, are suggested to handle indeterminate values and achieve the desired behavior. The final function, R(x), combines these elements to avoid piecewise representation while effectively managing interval restrictions. The conversation highlights the need for innovative mathematical approaches to implement complex functions seamlessly.
pondzo
Messages
168
Reaction score
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
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).
 
pondzo said:
but i do not want this to be a pieceswise function.
Why?
 
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...
Insights auto threads is broken atm, so I'm manually creating these for new Insight articles. In Dirac’s Principles of Quantum Mechanics published in 1930 he introduced a “convenient notation” he referred to as a “delta function” which he treated as a continuum analog to the discrete Kronecker delta. The Kronecker delta is simply the indexed components of the identity operator in matrix algebra Source: https://www.physicsforums.com/insights/what-exactly-is-diracs-delta-function/ by...
Thread 'Imaginary Pythagorus'
I posted this in the Lame Math thread, but it's got me thinking. Is there any validity to this? Or is it really just a mathematical trick? Naively, I see that i2 + plus 12 does equal zero2. But does this have a meaning? I know one can treat the imaginary number line as just another axis like the reals, but does that mean this does represent a triangle in the complex plane with a hypotenuse of length zero? Ibix offered a rendering of the diagram using what I assume is matrix* notation...
Back
Top