• For a new problem, you will need to begin a new live expert session.
  • You can contact support with any questions regarding your current subscription.
  • You will be able to enter math problems once our session is over.
  • I am only able to help with one math problem per session. Which problem would you like to work on?
  • Does that make sense?
  • I am currently working on this problem.
  • Are you still there?
  • It appears we may have a connection issue. I will end the session - please reconnect if you still need assistance.
  • Let me take a look...
  • Can you please send an image of the problem you are seeing in your book or homework?
  • If you click on "Tap to view steps..." you will see the steps are now numbered. Which step # do you have a question on?
  • Please make sure you are in the correct subject. To change subjects, please exit out of this live expert session and select the appropriate subject from the menu located in the upper left corner of the Mathway screen.
  • What are you trying to do with this input?
  • While we cover a very wide range of problems, we are currently unable to assist with this specific problem. I spoke with my team and we will make note of this for future training. Is there a different problem you would like further assistance with?
  • Mathway currently does not support this subject. We are more than happy to answer any math specific question you may have about this problem.
  • Mathway currently does not support Ask an Expert Live in Chemistry. If this is what you were looking for, please contact support.
  • Mathway currently only computes linear regressions.
  • We are here to assist you with your math questions. You will need to get assistance from your school if you are having problems entering the answers into your online assignment.
  • Have a great day!
  • Hope that helps!
  • You're welcome!
  • Per our terms of use, Mathway's live experts will not knowingly provide solutions to students while they are taking a test or quiz.

Please ensure that your password is at least 8 characters and contains each of the following:

  • a special character: @$#!%*?&

If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

To log in and use all the features of Khan Academy, please enable JavaScript in your browser.

Unit 1: Integrals review

Unit 2: integration techniques, unit 3: differential equations, unit 4: applications of integrals, unit 5: parametric equations, polar coordinates, and vector-valued functions, unit 6: series.

12 12 units 2

3 10 3 10 unit 2

2 + 2 2 2 + 2 2 units 2

5 3 5 3 units 2

8 π 8 π units 3

21 π 21 π units 3

10 π 3 10 π 3 units 3

60 π 60 π units 3

15 π 2 15 π 2 units 3

12 π 12 π units 3

11 π 6 11 π 6 units 3

π 6 π 6 units 3

Use the method of washers; V = ∫ −1 1 π [ ( 2 − x 2 ) 2 − ( x 2 ) 2 ] d x V = ∫ −1 1 π [ ( 2 − x 2 ) 2 − ( x 2 ) 2 ] d x

1 6 ( 5 5 − 1 ) ≈ 1.697 1 6 ( 5 5 − 1 ) ≈ 1.697

Arc Length ≈ 3.8202 Arc Length ≈ 3.8202

Arc Length = 3.15018 Arc Length = 3.15018

π 6 ( 5 5 − 3 3 ) ≈ 3.133 π 6 ( 5 5 − 3 3 ) ≈ 3.133

70 / 3 70 / 3

Approximately 43,255.2 43,255.2 ft-lb

156,800 156,800 N

Approximately 7,164,520,000 lb or 3,582,260 t

M = 24 , x – = 2 5 m M = 24 , x – = 2 5 m

( −1 , −1 ) ( −1 , −1 ) m

The centroid of the region is ( 3 / 2 , 6 / 5 ) . ( 3 / 2 , 6 / 5 ) .

The centroid of the region is ( 1 , 13 / 5 ) . ( 1 , 13 / 5 ) .

The centroid of the region is ( 0 , 2 / 5 ) . ( 0 , 2 / 5 ) .

6 π 2 6 π 2 units 3

  • d d x ln ( 2 x 2 + x ) = 4 x + 1 2 x 2 + x d d x ln ( 2 x 2 + x ) = 4 x + 1 2 x 2 + x
  • d d x ( ln ( x 3 ) ) 2 = 6 ln ( x 3 ) x d d x ( ln ( x 3 ) ) 2 = 6 ln ( x 3 ) x

∫ x 2 x 3 + 6 d x = 1 3 ln | x 3 + 6 | + C ∫ x 2 x 3 + 6 d x = 1 3 ln | x 3 + 6 | + C

4 ln 2 4 ln 2

  • d d x ( e x 2 e 5 x ) = e x 2 − 5 x ( 2 x − 5 ) d d x ( e x 2 e 5 x ) = e x 2 − 5 x ( 2 x − 5 )
  • d d t ( e 2 t ) 3 = 6 e 6 t d d t ( e 2 t ) 3 = 6 e 6 t

∫ 4 e 3 x d x = − 4 3 e −3 x + C ∫ 4 e 3 x d x = − 4 3 e −3 x + C

  • d d t 4 t 4 = 4 t 4 ( ln 4 ) ( 4 t 3 ) d d t 4 t 4 = 4 t 4 ( ln 4 ) ( 4 t 3 )
  • d d x log 3 ( x 2 + 1 ) = x ( ln 3 ) ( x 2 + 1 ) d d x log 3 ( x 2 + 1 ) = x ( ln 3 ) ( x 2 + 1 )

∫ x 2 2 x 3 d x = 1 3 ln 2 2 x 3 + C ∫ x 2 2 x 3 d x = 1 3 ln 2 2 x 3 + C

There are 81,377,396 81,377,396 bacteria in the population after 4 4 hours. The population reaches 100 100 million bacteria after 244.12 244.12 minutes.

At 5 % 5 % interest, she must invest $ 223,130.16 . $ 223,130.16 . At 6 % 6 % interest, she must invest $ 165,298.89 . $ 165,298.89 .

38.90 38.90 months

The coffee is first cool enough to serve about 3.5 3.5 minutes after it is poured. The coffee is too cold to serve about 7 7 minutes after it is poured.

A total of 94.13 94.13 g of carbon remains. The artifact is approximately 13,300 13,300 years old.

  • d d x ( tanh ( x 2 + 3 x ) ) = ( sech 2 ( x 2 + 3 x ) ) ( 2 x + 3 ) d d x ( tanh ( x 2 + 3 x ) ) = ( sech 2 ( x 2 + 3 x ) ) ( 2 x + 3 )
  • d d x ( 1 ( sinh x ) 2 ) = d d x ( sinh x ) −2 = −2 ( sinh x ) −3 cosh x d d x ( 1 ( sinh x ) 2 ) = d d x ( sinh x ) −2 = −2 ( sinh x ) −3 cosh x
  • ∫ sinh 3 x cosh x d x = sinh 4 x 4 + C ∫ sinh 3 x cosh x d x = sinh 4 x 4 + C
  • ∫ sech 2 ( 3 x ) d x = tanh ( 3 x ) 3 + C ∫ sech 2 ( 3 x ) d x = tanh ( 3 x ) 3 + C
  • d d x ( cosh −1 ( 3 x ) ) = 3 9 x 2 − 1 d d x ( cosh −1 ( 3 x ) ) = 3 9 x 2 − 1
  • d d x ( coth −1 x ) 3 = 3 ( coth −1 x ) 2 1 − x 2 d d x ( coth −1 x ) 3 = 3 ( coth −1 x ) 2 1 − x 2
  • ∫ 1 x 2 − 4 d x = cosh −1 ( x 2 ) + C ∫ 1 x 2 − 4 d x = cosh −1 ( x 2 ) + C
  • ∫ 1 1 − e 2 x d x = − sech −1 ( e x ) + C ∫ 1 1 − e 2 x d x = − sech −1 ( e x ) + C

52.95 ft 52.95 ft

Section 2.1 Exercises

13 12 13 12

243 square units

2 ( e − 1 ) 2 e 2 ( e − 1 ) 2 e

3 3 2 3 3 2

4 3 − ln ( 3 ) 4 3 − ln ( 3 )

−2 ( 2 − π ) −2 ( 2 − π )

1.067 1.067

0.852 0.852

7.523 7.523

3 π − 4 12 3 π − 4 12

1.429 1.429

$ 33,333.33 $ 33,333.33 total profit for 200 200 cell phones sold

3.263 3.263 mi represents how far ahead the hare is from the tortoise

343 24 343 24

π − 32 25 π − 32 25

Section 2.2 Exercises

32 3 2 32 3 2 units 3

7 24 π r 2 h 7 24 π r 2 h units 3

π 24 π 24 units 3

2 2 units 3

π 240 π 240 units 3

4096 π 5 4096 π 5 units 3

8 π 9 8 π 9 units 3

π 2 π 2 units 3

207 π 207 π units 3

4 π 5 4 π 5 units 3

