-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
33 lines (26 loc) · 943 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
require './cngn.php';
$x = new CNGN(5);
// Use stringParse to dynamically insert data into strings
$string = "{x0} {x1} {x2} {x3} {x4}";
$x->load_vars([25, 2, 3, 4, 60]);
$string = $x->stringParse($string, $x->vars);
echo $string . "<br />";
$x->add_vars(3);
$x->set_f_of('1 - 3 + {x0}');
$x->set_g_of('1 + {x0} + 20');
$seq = [6, 10, 35, 30, 10, 4, 5];
$x->register_fn_x(2);
$seq = ["{x2} + {x6}", 22, "{x1} + 3", 30, [10, 11, -2], 4, 5, "101010"];
$x->load_vars($seq);
// don't sweat this, 011001 is the code for 'return *';
$x->load_fn_x(["{x0}", "{x5} {c011001,0} - {x2} + {x3} + 5 + {x1}"]);
echo "<br />". json_encode($x->fn_x);
$t = $x->mathParse($x->fn_x[1], $x->vars);
echo "<br />" . $t;
$f = [[45, -2, 16], [23, 5, 16]];
$t = $x->mathParse($x->fn_x[1], $f);
echo "<br />" . $t;
$t = $x->integrand($f[0]);
echo "<br />" . $t . "<br />";
$x->load_fn_x(["{c011110,1}{c011110,5}{c011110,0}","{c111011,7}"]);