Fix uses of new math constants

db4
Aaron Schaefer 2008-01-24 18:18:12 -05:00
parent 6d5c1bf1d2
commit 6df78419b9
2 changed files with 27 additions and 33 deletions

View File

@ -1,13 +1,12 @@
USING: kernel namespaces math math.constants math.functions USING: kernel namespaces math math.constants math.functions arrays sequences
arrays sequences opengl opengl.gl opengl.glu ui ui.render opengl opengl.gl opengl.glu ui ui.render ui.gadgets ui.gadgets.theme
ui.gadgets ui.gadgets.theme ui.gadgets.slate colors ; ui.gadgets.slate colors ;
IN: golden-section IN: golden-section
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! To run: ! To run:
! ! "golden-section" run
! "demos.golden-section" run
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -20,9 +19,7 @@ glPopMatrix ;
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: phi ( -- phi ) 5 sqrt 1 + 2 / 1 - ; : omega ( i -- omega ) phi 1- * 2 * pi * ;
: omega ( i -- omega ) phi * 2 * pi * ;
: x ( i -- x ) dup omega cos * 0.5 * ; : x ( i -- x ) dup omega cos * 0.5 * ;

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Aaron Schaefer. ! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel math math.functions math.parser math.ranges memoize USING: alien.syntax kernel math math.constants math.functions math.parser
project-euler.common sequences ; math.ranges memoize project-euler.common sequences ;
IN: project-euler.025 IN: project-euler.025
! http://projecteuler.net/index.php?section=problems&id=25 ! http://projecteuler.net/index.php?section=problems&id=25
@ -67,9 +67,6 @@ PRIVATE>
<PRIVATE <PRIVATE
: phi ( -- phi )
5 sqrt 1+ 2 / ;
: digit-fib* ( n -- term ) : digit-fib* ( n -- term )
1- 5 log10 2 / + phi log10 / ceiling >integer ; 1- 5 log10 2 / + phi log10 / ceiling >integer ;