Subversion Repositories Applications.gtt

Rev

Rev 61 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
60 jpm 1
<?php
2
/*
3
 * This work is hereby released into the Public Domain.
4
 * To view a copy of the public domain dedication,
5
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
6
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
7
 *
8
 */
9
 
10
require_once "../MathPlot.class.php";
11
 
12
 
13
$graph = new Graph(300, 300);
14
 
15
$plot = new MathPlot(-3, 3, 2, -3);
16
$plot->setInterval(0.05);
17
 
18
$function = new MathFunction('sqrt', 0);
19
$plot->add($function, "sqrt(x)");
20
 
21
function x2($x) {
22
	return - $x * $x;
23
}
24
 
25
$function = new MathFunction('sin', -2, 2);
26
$function->setColor(new DarkBlue);
27
$plot->add($function, "sin(x) (-2 < x < 2)");
28
 
29
$plot->legend->setPosition(0.98, 0.8);
30
$plot->legend->setTextFont(new Tuffy(8));
31
 
32
$graph->add($plot);
33
$graph->draw();
34
?>