E.g. solving the differential equation y' = y from t=0,y=1 to t=1 computes exp(1):
import math
def simple(f,t,t1,y=0.0,dt=0.001):
while t<t1:
y += f(t,y)*dt
t += dt
return y
def rk4(f,t,t1,y=0.0,dt=0.001):
while t<t1:
k1 = f(t,y)
k2 = f(t+dt/2, y+dt*k1/2)
k3 = f(t+dt/2, y+dt*k2/2)
k4 = f(t+dt, y+dt*k3)
y += (k1+2*k2+2*k3+k4)*dt/6
t += dt
return y
def f(t,y): return y
print "Simple:", simple(f, 0.0, 1.0, 1.0)
print " RK4:", rk4(f, 0.0, 1.0, 1.0)
print "math.e:", math.e
This prints: Simple: 2.71692393224
RK4: 2.71828182846
math.e: 2.71828182846
Or perhaps Newton's method to solve x^2 = 2, solution x=sqrt(2): def newton(f, fprime, x=0.1, n=10):
for i in xrange(0,n):
x -= f(x)/fprime(x)
return x
def g(x): return x**2 - 2
def gprime(x): return 2*x # derivative of g
print newton(g, gprime)
print math.sqrt(2)
Result: 1.41421356237
1.41421356237
Note that 10 iterations are enough to get all the digits that Python prints correct.In just 13 lines of code we have tools for effectively solving any ordinary differential y' = f(t,y) equation and for solving f(x) = 0 for many functions f. Solving y' = f(t,y) where f(t,y) is a function of t alone gives us integration. E.g. integrating 1/t from t=1 to t=2:
rk4(lambda t,y: 1/t, 1.0, 2.0)
(but there are better methods for integration than general purpose differential equation solvers)Specially solving reccurrences and summations, which mathematica can do very well, and I will almost always make a silly mistake when trying to do it by hand.
Secondly, what's "bullshit" about the proofs of "geometry" courses? And why do you put "geometry" in quotes?
Always requiring proofs in elementary and middle school is inappropriate for many reasons. I'll give a few. There's hardly sufficient time to demonstrate and exercise the mathematics as it is. Secondly, learning to do proofs properly are important only for those who will become academic mathematicians at universities.
The demonstration of proof in geometry class is both elegant, precise and appropriate.
Learning how to motivate and explain mathematical relationships and structures is essential for anyone who plans to work with them later (or frankly anyone who plans to be an informed citizen). Without a demonstration of such ability to explain on students’ part, I doubt that any “mathematics” has in fact been learned.
Normal 14-year-olds are plenty capable of understanding the construction of straightforward mathematical arguments.
> demonstration of proof in geometry class is both elegant, precise and appropriate.
You show me a widely used high school geometry book that isn’t completely full of time wasting banality and pointless over-strict over-regimented rules for students to follow, and I’ll be amazed.
In particular, it lets you, when first introduced to a topic, play around with it, and get past the hump of "Really? Is that true?" I liked my calculator in high school for letting me experiment. I think that today, though, something like Wolfram Alpha works just as well for that. I do think there's a place for it in education, though.
This is not how students are taught to use calculators. I agree with you though; Maple, Mathematica, or (say) Python is much better at this than any graphing calculator.
I think banning calculators from all elementary/secondary math education would be a tremendous benefit because (a) it would improve familiarity with basic number relationships, and (b) it would force problem authors to keep the numbers reasonable, and push problems toward higher levels of abstraction, rather than simply tacking on extra digits after the decimal point. Most importantly, anyone who understands the mathematical structures and relationships involved can learn how to compute with a calculator or similar tool in about a week. Someone who only knows how to punch things into a calculator but doesn’t have a solid grasp of what it means is in a very tough spot as soon as anything slightly out-of-the-ordinary pops up.