Remove shebang lines from non-executable files.
Begin the solve_poisson function.
-#!/usr/bin/octave --silent
-
function root = bisect(f, a, b, epsilon)
## Find a root of the function `f` on the closed interval [a,b].
##
-#!/usr/bin/octave --silent
-
function dd = divided_difference(f, xs)
## Compute divided difference of `f` at points `xs`. The argument `xs`
## is assumed to be a vector containing at least one element. If it
-#!/usr/bin/octave --silent
-
function has_root = has_root(fa, fb)
## Use the intermediate value theorem to determine whether or not some
## function has an odd number of roots on an interval. If the function
--- /dev/null
+function [p,delta] = partition(integerN, a, b)
+ ## Partition the interval [a,b] into integerN subintervals. We do not
+ ## requite that a<b.
+ ##
+ ## INPUTS:
+ ##
+ ## * integerN - The number of subintervals.
+ ##
+ ## * a - The "left" endpoint of the interval to partition.
+ ##
+ ## * b - The "right" endpoint of the interval to partition.
+ ##
+ ##
+ ## OUTPUTS:
+ ##
+ ## * p - The resulting partition, as a vector of length integerN+1.
+ ##
+ ## * delta - The distance between x_i and x_{i+1} in the partition.
+ ##
+ ##
+
+ ## We don't use abs() here because `b` might be less than `a`. In that
+ ## case, we want delta negative so that when we add it to `a`, we move
+ ## towards `b`.
+ delta = (b - a)/integerN
+
+ p = [a : delta : b]
+end
--- /dev/null
+function u = solve_poisson(integerN, f)
+ ##
+ ## Numerically solve the poisson equation,
+ ##
+ ## -u_xx(x) = f(x)
+ ##
+ ## in one dimension, subject to the boundary conditions,
+ ##
+ ## u(0) = 0
+ ## u(1) = 1
+ ##
+ ## over the interval [0,1]. It is assumed that the function `f` is at
+ ## least continuous on [0,1].
+ ##
+
+ [xs,h] = partition(integerN, a, b);
+end