星期一, 6月 13, 2011

[Note] Find the maximum of the function under the condition

I want to find the maximun value of x function when function value <=1

ghci result

Prelude> let x b = ((1+0.429*b) * 0.52)/(1+0.159*b)
Prelude>let y =  length(takeWhile (<=1) (map x (iterate (+0.01) 0)))
Prelude> (fromInteger (toInteger y))*0.01
7.5


---
Simple Note

沒有留言: