Category: Programming Tasks
-
x to the power x = a constant by Fixed point
A solution to xx = 1000 by finding a fixed point of x log(1000)/log(x). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters…
-
Golden Ratio by Fixed Point of a Function
The golden ratio is a fixed point of the transformation x 1 + 1/x. The code below uses this to compute it. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn…
-
Simpson’s Rule for Integration
Implementation of simpson’s rule for integration This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (even? n) (= (remainder n 2) 0))…
-
Testing for Primality – Improved
Improved version of Testing for primality This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (smallest-divisor n) (find-divisor n 2)) (define (find-divisor…
-
Testing for Primality
Test a number for primality. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters (define (square n) (* n n)) (define (smallest-divisor n)…
-
Multiplication by Successive Doubling
Implementation of a tail recursive algorithm for multiplication by means of repeated addition (doubling). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters Show hidden characters…
-
Exponentiation by successive squaring
Implementation of a procedure that evolves an iterative exponentiation process that uses successive squaring and uses a logarithmic number of steps. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more…
-
Square-root using Newton’s Method
The following uses Newton’s Method to find square root. It keeps record of how guess changes from one iteration to the next and stops when the change is a very small fraction of the guess. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To…
-
Continued Fraction For Tangent Function
A continued fraction representation of the tangent using J.H. Lambert’s formula: where x is in radians. k specifies the number of terms to compute: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode…