Re: How do I write a program to calculate the golden section?

new topic     » goto parent     » topic index » view thread      » older message » newer message

-- code begins --
atom height, width, old_height, gold_sect
height = 1
width = 1
for i = 1 to 50 do
  gold_sect = height / width
  printf(1, "height: %d  width: %d  ratio: %1.16f\n", {height, width,
 gold_sect})
  old_height = height
  height = width
  width = old_height + width
end for
-- code ends

 _______  ______  _______  ______
[    _  \[    _ ][ _   _ ][    _ ]
[/| [_] |[/| [_\][/ | | \][/| [_\]
  |  ___/  |  _]    | |     |  _]
[\| [/]  [\| [_/] [\| |/] [\| [_/]
[_____]  [______] [_____] [______]
xseal at harborside.com  ICQ:13466657
http://www.harborside.com/home/x/xseal/euphoria/

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu