Home Online Manual
Top
Back: factorize
Forward: fetch
FastBack: Functions and system variables
FastForward: Control structures
Up: Functions
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

5.1.36 farey

Syntax:
farey ( bigint_expression , bigint_expression )
farey ( ideal_expression , bigint_expression )
farey ( module_expression , bigint_expression )
farey ( matrix_expression , bigint_expression )
farey ( list_expression , bigint_expression )
Type:
type of the first argument (unless it is list)
Purpose:
lift the first argument modulo the second to the rationals.
The (coeffients of the) result a/b is the best approximation under the condition $\vert a\vert,\vert b\vert<=\sqrt{(N-1)/2}$farey(list(a,b,..),B) is equivalent to list(farey(a,B),farey(b,B),...).
Note:
The current coefficient field must be the rationals.
Example:
 
  ring r=0,x,dp;
  farey(2,32003);
==> 2
See chinrem.