Math 124 - Programming for Mathematical Applications
UC Berkeley, Spring 2024

Homework 12
Due Wednesday April 24

Problem 1
It is well known that (∑_(i=1)^n)i=(1/2) n (1+n). Make a table with similar formulas for  (∑_(i=1)^n)(i^k), with k ranging from 1 to 8.

Problem 2
Use the Factor function to prove that the product of four consecutive numbers plus one is always a squared number.

Problem 3
Show that the formula (n^2)+n+41 produces prime numbers for n from 0 to 39.

Problem 4
11 is the first prime number with all digits equal to 1. Find the next one (using a loop).

Problem 5
Define the function f(x) as follows:

	f(xy)=f(x)+f(y)
f((x^n))=nf(x)
f(n)=0

where n is an integer. Show that

	f((∏_(k=1)^20)k!((((Subscript[x, k])))^k))=(∑_(k=1)^20)k f((Subscript[x, k]))

Problem 6
a) Plot the function f(x)=(e^(-x))/(2+sin((x^2))) and its tangent line g(x) at x=1 for x∈[0,3].
b) Calculate the integral of f(x)-g(x) between x=0 and x=1 numerically with 100 digits.

Problem 7
Define the following piecewise function:
	f(x)=({{{, ({{-x, if |x|<1}, {sin(x), if 1≤|x|<2}, {cos(x), otherwise.}})}})
a) Plot f(x) between x=-3 and x=3.
b) Calculate the integral of 1/(1+((f(x))^2)) between x=-3 and x=3 (symbolically).