cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

sign function, roots & integers vs rational numbers

Liv
6-Contributor
6-Contributor

sign function, roots & integers vs rational numbers

Hello dear community !

 

Results of sign function in the attached worksheet are quite tricky.

When calculations for a root under the argument of sign function are done only with integers the result is always like expected, i. e. 0 ?

Why this behavior ?  Binary representation of numbers in numeric engine of Mcd...? I'd have wished a more consistent implementation of sign function, for example in agreement with the precision given by TOL or of the symbolic calculus (like in Mcd2001), or without differences between integers and rational (real) numbers...

Same behavior in Mcd Prime ?

I've used this function for roots testing in a program and I was surprised to discover that thus I missed some, like in the case of p30f in attached, where the output of sign is not 0 (zero), as expected for a root of the polynomial in sign argument.

In order to make sign function work evenly in all cases I added round built-in function, the version with two arguments, the second being -log(TOL). Are there alternatives to this approach, since time execution of my program can become an issue ?

 

Best regards, Liv.

 

An old thread is about a similar issue : Problem with sign function - PTC Community

3 REPLIES 3
-MFra-
21-Topaz II
(To:Liv)

Hello,

This is not an answer. However I would like to point out that you can choose the following option for a different representation of the results.

symbolic results.jpg

Werner_E
24-Ruby V
(To:Liv)

You are on the limits of numerical evaluations. Asking for being exact zero when dealing with reals sure is a problem.

You might consider implementing a user defined Sign function:

Liv
6-Contributor
6-Contributor
(To:Liv)

F.M. & Werner, thank you both for your answers.

Your user defined Sign function, Werner, is surely faster than my use of round & log and I'll switch to it with my program.

Best, Liv.

Top Tags