This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
 Documentation / Mathematica / Built-in Functions / Programming / Tests  /
SameTest

  • SameTest is an option for functions like FixedPoint that specifies the comparison function to apply to pairs of results to determine whether they should be considered the same.
  • The default is usually SameTest -> Equal.
  • Settings for SameTest must be functions that take two arguments, and return True or False.
  • See the Mathematica book: Section 2.2.2.
  • See also: Throw.

    Further Examples

    Here is an implementation of Newton's method for finding the square root of starting with an initial guess of x.

    In[1]:=

    Iterating newtonsqrt2 will give better and better approximations to the square root of .

    In[2]:=

    Out[2]=

    You can use the SameTest option to FixedPointList to specify the stopping condition.

    In[3]:=

    In[4]:=

    Out[4]=