16 π 3 16 π 3 units 3

π π units 3

72 π 5 72 π 5 units 3

108 π 5 108 π 5 units 3

3 π 10 3 π 10 units 3

2 6 π 2 6 π units 3

9 π 9 π units 3

π 20 ( 75 − 4 ln 5 ( 2 ) ) π 20 ( 75 − 4 ln 5 ( 2 ) ) units 3

m 2 π 3 ( b 3 − a 3 ) m 2 π 3 ( b 3 − a 3 ) units 3

4 a 2 b π 3 4 a 2 b π 3 units 3

2 π 2 2 π 2 units 3

2 a b 2 π 3 2 a b 2 π 3 units 3

V = 2 π 3 ( 2 r 3 - 3 r 2 h + h 3 ) V = 2 π 3 ( 2 r 3 - 3 r 2 h + h 3 ) units 3

π 3 ( h + R ) ( h − 2 R ) 2 π 3 ( h + R ) ( h − 2 R ) 2 units 3

Section 2.3 Exercises

54 π 54 π units 3

81 π 81 π units 3

512 π 7 512 π 7 units 3

2 π 2 π units 3

2 π 3 2 π 3 units 3

64 π 3 64 π 3 units 3

32 π 5 32 π 5 units 3

7 π 6 7 π 6

113 π 5 113 π 5

512 π 7 512 π 7

96 π 5 96 π 5 units 3

28 π 15 28 π 15 units 3

π 6 · 2 2 / 3 5 - 11 10 = π 10 12 · 2 2 / 3 - 11 ≈ 2 . 5286 π 6 · 2 2 / 3 5 - 11 10 = π 10 12 · 2 2 / 3 - 11 ≈ 2 . 5286 units 3

0.9876 0.9876 units 3

3 2 3 2 units 3

496 π 15 496 π 15 units 3

398 π 15 398 π 15 units 3

15.9074 15.9074 units 3

1 3 π r 2 h 1 3 π r 2 h units 3

π r 2 h π r 2 h units 3

π a 2 π a 2 units 3

Section 2.4 Exercises

π 6 ( 17 17 − 5 5 ) π 6 ( 17 17 − 5 5 )

13 13 − 8 27 13 13 − 8 27

2.0035 2.0035

123 32 123 32

1 675 ( 229 229 − 8 ) 1 675 ( 229 229 − 8 )

1 8 ( 4 5 + ln ( 9 + 4 5 ) ) 1 8 ( 4 5 + ln ( 9 + 4 5 ) )

1.201 1.201

15.2341 15.2341

49 π 3 49 π 3

70 π 2 70 π 2

120 π 26 120 π 26

π 6 ( 17 17 − 1 ) π 6 ( 17 17 − 1 )

9 2 π 9 2 π

10 10 π 27 ( 73 73 − 1 ) 10 10 π 27 ( 73 73 − 1 )

25.645 25.645

π ( π + 2 ) π ( π + 2 )

10.5017 10.5017

Answers may vary

For more information, look up Gabriel’s Horn.

Section 2.5 Exercises

150 150 ft-lb

200 J 200 J

ln ( 243 ) ln ( 243 )

332 π 15 332 π 15

100 π 100 π

20 π 15 20 π 15

18,750 18,750 ft-lb

Weight = 32 3 × 10 9 lb = 32 3 × 10 9 lb

Work = 4 3 × 10 12 ft-lb = 4 3 × 10 12 ft-lb

9.71 × 10 2 N m 9.71 × 10 2 N m

a. 3,000,000 3,000,000 lb, b. 750,000 750,000 lbs

23.25 π 23.25 π million ft-lb

A ρ H 2 2 A ρ H 2 2

Section 2.6 Exercises

( 2 3 , 2 3 ) ( 2 3 , 2 3 )

( 7 4 , 3 2 ) ( 7 4 , 3 2 )

3 L 4 3 L 4

e 2 + 1 e 2 − 1 e 2 + 1 e 2 − 1

π 2 − 4 π π 2 − 4 π

1 4 ( 1 + e 2 ) 1 4 ( 1 + e 2 )

( a 3 , b 3 ) ( a 3 , b 3 )

( 0 , π 8 ) ( 0 , π 8 )

( 0 , 3 ) ( 0 , 3 )

( 0 , 4 π ) ( 0 , 4 π )

( 5 8 , 1 3 ) ( 5 8 , 1 3 )

2 m π 3 2 m π 3

π a 2 b π a 2 b

( 4 3 π , 4 3 π ) ( 4 3 π , 4 3 π )

( 1 2 , 2 5 ) ( 1 2 , 2 5 )

( 0 , 28 9 π ) ( 0 , 28 9 π )

Center of mass: ( a 6 , 4 a 2 5 ) , ( a 6 , 4 a 2 5 ) , volume: 2 π a 4 9 2 π a 4 9

Volume: 2 π 2 a 2 ( b + a ) 2 π 2 a 2 ( b + a )

Section 2.7 Exercises

− 1 x ( ln x ) 2 − 1 x ( ln x ) 2

ln ( x + 1 ) + C ln ( x + 1 ) + C

ln ( x ) + 1 ln ( x ) + 1

cot ( x ) cot ( x )

csc ( x ) sec x csc ( x ) sec x

−2 tan x −2 tan x

1 2 ln ( 5 3 ) 1 2 ln ( 5 3 )

2 − 1 2 ln ( 5 ) 2 − 1 2 ln ( 5 )

1 ln ( 2 ) − 1 1 ln ( 2 ) − 1

1 2 ln ( 2 ) 1 2 ln ( 2 )

1 3 ( ln x ) 3 1 3 ( ln x ) 3

2 x 3 x 2 + 1 x 2 − 1 2 x 3 x 2 + 1 x 2 − 1

x −2 − ( 1 / x ) ( ln x − 1 ) x −2 − ( 1 / x ) ( ln x − 1 )

e x e − 1 e x e − 1

− 1 x 2 − 1 x 2

π − ln ( 2 ) π − ln ( 2 )

e 5 − 6 units 2 e 5 − 6 units 2

ln ( 4 ) − 1 units 2 ln ( 4 ) − 1 units 2

2.8656 2.8656

3.1502 3.1502

Section 2.8 Exercises

False; k = ln ( 2 ) t k = ln ( 2 ) t

20 20 hours

No. The relic is approximately 871 871 years old.

71.92 71.92 years

5 5 days 6 6 hours 27 27 minutes

8.618 % 8.618 %

$ 6766.76 $ 6766.76

9 9 hours 13 13 minutes

239,179 239,179 years

P ′ ( t ) = 43 e 0.01604 t . P ′ ( t ) = 43 e 0.01604 t . The population is always increasing.

The population reaches 10 10 billion people in 2027 . 2027 .

P ′ ( t ) = 2.259 e 0.06407 t . P ′ ( t ) = 2.259 e 0.06407 t . The population is always increasing.

Section 2.9 Exercises

e x and e − x e x and e − x

3 sinh ( 3 x + 1 ) 3 sinh ( 3 x + 1 )

− tanh ( x ) sech ( x ) − tanh ( x ) sech ( x )

4 cosh ( x ) sinh ( x ) 4 cosh ( x ) sinh ( x )

x sech 2 ( x 2 + 1 ) x 2 + 1 x sech 2 ( x 2 + 1 ) x 2 + 1

6 sinh 5 ( x ) cosh ( x ) 6 sinh 5 ( x ) cosh ( x )

1 2 sinh ( 2 x + 1 ) + C 1 2 sinh ( 2 x + 1 ) + C

1 2 sinh 2 ( x 2 ) + C 1 2 sinh 2 ( x 2 ) + C

1 3 cosh 3 ( x ) + C 1 3 cosh 3 ( x ) + C

ln ( 1 + cosh ( x ) ) + C ln ( 1 + cosh ( x ) ) + C

cosh ( x ) + sinh ( x ) + C cosh ( x ) + sinh ( x ) + C

4 1 − 16 x 2 4 1 − 16 x 2

sinh ( x ) cosh 2 ( x ) + 1 sinh ( x ) cosh 2 ( x ) + 1

− csc ( x ) − csc ( x )

− 1 ( x 2 − 1 ) tanh −1 ( x ) − 1 ( x 2 − 1 ) tanh −1 ( x )

1 a tanh −1 ( x a ) + C 1 a tanh −1 ( x a ) + C

x 2 + 1 + C x 2 + 1 + C

cosh −1 ( e x ) + C cosh −1 ( e x ) + C

37.30 37.30

y = 1 c cosh ( c x ) y = 1 c cosh ( c x )

−0.521095 −0.521095

Review Exercises

16 3   units 3 16 3   units 3

162 π 5 162 π 5

a. 4 , 4 , b. 128 π 7 , 128 π 7 , c. 64 π 5 64 π 5

a. 1.949 , 1.949 , b. 21.952 , 21.952 , c. 17.099 17.099

a. 31 6 , 31 6 , b. 452 π 15 , 452 π 15 , c. 31 π 6 31 π 6

245.282 245.282

Mass: 1 2 , 1 2 , center of mass: ( 18 35 , 9 22 ) ( 18 35 , 9 22 )

17 + 1 8 ln ( 33 + 8 17 ) 17 + 1 8 ln ( 33 + 8 17 )

Volume: 3 π 4 , 3 π 4 , surface area: π ( 2 − sinh −1 ( 1 ) + sinh −1 ( 16 ) − 257 16 ) π ( 2 − sinh −1 ( 1 ) + sinh −1 ( 16 ) − 257 16 )

π ( 1 + sinh ( 1 ) cosh ( 1 ) ) π ( 1 + sinh ( 1 ) cosh ( 1 ) )

As an Amazon Associate we earn from qualifying purchases.

This book may not be used in the training of large language models or otherwise be ingested into large language models or generative AI offerings without OpenStax's permission.

Want to cite, share, or modify this book? This book uses the Creative Commons Attribution-NonCommercial-ShareAlike License and you must attribute OpenStax.

Access for free at https://openstax.org/books/calculus-volume-2/pages/1-introduction
  • Authors: Gilbert Strang, Edwin “Jed” Herman
  • Publisher/website: OpenStax
  • Book title: Calculus Volume 2
  • Publication date: Mar 30, 2016
  • Location: Houston, Texas
  • Book URL: https://openstax.org/books/calculus-volume-2/pages/1-introduction
  • Section URL: https://openstax.org/books/calculus-volume-2/pages/chapter-2

© Feb 5, 2024 OpenStax. Textbook content produced by OpenStax is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike License . The OpenStax name, OpenStax logo, OpenStax book covers, OpenStax CNX name, and OpenStax CNX logo are not subject to the Creative Commons license and may not be reproduced without the prior and express written consent of Rice University.

  • Undergraduate
  • Administration
  • Scholarships
  • AWM Chapter

Math 21200: Calculus II

Supervisor: Niel Shell

Techniques of integration, exponential growth and decay, separable differential equations, improper integrals, infinite sequences and series, polar coordinates, areas in polar coordinates, geometry of space, and quadric surfaces.

Prerequisite: Grade of C or higher in Math 20100 or placement by the Department. (Part of sequence 20100, 21200, 21300.) 4 hr./wk.; 4 cr.

CAREER: undergraduate

CATEGORY: regular

TERM OFFERED: Fall, Spring, Summer

Textbook: Calculus: Early Transcendentals (9th edition), Stewart, Clegg and Watson (Cengage)

This is the text, effective Spring 2024.

Update of the Supplementary Notes in Progress

The material in the Supplementary Notes documents remains unchanged. All that is being updated is the deletion of references to pages and sections from the old text.

Syllabus and Homework

The syllabus that went into effect Fall 2022 has not changed. "Math 212 Syllabus and Homework Effective Spring 2024" document below has been updated for use with the current textbook. It consists of three parts:

First, a table in which the first three columns constitute the syllabus and in which the fourth column contains a suggested list of homework problems from the text.

Second, a supplementary set of suggested homework problems which are not from the text. The supplementary problem numbers are preceded by an "s." For example, in the suggested homework problems for Section 7.2, the entry s1 refers to supplementary problem 7.2/s1.

Third, answers and selected solutions to all even numbered suggested problems from the text and all supplementary problems.

For the convenience of students who have access to the Thomas's Calculus: Early Transcendentals, the "Math 212 Syllabus and Homework End After Fall 2023" pdf for that text has been kept to provide additional exercises. Copies of both the 14th and 15th edition will be placed on reserve at both the NAC library and the Marshak library.

All of the suggested problems from that text are in both the 14th and 15th editions, usually with the same number. If the 14th and 15th edition numbers for a problem are different, the listing shows, for example, 53(51), that the problem is listed as number 53 in the 15th edition and number 51 in the 14th edition. Information about online homework problems will be included when available.

ONLINE HOMEWORK: Ask your instructor for a link to your webwork online homework.

The login is the name of you CCNY mail address: For example, my email is [email protected], so my webwork name is nshell. The password is the same as your CCNY email password.

Spring 2019 through Summer 2022 Math 212 Calculus II with Introduction to Multivariate Functions

Math 212 (4 hours/4 credits) replaced Math 202 (4 hours/3 credits) as part of a plan to replace the previous calculus sequence consisting of Math 201, 202, 203 and part of 392 with a three semester sequence. This version of Math 212 was changed, effective Fall 2022, to make it comparable to Calculus II in other CUNY schools. Vectors, parametric equations and the introduction to multivariate functions were deleted from the syllabus, and exponential growth and decay, separable differential equations and areas using polar coordinates were added.

Tutoring for Spring 2024

1 In-person tutoring is available in Marshak, Room 106, Monday, Tuesday and Thursday 11am-6pm, Thursday 11am-5pm and Friday 11am-4pm. No appointment necessary. Available Jan 29 through May 22, except Feb 12, Feb 19, and Apr 22--Apr 30.

For more information please email the Tutor Coordinator, Andy Trafford, at [email protected]

2 Artino Mathematics Tutoring Center: Monday-Friday, Room NAC 1/511; remote Saturday-Sunday, meeting ID 874 4669 1935; passcode: 2023

Hours: Mon, Wed 10-6; Tue, Thur 10:30-8:30; Fri 12-5; Sat 12-5; Sun 5-10 pm

Tutoring sessions for Math 190, 195, 205, 209, 201, 212, and Eco 102

Solver Title

Practice

Generating PDF...

  • Pre Algebra Order of Operations Factors & Primes Fractions Long Arithmetic Decimals Exponents & Radicals Ratios & Proportions Percent Modulo Number Line Mean, Median & Mode
  • Algebra Equations Inequalities System of Equations System of Inequalities Basic Operations Algebraic Properties Partial Fractions Polynomials Rational Expressions Sequences Power Sums Interval Notation Pi (Product) Notation Induction Logical Sets Word Problems
  • Pre Calculus Equations Inequalities Scientific Calculator Scientific Notation Arithmetics Complex Numbers Polar/Cartesian Simultaneous Equations System of Inequalities Polynomials Rationales Functions Arithmetic & Comp. Coordinate Geometry Plane Geometry Solid Geometry Conic Sections Trigonometry
  • Calculus Derivatives Derivative Applications Limits Integrals Integral Applications Integral Approximation Series ODE Multivariable Calculus Laplace Transform Taylor/Maclaurin Series Fourier Series Fourier Transform
  • Functions Line Equations Functions Arithmetic & Comp. Conic Sections Transformation
  • Linear Algebra Matrices Vectors
  • Trigonometry Identities Proving Identities Trig Equations Trig Inequalities Evaluate Functions Simplify
  • Statistics Mean Geometric Mean Quadratic Mean Average Median Mode Order Minimum Maximum Probability Mid-Range Range Standard Deviation Variance Lower Quartile Upper Quartile Interquartile Range Midhinge Standard Normal Distribution
  • Physics Mechanics
  • Chemistry Chemical Reactions Chemical Properties
  • Finance Simple Interest Compound Interest Present Value Future Value
  • Economics Point of Diminishing Return
  • Conversions Roman Numerals Radical to Exponent Exponent to Radical To Fraction To Decimal To Mixed Number To Improper Fraction Radians to Degrees Degrees to Radians Hexadecimal Scientific Notation Distance Weight Time Volume
  • Pre Algebra
  • Pre Calculus
  • First Derivative
  • Product Rule
  • Quotient Rule
  • Sum/Diff Rule
  • Second Derivative
  • Third Derivative
  • Higher Order Derivatives
  • Derivative at a point
  • Partial Derivative
  • Implicit Derivative
  • Second Implicit Derivative
  • Derivative using Definition
  • Slope of Tangent
  • Curved Line Slope
  • Extreme Points
  • Tangent to Conic
  • Linear Approximation
  • Difference Quotient
  • Horizontal Tangent
  • One Variable
  • Multi Variable Limit
  • At Infinity
  • L'Hopital's Rule
  • Squeeze Theorem
  • Substitution
  • Sandwich Theorem
  • Indefinite Integrals
  • Definite Integrals
  • Partial Fractions
  • U-Substitution
  • Trigonometric Substitution
  • Weierstrass Substitution
  • Long Division
  • Improper Integrals
  • Antiderivatives
  • Double Integrals
  • Triple Integrals
  • Multiple Integrals
  • Limit of Sum
  • Area under curve
  • Area between curves
  • Area under polar curve
  • Volume of solid of revolution
  • Function Average
  • Riemann Sum
  • Trapezoidal
  • Simpson's Rule
  • Midpoint Rule
  • Geometric Series Test
  • Telescoping Series Test
  • Alternating Series Test
  • P Series Test
  • Divergence Test
  • Comparison Test
  • Limit Comparison Test
  • Integral Test
  • Absolute Convergence
  • Radius of Convergence
  • Interval of Convergence
  • Linear First Order
  • Linear w/constant coefficients
  • Second Order
  • Non Homogenous
  • System of ODEs
  • IVP using Laplace
  • Series Solutions
  • Method of Frobenius
  • Gamma Function
  • Taylor Series
  • Maclaurin Series
  • Fourier Series
  • Fourier Transform
  • Linear Algebra
  • Trigonometry
  • Conversions

