Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup(){
- size(640, 480);
- double m = 0;
- double b = 10;
- //y = 2x + 4
- for( double x = 0.0; x <= width; x++ ){
- double y = f( m, b, x );
- point( (float)x, (float)(height - y) );
- }
- //y = ax^2 + bx + c
- double a = -.2;
- b = 16;
- double c = 0;
- for( double x = 0.0; x <= width; x++ ){
- double y = f2( a, b, c, x);
- point((float)x, (float)(height - y));
- }
- }
- double f2( double a, double b, double c, double x){
- double y = a * (Math.pow(x, 2)) + b * x + c;
- return y;
- }
- double f( double m, double b, double x ){
- double y = m * x + b;
- return y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement