2018-02-09

about mathematics

math-as-code mathematic notation explained with code examples

njwildberger youtube channel

proposed ascii notation

+: addition

-: subtraction

*: multiplication

**: exponentiation

/: division

//: root

x ** 3 // 2

take the square root of x to the power of three

computers seem to be a useful physical basis to math. as its fundamental elements and workings are not obscured by the neural networks and socially evolved capabilities of human brains. there is something big and important to it that math did not really have before, maybe the detailed analysis and understanding of "how" things can be realised

the notation seems to have been build for blackboards. writing on a blackboard is rather tedious and there is little space, so all spacial directions and smaller differences between symbols instead of different words are used. a downside is the complexity of more spatial freedom, little "paintings" and particularly the non-indicatory, isolating nature that prevents discovery of the intended meaning of the notation by at least requiring a lot of previous knowledge about math notation

how to solve this

x ** 2 + b * x = a

one square that includes x plus two rectangles that include x

x * x + b / 2 * x + b / 2 * x = a (x + b / 2) ** 2 = a + (b / 2) ** 2

x = - b / 2 +- sqrt(a + b ** 2 / 4)

it is known, that...

it is natural/obvious/clear

it is easy to see

as we all learned in school

it becomes intuitively obvious

it can often be visualised

a study of motion will involve

simply

is just

this axiom induces the algebra

directed line segments

magnitude and direction but unspecified position

a directed line segment defined by two catheti sides of a right triangle

magnitude alone is not sufficient, direction is also needed, and given by one cathetus

projection and rejection are catheti between two directed line segments (vectors)

if two vectors are sides of a triangle, subtraction gives the vector that fits the third side in direction and length

it is the (largest) distance between two vectors

is it one number direction, one number magnitude?

no, two values for scale, two different directions for both number

it is like saying a**2 is the area of a square, even though there are four sides, you copy one and dont use them separately because they are equal

to say vectors are arrows is an incomplete explanation, because arrows can be created in multiple ways

the direction comes from using signed values

instead of (x, y) (x2, y2), (x, y) is enough when you always consider it as starting at zero - then not two x or y are needed two define a line but only a scalar

vectors are 1d objects

vector addition creates a vector that has the length of both vectors, and the direction of both vectors

the vector perpendicular to the middle vector between two vectors is 1/2 a + 1/2 b

example implementations for two dimensional vectors

errors likely in this version

(define v vector-ref) (define (v2-magnitude a) "vector -> scalar perhaps also the norm" (let ( (a1 (v a 0)) (a2 (v a 1))) (sqrt (+ (* a1 a1) (* a2 a2))))) (define (v2-ip a b) "vector vector -> vector inner product or dot product" (+ (* (v a 0) (v b 0)) (* (v a 1) (v b 1)))) (define (v2-projection a b) (/ (v2-ip a b) (expt (v2-magnitude b) 2))) (define (v2-area a b angle) "vector vector scalar:0..1:radians -> scalar corresponds to the area of a parallelogram" (* (sin (min pi (abs angle))) (v2-ip (v2-magnitude a) (v2-magnitude b)))) (define (v2-multiply a b) "vector vector -> vector" (vector (* (v a 0) (v b 0)) (* (v a 1) (v b 1)))) (define (v2-multiply-scalar s a) "scalar vector -> scalar" (vector (* s (v a 0)) (* s (v a 1))))