Click to reveal more operations

Most Used Actions

Number line.

  • \lim_{x\to 3}(\frac{5x^2-8x-13}{x^2-5})
  • \lim _{x\to \:0}(\frac{\sin (x)}{x})
  • \int e^x\cos (x)dx
  • \int \cos^3(x)\sin (x)dx
  • \int_{0}^{\pi}\sin(x)dx
  • \frac{d}{dx}(\frac{3x+9}{2-x})
  • \frac{d^2}{dx^2}(\frac{3x+9}{2-x})
  • implicit\:derivative\:\frac{dy}{dx},\:(x-y)^2=x+y-1
  • \sum_{n=0}^{\infty}\frac{3}{2^n}
  • tangent\:of\:f(x)=\frac{1}{x^2},\:(-1,\:1)
  • What is calculus?
  • Calculus is a branch of mathematics that deals with the study of change and motion. It is concerned with the rates of changes in different quantities, as well as with the accumulation of these quantities over time.
  • What are calculus's two main branches?
  • Calculus is divided into two main branches: differential calculus and integral calculus.
  • What is the best calculator for calculus?
  • Symbolab is the best calculus calculator solving derivatives, integrals, limits, series, ODEs, and more.
  • What is differential calculus?
  • Differential calculus is a branch of calculus that includes the study of rates of change and slopes of functions and involves the concept of a derivative.
  • What is integral calculus?
  • Integral calculus is a branch of calculus that includes the determination, properties, and application of integrals. This can be used to solve problems in a wide range of fields, including physics, engineering, and economics.

calculus-calculator

  • High School Math Solutions – Derivative Calculator, the Basics Differentiation is a method to calculate the rate of change (or the slope at a point on the graph); we will not...

Please add a message.

Message received. Thanks for the feedback.

Lambda Calculus

COMP 105 Assignment

Due Wednesday, April 17, 2019 at 11:59PM

Lambda calculus is not just a universal model of computation—it is also a language you can use to communicate with educated people around the world. In this assignment,

  • You use lambda calculus to write simple functions
  • You implement lambda calculus using substitution, reduction, and alpha-conversion

Substitution, reduction, and alpha-conversion are found all over programming-language semantics, not just in lambda calculus.

TL;DR: download the template solution and compile with compile105-lambda . Everything will be fine.

Behind the curtain: For the first part, coding in lambda calculus, you will code things from scratch. For the second part, implementing lambda calculus, you will extend an interpreter I’ve written. But because you can work with ML modules now, you won’t be stuck modifying a huge pile of code. Instead, you’ll define several modules, for both implementation and testing, and you’ll use several of my interfaces.

The ML module system is nice, but Moscow ML’s module bureaucracy is not at all nice. I’ve hidden the bureaucracy behind a shell script, compile105-lambda . This script lives in /comp/105/bin , and if you run use comp105 at the command line, you have access to it. But if something goes wrong, you may wish to know about the pieces of the assignment. Here are the source codes: 1

church.lam Your solutions to the first part solution.sml Your module implementing terms, substitution, and reduction client.sml Your module demonstrating term functions string-tests.sml Test cases for your classmates’ code subst-tests.sml Test cases for substitution link-lambda.sml Instructions for linking your code with mine link-lambda-a.sml More instructions for linking your code with mine link-lamstep.sml Even more instructions for linking your code with mine

Using these sources, the compile105-lambda script will create binaries:

./run-solution-unit-tests Runs some of your unit tests ./run-client-unit-tests Runs more unit tests ./run-string-tests Runs more unit tests ./run-subst-tests Runs the last of your unit tests ./linterp Runs your complete interpreter (normal-order reduction) ./lamstep Runs your interpreter, showing each reduction ./linterp-applicative Runs your complete interpreter (applicative-order reduction)

Learning about the lambda calculus

There is no book chapter on the lambda calculus. Instead, we refer you to these resources:

The edited version of Raúl Rojas’s “ A Tutorial Introduction to the Lambda Calculus ” is short, easy to read, and covers the same points that are covered in lecture:

  • Free and bound variables
  • Capture-avoiding substitution
  • Addition and multiplication with Church numerals
  • Church encoding of Booleans and conditions
  • The predecessor function on Church numerals
  • Recursion using the Y combinator

Rojas doesn’t provide many details, but he covers everything you need to know in 9 pages, with no distracting theorems or proofs.

When you want a short, easy overview to help you solidify your understanding, Rojas’s tutorial is your best source.

I have written a short guide to coding in Lambda calculus . It shows how to translate ML-like functions and data, which you already know how to program with, into lambda calculus.

When you are solving the individual programming problems, this guide is your best source.

Prakash Panangaden’s “ Notes on the Lambda-Calculus ” cover the same material as Rojas, but with more precision and detail. Prakash is particularly good on capture-avoiding substitution and change of bound variables, which you will implement.

Prakash also discusses more theoretical ideas, such as how you might prove inequality (or inequivalence) of lambda-terms. And instead of just presenting the Y combinator, Prakash goes deep into the ideas of fixed points and solving recursion equations—which is how you achieve recursion in lambda calculus.

When you are getting ready to implement substitution, Prakash’s notes are your best source.

I have also written a short guide to reduction strategies . It is more useful than anything that could be found online in 2018. As a bonus, it also explains eta-reduction , which is neglected by other sources.

When you have finished implementing substitution and are ready to implement reduction, this guide is your best source.

Wikipedia offers two somewhat useful pages: 2

The Lambda Calculus page covers everything you’ll find in Rojas and much more besides. (If you wish, you can read what Wikipedia says about reduction strategies and evaluation strategies. But do not expect to be enlightened.)

The Church Encoding page goes into more detail about how to represent ordinary data as terms in the lambda calculus. The primary benefit relative to Rojas is that Wikipedia describes more kinds of arithmetic and other functions on Church numerals.

You need to know that the list encoding used on Wikipedia is not the list encoding used in COMP 105 . In order to complete the homework problems successfully, you must use the list encoding described in the guide to coding in lambda calculus .

Introduction to the lambda interpreter

You will implement the key components of an interactive interpreter for the lambda calculus. This section explains how to use the interpreter and the syntax it expects. A reference implementation of the interpreter is available in /comp/105/bin/linterp-nr .

The syntax of definitions

Like the interpreters in the book, the lambda interpreter processes a sequence of definitions. The concrete syntax is very different from the “bridge languages” in the book. Every definition must be terminated with a semicolon. Comments are line comments in C++ style, starting with the string // and ending at the next newline.

The interpreter supports four forms of definition: a binding, a term, the extended definition “ use ”, and an extended definition “ check-equiv ”.

A binding is something like a val form in μ Scheme. A binding has one of two forms: either

In both forms, every free variable in the term must be bound in the environment—if a right-hand side contains an unbound free variable, the result is a checked run-time error. The first step of computation is to substitute for each of the free variables: each occurrence of each free variable is replaced by that variable’s definition.

In the first form, where noreduce appears, no further computation takes place. The substituted right-hand side is simply associated with the name on the left, and this binding is added to the environment.

The noreduce form is intended only for terms that cannot be normalized, such as

The noreduce form is also needed for definitions that use terms like bot  and  Y .

If noreduce is absent, the interpreter substitutes for free variables, then reduces the term on the right until there are no more beta-redexes or eta-redexes. (You will implement the two reduction strategies presented in class.) If reduction doesn’t terminate, the interpreter might loop.

Loading files with use

The use extended definition loads a file into the interpreter as if it had been typed in directly. It takes the form

Comparing normal forms with check-equiv

The check-equiv form immediately reduces two terms to normal form and compares them for equivalence. It has the form

And here are some examples:

Unlike the check-expect in the other interpreters, check-equiv is not “saved for later”—the given terms are normalized right away.

Terms as definitions

As in the book, a term can be entered at the read-eval-print loop, just as if it were a definition. Every free variable in the term is checked to see if it is bound in the environment; if so, each free occurrence is replaced by its binding. Free variables that are not bound in the environment are permissible; they are left alone. 3 The term is reduced to normal form (if possible) and the result is printed.

The syntax of terms

A lambda term can be either a variable, a lambda abstraction, an application, or a parenthesized lambda term. Precedence is as in ML.

A lambda abstraction abstracts over exactly one variable; it is written as follows:

Application of one term to another is written:

The lambda interpreter is very liberal about names of variables. A name is any string of characters that contains neither whitespace, nor control characters, nor any of the following characters: \ ( ) . = / . Also, the string use is reserved and is therefore not a name. But a name made up entirely of digits is OK; the lambda calculus has no numbers, and names like 105 have no special status.

As examples, all the following definitions are legal:

A short example transcript

A healthy lambda interpreter should be capable of something like the following transcript:

For more example definitions, see the predefined.lam file distributed with the assignment.

Software provided for you

Both capture-avoiding substitution and normal-order reduction can be tricky to implement. 4 So that you may have a solid foundation on which to write your lambda code, I provide an interpreter linterp-nr . Running use comp105 should give you access to that interpreter.

Even with a correct interpreter, lambda code can be hard to debug. So I also provide an interpreter called lamstep-nr , which shows every reduction step. Some computations require a lot of reduction steps and produce big intermediate terms. Don’t be alarmed.

All questions and problems

There are four problems on programming with Church numerals, which you’ll do on your own.

There are four problems on implementing the lambda calculus, which you can do with a partner. Your solutions will go into a Standard ML module, which you will link with the rest of the interpreter.

Reading comprehension

These problems will help guide you through the reading. We recommend that you complete them before starting the other problems below. You can download the questions .

(NOT ON THE READING.) Throughout the term, your code’s functional correctness has been assessed by automated testing. The automated test scripts are intended not only to assign a grade but to identify the most important fault in the code. Please answer these two questions:

How did you benefit from the feedback you received about functional correctness?

What were the drawbacks, if any, of the feedback you received about functional correctness?

Syntax of lambda terms . In this assignment, or in Rojas or Panangaden, read about the concrete syntax of lambda-terms . Now define, in Standard ML, an algebraic data type term that represents the abstract syntax of terms. Your data type should have one value constructor for a variable, one for a lambda abstraction, and one for an application.

You are ready for exercise 5, and you have a foundation for exercises 6 and 8.

Recognizing redexes . Read about redexes in Wikipedia . (You will then follow up with Panangaden .)

Wikipedia mentions two kinds of redex. What are their names?

In Panangaden, Definition 1.7 defines a redex. Which of the two redexes mentioned in Wikipedia is being defined here?

Your code will have to recognize redexes, and it starts with knowing the form of each kind. As of Spring 2019, both forms are shown in Wikipedia. But if Wikipedia changes, one form can be found in Panangaden; for the other, look in the last section of my guide to reduction strategies.

For each of the two kinds of redex, use the concrete syntax for our lambda interpreter ( see above ) to show what form every redex of that kind takes.

For each of the two kinds of redex, use your algebraic data type from the preceding question to write a pattern that matches every redex of that kind.

You are getting ready for exercise 8 (reductions).

Practicing reduction . Read about reduction on Wikipedia. Then in Panangaden , be sure you have an idea about each of these concepts:

Capture-avoiding substitution (Definition 1.3)

Reduction (Definition 1.5), including the example reduction (Example 1.3)

Redex , contractum , and normal form (Definitions 1.7 and 1.8)

Showing each reduction step, reduce the following term to normal form. At each step, choose a redex and replace the redex with its contractum. Do not expand or replace the names ZERO and NONZERO .

The term contains more than one redex, but no matter which redex you choose at each step, you should reach the normal form after exactly four reductions.

You are preparing to complete exercise 8.

Reduction: the general case . For each kind of redex, repeat the general form of the redex from question 2(c) 3(c) above, then show what syntactic form the redex reduces to (in just a single reduction step).

When to reduce . Read my handout on reduction strategies . Using the concrete syntax accepted by the interpreter (and defined above) , write a lambda term that contains exactly two redexes, such that normal-order reduction strategy reduces one redex, and applicative-order reduction strategy reduces the other redex.

You are (finally!) ready for exercise 8.

Understanding Church numerals . You may recognize the practice reduction above as a computation that tells if a Church numeral is zero. Read about Church numerals, either on pages 9 and 10 of Panangaden or in Section 2 of Rojas (“Arithmetic”). Then, say whether each of the following lambda-calculus terms is a Church numeral. If so, write the corresponding decimal representation. If not, write “not a Church numeral”.

Programming in the lambda calculus (individual problems)

These problems give you a little practice programming in the lambda calculus. Most functions must terminate in linear time , and you must do these exercises by yourself. You can use the reference interpreter linterp-nr .

Lambda-calculus programs work at the same intellectual level as assembly-language programs. Therefore, every new helper function must be well named and must be accompanied by a contract. Detailed guidance can be found below .

Helper functions listed in the assignment are exempt from the contract requirement, as are the helper functions in predefined.lam .

Complete all four problems below, and place your solutions in file church.lam .

Not counting code copied from the lecture notes, my solutions to all four problems total less than fifteen lines of code. And all four problems rely on the same related reading.

Related reading for lambda-calculus programming problems 1 to 4:

My guide Coding in Lambda Calculus should explain everything you need to know to write functional programs in lambda calculus. If not, or if the explanations there are a little too terse, consult the additional readings below.

Basic techniques can be found in Wikipedia on Church Encoding and in section 2 of Panangaden , which is titled “Computing with Lambda Calculus” (from page 8 to the middle of page 10). These basics are sufficient for you to tackle problems 1 and 2.

Another alternative is Section 2 of Rojas’s tutorial, entitled “arithmetic.” Rojas doesn’t mention Church numerals by name, but that’s what he’s working with. You may find the examples useful and the presentation more accessible than what you see from Panangaden.

On problems 3 and 4 only, if you have the urge to write a recursive function, you may use a fixed-point combinator. My guide ends with a few pages on recursion. You may also wish to consult the first paragraph under “Fixed-Point Combinators” on page 10 of Panangaden . This explanation is by far the best and simplest explanation available—but it is very terse. For additional help, consult the examples on page 11.

I recommend against the Wikipedia “main article” on fixed-point combinators: the article is all math all the time, and it won’t give you any insight into how to use a fixed-point combinator.

1. Church Numerals—parity . Without using recursion or a fixed-point combinator , define a function even? which, when applied to a Church numeral, returns the Church encoding of true or false , depending on whether the numeral represents an even number or an odd number.

Your function must terminate in time linear in the size of the Church numeral.

Ultimately, you will write your function in lambda notation acceptable to the lambda interpreter, but you may find it useful to try to write your initial version in Typed μScheme (or ML or μ ML or μScheme) to make it easier to debug.

Remember these basic terms for encoding Church numerals and Booleans:

You can load these definitions by typing use predefined.lam; in your interpreter.

2. Church Numerals—division by two . Without using recursion or a fixed-point combinator , define a function div2 which divides a Church numeral by two (rounding down). That is, div2 applied to the numeral for 2 n returns  n , and div2 applied to the numeral for 2 n  + 1 also returns  n .

We don’t know if this one can be done in linear time, but it is sufficient if your function terminates in time quadratic in the size of the Church numeral.

Hint : Think about function split-list from the Scheme homework , about the implementation of the predecessor function on natural numbers, and about the “window” example from recitation.

3. Church Numerals—conversion to binary. Implement the function binary from the Impcore homework . The argument and result must be Church numerals. For example,

For this problem, you may use the Y combinator. If you do, remember to use noreduce when defining binary , e.g.,

This problem, although not so difficult, may be time-consuming. If you get bogged down, go forward to the list-selection problem ( nth ), which can benefit from similar skills in recursion, fixed points, and Church numerals. Then come back to this problem.

Your function must terminate in time quadratic in the size of the Church numeral.

EXTRA CREDIT . Write a function binary-sym that takes three arguments: a name for zero, a name for one, and a Church numeral. Function binary-sym reduces to a term that “looks like” the binary representation of the given Church numeral. Here are some examples where I represent a zero by a capital  O  (oh) and a one by a lower-case  l  (ell):

It may help to realize that l l O l is the application (((l l) O) l) —it is just like the example E 1 E 2 E 3 … E n in the first section of Rojas’s tutorial .

Function binary-sym has little practical value, but it’s fun. If you write it, please put it in your church.lam file, and mention it in your README file.

4. Church Numerals—list selection . Write a function nth such that given a Church numeral n and a church-encoded list xs of length at least n +1, nth n xs returns the n th element of xs :

To get full credit for this problem, you must solve it without recursion. But if you want to define nth as a recursive function, use the Y combinator, and use noreduce to define nth .

Provided xs  is long enough, function  nth must terminate in time linear in the length of the list. Don’t even try to deal with the case where xs is too short.

Hint: One option is to go on the web or go to Rojas and learn how to tell if a Church numeral is zero and if not, and how to take its predecessor. There are other, better options.

Implementing the lambda calculus (possibly with a partner)

For problems 5 to 8 below, you may work on your own or with a partner. These problems help you learn about substitution and reduction, the fundamental operations of the lambda calculus. The first problem also gives you a little more practice in using continuation-passing to code an algebraic data type, which is an essential technique in lambda-land.

For each problem, you will implement types and functions described below. When you are done, the compile105-lambda script will link your code with mine to build a complete lambda interpreter. To simplify the configuration, most of the functions and types you must define will be placed in a module called SealedSolution , which you will implement in a single file called solution.sml . The module must be sealed with this interface:

You can download a template solution .

5 . Evaluation—Coding terms .

In your file solution.sml , create an ML type definition for a type term , which should represent a term in the untyped lambda calculus. Using your representation, define functions lam , app , var , and cpsLambda .

Compile this file by running compile105-lambda (with no arguments), then run any internal unit tests by running ./run-solution-unit-tests .

My solution is under 15 lines of ML code.

Related reading: The syntax of lambda terms in this homework.

6 . Evaluation—Substitution . In file solution.sml , implement capture-avoiding substitution on your term representation. In particular,

Define function freeIn of type string -> term -> bool , which tells if a given variable occurs free in a given term. (If you adapt your solution to the pair problem on the ML homework, or my model solution to that problem, acknowledge your sources!)

Define function freeVars of type term -> string list , which returns the variables free in a given term. The list must have no duplicates.

Define function subst of type string * term -> term -> term . Calling subst ( x , N ) M returns the term M [ x  ↦  N ] (“ M  with x goes to  N ”).

Function subst obeys these algebraic laws, 5 in which x  and  y stand for variables, and N  and  M stand for terms:

  • subst ( x , N ) x = N
  • subst ( x , N ) y = y , provided y is different from  x
  • subst ( x , N ) ( M 1 M 2 ) = ( subst ( x , N ) M 1 ) ( subst ( x , N ) M 2 )
  • subst ( x , N ) ( λ x . M ) = ( λ x . M )
  • subst ( x , N ) ( λ y . M ) = λ y .( subst ( x , N ) M ) , provided x  is not free in  M or y  is not free in  N , and also provided y is different from  x

If none of the cases above apply, then subst ( x , N )  M should return subst ( x , N )  M ′ , where M ′  is a term that is obtained from  M by renaming bound variables. Renaming a bound variable is called “alpha conversion.”

You need to rename bound variables only if you encounter a case that is like case (e), but in which x  is free in  M and y  is free in  N . In such a case, subst ( x ,  N )  ( λ y . M ) can be calculated only by renaming  y , which is bound in the lambda abstraction, to some new variable that is not free in M  or  N .

To help you implement subst , you may find it useful to define this helper function:

  • Function freshVar , which is given a list of variables and produces a variable that is different from every variable on the list

By using freshVar on the output of freeVars , you will be able to implement alpha conversion.

To test this problem, you have three possible approaches:

The next problem demands a minimal set of test cases. You can stick with this set and choose not to worry about further testing.

You can add Unit tests to your solution.sml file. You would then compile it by running compile105-lambda with no arguments, and run the binary ./run-solution-unit-tests that results.

You can also build and run the full interpreter ./linterp , again by running compile105-lambda without arguments. But be warned: you may see some alarming-looking terms that have extra lambdas and applications. This is because the interpreter uses lambda to substitute for the free variables in your terms. Here’s a sample:

Everything is correct here except that the code claims something is in normal form when it isn’t. If you reduce the term by hand, you should see that it has the normal form you would expect.

My solution to this problem is just under 40 lines of ML code.

Related reading:

Panangaden describes free and bound variables in Definition 1.2 on page 2. He defines substitution in Definition 1.3 on page 3. (His notation is a little different from our ML code, but the laws for subst are the same.)

In his Definition 1.3, case 6, plus Definition 1.4, Panangaden explains the “change of bound variables” that you need to implement if none of the cases for subst apply.

Page 470 of your book defines an ML function freshName which is similar to the function freshVar that you need to implement. The freshName on page 470 uses an infinite stream of candidate variables. You could copy all the stream code from the book, but it will probably be simpler just to define a tail-recursive function that tries an unbounded number of variables.

Don’t emulate function freshtyvar on page 517. It’s good enough for type inference, but it’s not good enough to guarantee freshness in the lambda calculus.

7 . Substitution tests . As shown in the previous problem, function subst has to handle five different cases correctly. It also has to handle a sixth case, in which none of the laws shown above applies, and renaming is required. In this problem, you create test cases for your subst function. They should go into a file subst-tests.sml , which should look like this:

To run these tests, run compile105-lambda without arguments, then run the resulting binary ./run-subst-tests .

8 . Evaluation—Reductions . In this problem, you use your substitution function to implement two different reduction strategies, called reduceN and reduceA .

A reduction strategy is a function that takes a term  M and produces a one of the following two values:

  • Reduction.DOESN'T_STEP , if it is not possible to reduce  M
  • Reduction.ONE_STEPS_TO  N , if  M  reduces to  N in a single step

The relation “ M  reduces to  N in a single step” is written M  →  N , and it is explained in the handout on reduction strategies as well as in many other sources on the lambda calculus.

Each function takes a term and tries to perform a single reduction step, using any rule that applies: Beta , Eta , Mu , Nu , or Xi . (The rules are shown in the handout on reduction strategies.) Each function is specified as follows:

Function reduceN implements normal-order reduction: it tries the leftmost, outermost redex first. In other words, it prefers Beta over Nu and Nu over Mu ).

Function reduceA implements applicative-order reduction: it uses the Beta rule only when the argument is normal form. In other words, it prefers Mu over Beta .

Both functions must also implement Eta reduction.

To compile and test this code, run compile105-lambda without arguments, then test using ./linterp (normal-order reduction), ./lamstep (normal-order reduction, showing each step), and ./linterp-applicative (applicative-order reduction). You may also wish to consult the hints below.

I’ve written two solutions to this problem. One solution uses only first-order functions: it implements reduceN and reduceA directly, by extensive case analysis. My first-order solution is about 30 nonblank lines of ML code. The other solution uses higher-order functions to define reduceN and reduceA . It implements each rule as its own function, then combines them using the >=> operator described below. My higher-order solution is about 25 nonblank lines of ML code.

Start with my guide, “ Reduction Strategies for Lambda Calculus .”

For implementation, read the Hints on the implementation of reduction section below.

Consider consulting Panangaden , who describes the reduction relation in Definition 1.5. Although he treats it as a mathematical relation, not a computational rule, you may find his definitions helpful. But some commentary is required:

Rules α  (change of variables) and ρ  (reflexivity) have no computational content and should therefore play no part in reduceN or reduceA . (Rule  α plays a part in subst .)

Rule τ  (transitivity) involves multiple reductions and therefore also plays no part in reduceN or reduceA .

The remaining rules are used in both reduceN and reduceA , but with different priorities.

Rule β is the key rule, and in normal-order reduction, rule  β is always preferred.

In applicative-order reduction, rule μ (reduction in the argument position) is preferred.

In normal-order reduction, rule ν (reduction in the function position) is preferred over rule  μ but not over rule  β .

Finally, Panangaden omits rule  η , which like rule  β is always preferred:

  • λ x . M x  →  M , provided x  is not free in  M

