1.1 略
1.2 略
1.3
sumSLT :: (Num a,Ord a) => a -> a -> a -> a
sumSLT a b c
| (a<b && a<c) = b*b + c*c
| (b<a && b<c) = a*a + c*c
| otherwise = a*a + b*b
1.4 略
1.5 略
1.6 略
1.7
newSqrt :: (Num a,Fractional a,Ord a) => a -> a
newSqrt x = sqrt_iter 1.0 x
where sqrt_iter guess x = if (good_enough guess x) then guess
else sqrt_iter (improve guess x) x
good_enough guess x = (guess*guess/x < 1.001) && (guess*guess/x > 0.999)
improve guess x = (guess + (x/guess))/2
1.8
improve guess x = (x/(guess*guess)+2*guess)/3
good_enough guess x = abs (guess*guess*guess - x) < 0.0001
cubet_iter guess x = if (good_enough guess x)
then guess
else (cubet_iter (improve guess x) x)
cubet x = cubet_iter 1.0 x
分享到:
相关推荐
Section 1.1. What Is Python? Section 1.2. Origins Section 1.3. Features Section 1.4. Downloading and Installing Python Section 1.5. Running Python Section 1.6. Python Documentation Section 1.7. ...
Section 1.1. WPF from Scratch Section 1.2. Navigation Applications Section 1.3. Content Model Section 1.4. Layout Section 1.5. Controls Section 1.6. Data Binding Section 1.7. Dependency ...
Introduction, Section 1.1. The High Performance Buzz-word, Chapter 2. The Theory of Computation, Section 2.1. Introduction, Section 2.2. Problems, Section 2.3. Models of Computation, Chapter 3. ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network Standardization...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Uses of Computer Networks Section 1.2. Network Hardware Section 1.3. Network Software Section 1.4. Reference Models Section 1.5. Example Networks Section 1.6. Network ...
Section 1.1. Security Definitions Section 1.2. Web Application Architecture Blueprints Chapter 2. Installation and Configuration Section 2.1. Installation Section 2.2. Configuration and ...
Section 1.1. Why JavaScript? Section 1.2. Analyzing JavaScript Section 1.3. A Simple Testing Ground Chapter 2. Grammar Section 2.1. Whitespace Section 2.2. Names Section 2.3. Numbers Section ...
Section 1.1. Why Linux? Section 1.2. Embedded Linux Today Section 1.3. Open Source and the GPL Section 1.4. Standards and Relevant Bodies Section 1.5. Chapter Summary Chapter 2. Your First Embedded ...
Section 1.1. What Can a Network Program Do? Section 1.2. Security Section 1.3. But Wait! There's More! Chapter 2. Basic Network Concepts Section 2.1. Networks Section 2.2. The Layers of a ...
Section 1.1. The ISO/OSI Reference Model Section 1.2. Network Components at Different Layers Section 1.3. Overview of Internet Protocols Section 1.4. Summary Chapter 2. The Internet ...