Naive sign function for real numbers - challenge

Click For Summary
SUMMARY

The forum discussion centers on the challenge of defining a sign function for real numbers without using decisional blocks or piecewise functions. Participants propose various mathematical approaches, including the function sgn(x) = x/|x| and the limit expression f(x) = lim_{n \to \infty} \frac{2}{\pi} \arctan(xn). The conversation highlights the distinction between mathematical functions and programming constructs, emphasizing that certain operations, like abs() and trunc(), can be implemented without explicit decision-making. The discussion concludes that it is indeed possible to define a sign function without resorting to piecewise definitions.

PREREQUISITES
  • Understanding of mathematical functions and their properties
  • Familiarity with the concept of limits in calculus
  • Knowledge of floating-point arithmetic and IEEE 754 standards
  • Basic understanding of programming constructs related to decision-making
NEXT STEPS
  • Research the mathematical properties of the sign function and its alternatives
  • Explore the implications of IEEE 754 on floating-point operations
  • Study the implementation of the sgn() function in various programming languages
  • Investigate smooth approximations of discontinuous functions in numerical analysis
USEFUL FOR

Mathematicians, computer scientists, and software developers interested in numerical methods, function definitions, and efficient programming practices without decision blocks.

  • #31
I will use the Lemmings suicide function. Then maybe this thread will truncate.
 
Physics news on Phys.org
  • #32
Given any number x you could guess the sign. You'd be right half the time.
 

Similar threads

  • · Replies 24 ·
Replies
24
Views
6K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 36 ·
2
Replies
36
Views
6K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K