You must implement the η rule as well as the other rules.

If you want to know more, or you want a different formulation, go (cautiously) to Wikipedia. Wikipedia describes some individual reduction rules in the Reduction section of the lambda-calculus page. And it briefly describes applicative-order reduction and normal-order reduction, as well as several other reduction strategies, in the reduction strategies section of the lambda-calculus page.

Hints on the implementation of reduction

The return type of reduceA and reduceN is term Reduction.result , where Reduction.result is defined by this interface, which also defines some useful helper functions:

The helper functions rmap , nostep , and >=> are used to implement the second of two possible implementation options:

The first-order option is simply to take a term, break its representation down by cases, and in each case, define a right-hand side that combines all the rules for that case, including the Eta rule. The advantage of this option is it’s concrete, and the programming techniques are ones you’ve been using all along—break down the data by cases, apply the rules. The disadvantage is that there are a lot of cases, and the logic on the right hand side is complicated. Once you’ve written the code, it will be hard to understand and hard to debug. Students choosing this option often forget cases or botch cases.

The higher-order option is to define each rule as its own function, then to compose the functions using the >=> operator in the Reduction module. 6 The advantage of this option is that the construction of the reduction strategy makes it crystal clear what is going on and in what order—it becomes very hard to forget or botch a case. This option also makes it easy to implement and test one rule at a time. The disadvantage of this option is that it is abstract, and it is aggressively higher-order: you are using the >=> arrow to compose simple functions into more complex functions. Understanding the “reducer” abstraction well enough to implement it will take a little time.

Notes on the higher-order option

If you want to try the REDUCTION interface and the higher-order option, here are some notes:

The type called 'a reducer is really a partial reducer: a function of this type implements some sequence of rules. Function nostep implements no rules, and the composition arrow  >=> combines two functions to implement a combined sequence of rules. Your implementation task breaks down into two steps: first, define rule functions; second, compose them.

The rmap function is the classic mapping idea (called “homomorphic”) which you have already seen in List.map and Option.map . It is especially useful in conjunction with curry , as in

You may also find a use for flip .

The composition arrow is mean to be used as an infix operator. In your solution file, copy these definitions:

The most beautiful code emerges if you define functions beta , eta , nu , mu , and  xi , then compose them:

But there’s a problem here: the nu , mu , and xi rules all need the capability of doing general reduction on a subterm, which means they have to be mutually recursive with the reducer. Mutually recursion can be handled in several ways, but the easiest is to define the individual rule functions inside the reducer, in a let binding. This easy way does, however, duplicate code. If you want to avoid the duplication, you can do something like this:

Overall, I think the higher-order option is worth the extra effort needed to understand the reducer type and its composition: when you split each rule into its own function, it’s much, much easier to get them all right. And it’s easy to reuse the same functions in multiple reduction strategies.

Debugging support

As shipped, the lambda-calculus interpreter reduces each term repeatedly, until it reaches a normal form. But when you are debugging reduction strategies, you may find it helpful to see the intermediate terms. The compile105-lambda script should produce an executable program ./lamstep , which will show the results of every reduction step. You can compare this interpreter with the reference version, called lamstep-nr .

Even more debugging support

If the ./lamstep interpreter doesn’t provide enough information (or provides too much), here is a way to print a status report after every n reductions:

I have defined a status function size that prints the size of a term. You can print whatever you like: a term’s size, the term itself, and so on. Here is how I show the size of the term after every reduction. Some “reductions” make terms bigger!

More Extra Credit

Solutions to any of the extra-credit problems below should be placed in your README file. Some may be accompanied by code in your solution.sml file.

Extra Credit. Normalization. Write a higher-order function that takes as argument a reduction strategy (e.g., reduceA or reduceN ) and returns a function that normalizes a term. Your function should also count the number of reductions it takes to reach a normal form. As a tiny experiment, report the cost of computing using Church numerals in both reduction strategies. For example, you could report the number of reductions it takes to reduce “three times four” to normal form.

This function should be doable in about 10 lines of ML.

Extra Credit . Normal forms galore. Discover what Head Normal Form and Weak Head Normal Form are and implement reduction strategies for them. Explain, in an organized way, the differences between the four reduction strategies you have implemented. (If you choose the higher-order option for implementing reduction strategies, this extra credit is easy. Otherwise, not so much.)

Extra Credit . Typed equality. For extra credit, write down equality on Church numerals using Typed uScheme, give the type of the term in algebraic notation, and explain why this function can’t be written in ML. (By using the “erasure” theorem in reverse, you can take your untyped version and just add type abstractions and type applications.)

What and how to submit: Individual work

Using script submit105-lambda-solo , submit

  • The names of the people with whom you collaborated
  • Any extra credit you may have earned
  • File cqs.lambda.txt , containing your answers to the reading-comprehension questions
  • File church.lam containing your solutions to the Church-numeral problems, including possibly the binary-sym extra credit

As soon as you have the files listed above, run submit105-lambda-solo to submit a preliminary version of your work. Keep submitting until your work is complete; we grade only the last submission.

What and how to submit: Pair work

Using script submit105-lambda-pair , submit

README Collaborators, extra credit, and so on solution.sml Your module implementing terms, substitution, and reduction subst-tests.sml Test cases for substitution

As soon as you have the files listed above, and all the code compiles, run submit105-lambda-pair to submit a preliminary version of your work. Keep submitting until your work is complete; we grade only the last submission.

Avoid common mistakes

Common mistakes with church numerals.

Here are some common mistakes to avoid when programming with Church numerals:

Don’t forget names and contracts for helper functions.

Don’t forget a semicolon after each definition.

Don’t forget the question mark in the name of even? .

When using a fixed-point combinator to define a function, don’t forget to use noreduce in the definition form.

Don’t use the list representation or primitives from Wikipedia. We will test your code using the representation and primitives from Coding in Lambda Calculus , which you will also find in the file predefined.lam .

Don’t include any use directives in church.lam .

Don’t copy predefined terms from predefined.lam . We will load the predefined terms before running your code.

To make sure your code is well formed, load it using

If you want to build a test suite, put your tests in file test.lam and run

Common mistakes with the lambda interpreter

Here are some common mistakes to avoid in implementing the interpreter:

Don’t forget the Eta rule :

Here is a reduction in two eta steps:

Your interpreters must eta-reduce when possible.

Don’t forget to reduce under lambdas (the Xi rule).

Don’t forget that in an application M 1   M 2 , just because M 1 is in normal form doesn’t mean the whole thing is in normal form. If  M 1 doesn’t step, you must try to reduce  M 2 .

If you are using the first-order implementation option, don’t clone and modify your code for reduction strategies; people who do this wind up with wrong answers. The code should not be that long; use a clausal definition with nested patterns, and write every case from scratch.

Do make sure to use normal-order reduction, so that you don’t reduce a divergent term unnecessarily.

Don’t try to be clever about a divergent term; just reduce it. (It’s a common mistake to try to detect the possibility of an infinite loop. Mr. Turing proved that you can’t detect an infinite loop, so please don’t try.)

When implementing freshVar , don’t try to repurpose function freshTyvar from section 7.6. That function isn’t smart enough for your needs.

How your work will be evaluated

Your ML code will be judged by the usual criteria, emphasizing

  • Correct implementation of the lambda calculus
  • Names and contracts for helper functions
  • Structure that exploits standard basis functions, especially higher-order functions, and that avoids redundant case analysis

Your lambda code will be judged on correctness, form, naming, and documentation, but not so much on structure. In particular, because the lambda calculus is such a low-level language, we will especially emphasize names and contracts for helper functions .

This is low-level programming, and if you don’t get your code exactly right, the only way we can recognize and reward your learning is by reading the code. It’s your job to make it clear to us that even if your code isn’t perfect, you understand what you’re doing.

Try to write your contracts in terms of higher-level data structures and operations. For example, even though the following function does some fancy manipulation on terms, it doesn’t need much in the way of a contract:

Documenting lambda calculus is like documenting assembly code: it’s often sufficient to say what’s happening at a higher level of abstraction.

Although it is seldom ideal, it can be OK to use higher-level code to document your lambda code. In particular, if you want to use Scheme or ML to explain what your lambda code is doing, this can work only because Scheme and ML operate at much higher levels of abstraction. Don’t fall into the trap of writing the same code twice—if you are going to use code in a contract, it must operate at a significantly higher level of abstraction than the code it is trying to document.

In more detail, here are our criteria for names:

And here are our criteria for contracts:

