An archive of Mark's Spring 2018 Numerical Analysis course.

Section 1.1 Question 11

dumptruckman

Problem #11 from 1.1 asks, which of the following mathematically true equations become false equations when calculated by a computer?

  1. (2)(12)=9^2-4(9)-21
  2. e^{3ln(2)}=8
  3. ln(10)=ln(5)+ln(2)
  4. g(\frac{1+\sqrt5}{2})=\frac{1+\sqrt5}{2} where g(x)=\sqrt[3]{x^2+x}
  5. [153465/3]=153465/3
  6. 3\pi^3+7\pi^2-2\pi+8=((3\pi+7)\pi-2)\pi+8
dumptruckman

Problem #11 from 1.1 can be answered with the following python code:

import numpy as np

print(f"1. {(2)*(12)==9**2-4*(9)-21}")
print(f"2. {np.exp(3*np.log(2))==8}")
print(f"3. {np.log(10)==np.log(5)+np.log(2)}")
print(f"4. {np.power(np.power((1+np.sqrt(5))/2,2)+((1+np.sqrt(5))/2),1./3)==(1+np.sqrt(5))/2}")
print(f"5. {(153465./3)==153465./3}")
print(f"6. {3*np.power(np.pi,3)+(7*np.power(np.pi,2))-2*np.pi+8==((3*np.pi+7)*np.pi-2)*np.pi+8}")

Which produces the output:

  1. True
  2. False
  3. False
  4. True
  5. True
  6. False
mark

Most excellent!
And thanks for the repost!!

I do wonder what makes some of them True and some of them False? In particular, I’m a little surprised that #4 returns True. The last one #6, by contrast, is an illustration of the Horner form of a polynomial, which is well known to be both more numerically stable and faster to compute numerically than the typical form of a polynomial that we all know. Nice combo!