[system] / trunk / pg / macros / PGanalyzeGraph.pl Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/pg/macros/PGanalyzeGraph.pl

Revision 6499 Revision 6545
2 2
3################################################################ 3################################################################
4# subroutines 4# subroutines
5################################################################ 5################################################################
6 6
8
9PGanalyzeGraph.pl
10
12
13These routines support the
14analysis of graphical input from students.
15
16=cut
7 17
8 18
10 20
21
22
11 input: \$pointDisplayString 23 input: \$pointDisplayString
12 return delimited string of triplets 24
13 each triplet has the form x y yp (space delimited)
14 giving the x, y and y'(x) values at x respectively
15 return: (\@combined_intervals, \@values) 25 return: (\@combined_intervals, \@values)
16 @values contains the y values of the function in order 26 @values contains the y values of the function in order
17 @combined_intervals contains anonymous arrays of the form 27 @combined_intervals contains anonymous arrays of the form
18 [ \$slope, \$left_x, \$right_x] indicating the gradient on that segment. 28 [ \$slope, \$left_x, \$right_x] indicating the gradient on that segment.
19 successive intervals will have different slopes. 29 successive intervals will have different slopes.
20 30
21 31
22=cut 32=cut
23 33
34
35
24sub detect_intervals { 36sub detect_intervals {
25 my \$pointDisplayString = shift; 37 my \$pointDisplayString = shift;
26 my @intervals; 38 my @intervals;
27 my @combined_intervals=(); 39 my @combined_intervals=();
28 my @points; 40 my @points;

Legend:
 Removed from v.6499 changed lines Added in v.6545