Files link-lambda.sml and link-lambda-a.sml are copied into your directory by the compile105-lambda script. The others are created by you. ↩

They were more useful in 2017 then they are now—as always, Wikipedia pages are subject to change without notice. ↩

Try, for example, (\x.\y.x) A B; . ↩

I have botched capture-avoiding substitution multiple times. ↩

The laws, although notated differently, are identical to the laws given by Prakash Panangaden as Definition 1.3. ↩

This operator is an example of “Kleisli composition,” which is an advanced form of function composition. ↩

COMMENTS

  1. Calculus II (Practice Problems)

    Calculus II. Here are a set of practice problems for the Calculus II notes. Click on the " Solution " link for each problem to go to the page containing the solution. Note that some sections will have more problems than others and some will have more or less of a variety of problems. Most sections should have a range of difficulty levels in the ...

  2. Calculus II

    Now, with expert-verified solutions from Calculus II 2nd Edition, you'll learn how to solve your toughest homework problems. Our resource for Calculus II includes answers to chapter exercises, as well as detailed information to walk you through the process step by step. With Expert Solutions for thousands of practice problems, you can take ...

  3. PDF Calculus II HOMEWORK I Solution

    Calculus II HOMEWORK I Solution 6. Compute R 4 1 sin p x p x dx Solution: Let u = p x, then x = u2, dx = 2udu Z 4 1 sin p x p x dx = Z 2 1 sinu u 2udu = Z 2 1 2sinudu = 2(cos1 cos2) 7. Compute R 8 6 x p 100 x2 dx Solution: Let u = 100 x2, du = 2xdx Z 8 6 x p 100 2x dx = Z 36 64 1 2 p udu = 1 2 Z 64 36 p udu = 1 3 u3 2 64 36 = 296 3 8. Compute R ...

  4. Calculus Volume 2 0th Edition Textbook Solutions

    Solutions Manuals are available for thousands of the most popular college and high school textbooks in subjects such as Math, Science (Physics, Chemistry, Biology), Engineering (Mechanical, Electrical, Civil), Business and more. Understanding Calculus Volume 2 0th Edition homework has never been easier than with Chegg Study.

  5. Calculus II

    Find step-by-step solutions and answers to Calculus II - 9780618512669, as well as thousands of textbooks so you can move forward with confidence. ... Section C.2: Second-Order Homogeneous Linear Equations. Section C.3: Second-Order Nonhomogeneous Linear Equations. Section C.4: Series Solutions of Differential Equations. Exercise 1. Exercise 2 ...

  6. Mathway

    Free math problem solver answers your calculus homework questions with step-by-step explanations. Mathway. Visit Mathway on the web. Start 7-day free trial on the app. ... Mathway's live experts will not knowingly provide solutions to students while they are taking a test or quiz. Formulas.

  7. Calculus 2

    Calculus 2 6 units · 105 skills. Unit 1 Integrals review. Unit 2 Integration techniques. Unit 3 Differential equations. Unit 4 Applications of integrals. Unit 5 Parametric equations, polar coordinates, and vector-valued functions. Unit 6 Series. Course challenge. Test your knowledge of the skills in this course.

  8. Answer Key Chapter 2

    Answer Key Chapter 2 - Calculus Volume 2 | OpenStax. Our mission is to improve educational access and learning for everyone. OpenStax is part of Rice University, which is a 501 (c) (3) nonprofit. Give today and help us reach more students.

  9. Calculus, Volume 2 2nd Edition Textbook Solutions

    Solutions Manuals are available for thousands of the most popular college and high school textbooks in subjects such as Math, Science (Physics, Chemistry, Biology), Engineering (Mechanical, Electrical, Civil), Business and more. Understanding Calculus, Volume 2 2nd Edition homework has never been easier than with Chegg Study.

  10. Calculus Volume 2 17th Edition Textbook Solutions

    Textbook solutions for Calculus Volume 2 17th Edition Gilbert Strang and others in this series. View step-by-step homework solutions for your homework. Ask our subject experts for help answering any of your homework questions!

  11. Calculus, Volume 2

    Now, with expert-verified solutions from Calculus, Volume 2 1st Edition, you'll learn how to solve your toughest homework problems. Our resource for Calculus, Volume 2 includes answers to chapter exercises, as well as detailed information to walk you through the process step by step. With Expert Solutions for thousands of practice problems ...

  12. Math 21200: Calculus II

    For example, in the suggested homework problems for Section 7.2, the entry s1 refers to supplementary problem 7.2/s1. Third, answers and selected solutions to all even numbered suggested problems from the text and all supplementary problems. For the convenience of students who have access to the Thomas's Calculus: Early Transcendentals, the ...

  13. Advanced Calculus 2nd Edition Textbook Solutions

    Solutions Manuals are available for thousands of the most popular college and high school textbooks in subjects such as Math, Science (Physics, Chemistry, Biology), Engineering (Mechanical, Electrical, Civil), Business and more. Understanding Advanced Calculus 2nd Edition homework has never been easier than with Chegg Study.

  14. Calculus Calculator

    Symbolab is the best calculus calculator solving derivatives, integrals, limits, series, ODEs, and more. What is differential calculus? Differential calculus is a branch of calculus that includes the study of rates of change and slopes of functions and involves the concept of a derivative.

  15. Calculus

    Find step-by-step solutions and answers to Calculus - 9781337624183, as well as thousands of textbooks so you can move forward with confidence. ... Section 2.7: Rates of Change in the Natural and Social Sciences. Section 2.8: Related Rates. Section 2.9: Linear Approximations and Differentials. Page 199: Concept Check. Page 200: True-False Quiz.

  16. Calculus I (Practice Problems)

    Calculus I. Here are a set of practice problems for the Calculus I notes. Click on the " Solution " link for each problem to go to the page containing the solution. Note that some sections will have more problems than others and some will have more or less of a variety of problems. Most sections should have a range of difficulty levels in the ...

  17. Bogdan Doytchinov's Home Page

    MA117 Concepts of Calculus Syllabus; Homework; Syllabus and Homework as pdf; MA121 Calculus I; MA121L Calculus I Lab; MA122 Calculus II; MA201 Linear Algebra; MA235 Introduction to Mathematical Proof; MA251 Probability and Statistics; MA252 Statistical Methods in Research; MA255/MA455 Financial Mathematics ;

  18. Chapter 6.3 Solutions

    The objective is to write the form of the partial fraction of the given function. Rewrite the function as follows: From the function, the linear factor occurs twice. Definition: Suppose the linear factor is repeated times. In this case the partial fraction can be written as, Step 4 of 4.

  19. Lambda Calculus

    Wikipedia offers two somewhat useful pages: 2. The Lambda Calculus page covers everything you'll find in Rojas and much more besides. (If you wish, you can read what Wikipedia says about reduction strategies and evaluation strategies. ... (If you adapt your solution to the pair problem on the ML homework, or my model solution to that problem ...

  20. Essential Calculus

    Find step-by-step solutions and answers to Essential Calculus - 9781133710875, as well as thousands of textbooks so you can move forward with confidence. ... Section 9.2: Calculus with Parametric Curves. Section 9.3: Polar Coordinates. Section 9.4: Areas and Lengths in Polar Coordinates. Section 9.5: Conic Sections in Polar Coordinates. Page ...

  21. PDF Math in Moscow Calculus on Manifolds Homework Assignment 3

    SL(2) = fA 2Matr(2 2;R)jdet(A) = 1g Find its tangent space at the point Id. Problem 3.3. Does there exist a smooth vector eld on T2 that does not vanish at any point ? Problem 3.4. Does there exist a smooth vector eld on S2 that vanishes at exactly one point? Based on: Lee, Chapter 3; Tu, Chapters 2, 8, Gadea, Munoz, Mykytyuk, Sections 1.9, 1.10.

  22. Calculus

    Find step-by-step solutions and answers to Calculus - 9780538497817, as well as thousands of textbooks so you can move forward with confidence. ... Section 2.7: Rates of Change in the Natural and Social Sciences. Section 2.8: Related Rates. Section 2.9: Linear Approximations and Differentials. Page 190: True-False Quiz. Page 190: Concept Check ...

  23. Solved 5./4 Jason leaves Moscow at noon driving to St.

    Calculus; Calculus questions and answers; 5./4 Jason leaves Moscow at noon driving to St. Petersburg on a rond which is 700 km long. Marie lenves St. (a) How many hours has Marie been driving when they meet? (b) How many km apart are they 1 hour before they meet? (c) How many hours has Jason been driving when they are 200 km apart?