// Day 4 // Example: Maths // mjh-2013 // initialize program size(600, 400); background(250, 250, 200); textSize(20); fill(0); // // uncomment out different blocks of code // text("Some More Math", 10, 50); line(10, 53, 610, 53); /* can declare two or more variables at the same time if they are the same type. */ float x, y, z; // (approximate) real numbers x = 1.1; y = 0.24; z = -0.4587; text( "sin(x) = " + sin(x), 25, 100); text( "abs(x) = " + abs(x) + " (absolute value)", 25, 150); text( "abs(z) = " + abs(z) + " (absolute value)", 25, 200); text( "sqrt(y) = " + sqrt(y) + " (square root)", 25, 250); text( "random(1,10) = " + random(1,10) + " (random number)", 25, 300); text( "for more math functions... see processing.org", 25, 350); // run this program several times and look at the output of // of the random number.