Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
8982a83
Merge pull request #287 from Alex-Jordan/niceTablesPatch
mgage Dec 11, 2016
47583ef
Merge pull request #288 from Alex-Jordan/MBX-mods-to-PGbasicmacros
mgage Dec 11, 2016
2c214ae
Fix issue where test_at is ignored if upToConstant is used
dlglin Jan 13, 2017
f10279a
Merge pull request #294 from dlglin/master
dpvc Jan 20, 2017
39d3e45
Cleaned up the sage file. It still needs more testing.
mgage Jun 27, 2017
56f772a
changes to sage.pl to accamodate the new way of handling html fragments
mgage Jul 7, 2017
db091be
add mph to units
Alex-Jordan Jul 20, 2017
c403519
add % to units
Alex-Jordan Jul 20, 2017
e9fc620
add full word options for some units
Alex-Jordan Jul 20, 2017
0413bef
code typo
Alex-Jordan Jul 20, 2017
73356d1
Merge branch 'master' into PG-2.13
mgage Jul 25, 2017
144b7fb
Merge pull request #310 from openwebwork/PG-2.13
mgage Jul 25, 2017
1655360
introduce BLTR and ELTR for "left to right" environments
heiderich Aug 9, 2017
f7d31a6
Merge branch 'develop' of https://github.com/openwebwork/pg into new-…
Alex-Jordan Sep 30, 2017
70e1509
protect percent signs in TeX for NumberWithUnits
Alex-Jordan Sep 30, 2017
209846a
unit test for percent
Alex-Jordan Sep 30, 2017
2585cb1
Merge branch 'develop' of https://github.com/openwebwork/pg into unit…
Alex-Jordan Oct 1, 2017
131bed9
add 'sec', 'second', and 'seconds' to units
Alex-Jordan Oct 1, 2017
b65a70a
add 'dir="auto"' to <input> elements
heiderich Oct 1, 2017
e55140e
Clean up and augment pod documentation on Matrix related files.
mgage Oct 7, 2017
334315b
Fix checks for scalar multiplication to not have to stringify the val…
dpvc Oct 14, 2017
9e0930c
Merge pull request #330 from dpvc/fix-number-check
mgage Oct 14, 2017
fcf8c08
Fix reduction rule for x^(-1) to not reduce matrices, and extend it t…
dpvc Oct 26, 2017
1082884
Remove commented out code.
mgage Nov 17, 2017
1660703
Merge pull request #324 from mgage/develop_update_for_draggable
mgage Nov 17, 2017
1c3a88f
fix spelling: Matices -> Matrices
heiderich Nov 20, 2017
1dd61f3
Merge pull request #332 from heiderich/Matices_to_Matrices
jwj61 Nov 20, 2017
e455781
Tidying up addition of customizeLaTeX
jwj61 Sep 18, 2017
7b6585d
Fix a typo and change defaults
jwj61 Dec 24, 2017
6230c75
Add init function to prevent file from being loaded twice, and revise…
jwj61 Dec 26, 2017
9838731
Added more macros based on suggestions in the OPL.
jwj61 Dec 26, 2017
b6989cb
Improve error messages for non-invertible matrices
dpvc Dec 27, 2017
00ce5f4
Add support for ions and states to the Reaciton context, and update t…
dpvc Dec 27, 2017
660d94d
Make sure initial context is Numeric, with values copied from PG envi…
dpvc Dec 28, 2017
985ff70
Merge pull request #313 from Alex-Jordan/unit-words
mgage Dec 30, 2017
5d3a1df
Merge pull request #314 from Alex-Jordan/new-units
mgage Dec 30, 2017
7f67b89
Merge pull request #331 from dpvc/fix-power-reduce
mgage Dec 30, 2017
43745d0
Merge pull request #333 from dpvc/fix-matrix-errors
mgage Dec 30, 2017
ed8c717
Merge pull request #335 from dpvc/fix-default-context
mgage Dec 30, 2017
c874867
Merge pull request #334 from dpvc/update-reaction
mgage Dec 30, 2017
ac8b081
Commit changes to documentation for PGmatrixmacros.pl
mgage Dec 30, 2017
50abd18
Merge branch 'develop' of https://github.com/openwebwork/pg into deve…
mgage Dec 30, 2017
28ba783
remove files related to tableau from this PR.
mgage Dec 30, 2017
2911251
Change default for vector
jwj61 Dec 30, 2017
29c4c15
Merge pull request #326 from jwj61/customizelatex
mgage Dec 30, 2017
4486abb
Accepting changes suggest by Davide Cervone
mgage Dec 31, 2017
520237d
Merge pull request #323 from heiderich/BLTR-ELTR
mgage Jan 2, 2018
bfd0a5b
PTX support for WeBWorK
Alex-Jordan Sep 29, 2017
e3832a9
protect ampersand and less than sign in math differently for PTX output
Alex-Jordan Nov 14, 2017
bae640e
PreTeXt support issues with macro libraries
Alex-Jordan Dec 25, 2017
16b9c7d
more subroutines to customize LaTeX output for common objects in line…
heiderich Jan 2, 2018
4608ffa
Merge pull request #339 from heiderich/more_customizeLaTeX_subroutine…
jwj61 Jan 3, 2018
8c0860d
Merge pull request #327 from Alex-Jordan/ptx
mgage Jan 3, 2018
fae7b7b
Fix problem with empty lists. Resolves issue openwebwork/webwork-ope…
dpvc Jan 5, 2018
af17dad
Merge pull request #341 from dpvc/fix-lists
mgage Jan 6, 2018
1af1443
correct typo in macros/contextLimitedNumeric.pl
heiderich Feb 6, 2018
9279653
Merge pull request #343 from heiderich/typo_in_contextLimitedNumeric
dpvc Feb 6, 2018
08d7931
Fixed bugs in rref(), elem_matrix_row_mult(), row_mult(), apply_fract…
selinger Feb 11, 2018
cc79810
MatrixReduce.pl: fixed documentation typos.
selinger Feb 11, 2018
10d9967
Merge pull request #344 from selinger/matrix-bugs
dpvc Feb 12, 2018
88a90a4
corrected typo
heiderich Feb 26, 2018
235b2f5
typo
heiderich Feb 28, 2018
eeb9ad6
typo (space)
heiderich Mar 1, 2018
e6d2833
Bugfix: macros should not set global variables $n, $i, $j, $s
selinger Mar 28, 2018
b227b1f
Add reduction rule for ln(e) and similar constructs
dpvc Apr 2, 2018
bf6ffd8
Don't need to handle log10(10) since reduceConstantFunctions already …
dpvc Apr 2, 2018
f6dd853
Add reductions for ln(e^x) and ln(exp(x))
dpvc Apr 3, 2018
84af109
typo in contextLimitedNumeric.pl
heiderich Apr 14, 2018
e6b3aec
Merge pull request #349 from heiderich/typo_contextLimitedNumeric
jwj61 Apr 14, 2018
ede4534
add maketext calls in macros/problemRandomize.pl
Apr 25, 2018
13bb849
Add protecting <div> around the geogebra object. The geogebra javaSc…
mgage May 3, 2018
d5dfcdd
In PTX output, merge consecutive sidebysides into one
Alex-Jordan May 3, 2018
7996ae5
implement PGML explicit disc
Alex-Jordan May 3, 2018
ba120fb
Merge pull request #355 from mgage/geogebra_hotfix
mgage May 13, 2018
9345460
Merge pull request #347 from selinger/bug-fixes
mgage May 13, 2018
bab890a
Merge pull request #351 from heiderich/maketext_in_problemRandomize
mgage May 14, 2018
e839e8f
Merge pull request #345 from heiderich/typo_in_contextPermutation
mgage May 14, 2018
17adc9e
Merge pull request #346 from heiderich/typo
mgage May 14, 2018
d5c25be
Merge pull request #348 from dpvc/ln-e-reduction
mgage May 16, 2018
1a891ea
Merge pull request #353 from Alex-Jordan/disc
mgage May 16, 2018
24b49e3
Merge pull request #352 from Alex-Jordan/sidebyside
mgage May 16, 2018
483753d
Fix typo in radio button error message.
d-torrance May 22, 2018
c720517
Merge pull request #357 from d-torrance/fix-typo
jwj61 May 22, 2018
2802880
PGML true display math
Alex-Jordan May 29, 2018
a9477ce
Merge branch 'develop' of https://github.com/openwebwork/pg into deve…
mgage May 31, 2018
1869a4f
Cleaned up sage.pl for pull request according to comments
mgage Jun 1, 2018
285769c
Modify documentation
mgage Jun 3, 2018
4fa4763
Merge pull request #329 from mgage/develop_sagefix
mgage Jun 3, 2018
e911b66
Merge branch 'develop' into develop_328
mgage Jun 3, 2018
e935f2b
Merge pull request #338 from mgage/develop_328
mgage Jun 3, 2018
dbd56e8
font options for graph labels
Alex-Jordan Jun 12, 2018
026427f
fix typos in PTX_cleanup in PGbasicmacros.pl
mgage Jun 12, 2018
80379fb
Fix typos in "fixing typos" (sigh)
mgage Jun 12, 2018
c6a0436
delete unnecessary/unwanted lines from PTX cleanup
Alex-Jordan Jun 13, 2018
cfbca5f
Fix typo in PGmatrixmacros.pl
mgage Jun 13, 2018
abe27fa
Merge branch 'develop_PGbasic_fix' of https://github.com/mgage/pg int…
mgage Jun 13, 2018
ff854d1
Merge pull request #360 from mgage/develop_PGbasic_fix
mgage Jun 13, 2018
4826aeb
Format comment properly.
mgage Jun 13, 2018
1e17dd9
Merge pull request #363 from mgage/develop_PGmorematrix_fix
mgage Jun 13, 2018
7e38434
Merge pull request #358 from Alex-Jordan/PGML-displaymath
mgage Jun 21, 2018
51d0969
Merge pull request #359 from Alex-Jordan/graphLabels
mgage Jun 21, 2018
c93196e
Update copyright
mgage Jun 23, 2018
f1e74e2
Update license and version numbers
mgage Jul 20, 2018
178db8b
Make sure saved correct answer has units
dpvc Jul 22, 2018
cd051f5
Fix crash when preformatted text is used in a list
dpvc Jul 22, 2018
aade52c
Merge pull request #365 from dpvc/fix-num-with-unit
mgage Jul 23, 2018
d383a1f
Merge pull request #366 from dpvc/PGML-pre-fix
mgage Jul 23, 2018
26bba0f
Merge branch 'develop_plus_tableau' into test
mgage Oct 27, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Online Homework Delivery System
Version 2.*

Copyright 2000-2017, The WeBWorK Project
Copyright 2000-2018, The WeBWorK Project
All rights reserved.

This program is free software; you can redistribute it and/or modify
Expand Down
4 changes: 2 additions & 2 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$PG_VERSION ='develop';
$PG_COPYRIGHT_YEARS = '1996-2017';
$PG_VERSION ='PG-2.14';
$PG_COPYRIGHT_YEARS = '1996-2018';

1;
2 changes: 1 addition & 1 deletion lib/AnswerHash.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

AnswerHash -- this class stores information related to the student's
answer. It is little more than a standard perl hash with
a special name, butit does have some access and
a special name, but it does have some access and
manipulation methods. More of these may be added as it
becomes necessary.

Expand Down
15 changes: 14 additions & 1 deletion lib/Applet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1144,14 +1144,27 @@ use constant GEOGEBRAWEB_OBJECT_HEADER_TEXT =><<'END_HEADER_SCRIPT';

END_HEADER_SCRIPT

# Some changes in the way geogebra javaScript works make it important
# That the object and the script that calls it are contained in some <div>
# (otherwise geogebra adds height and width values to the second enclosing <div>
# (i.e. the div enclosing the enclosing div) and
# if the div contains more than just the geogebra applet this size will be incorrect. )
# (This behavior is probably a bug in geogebra --
# but I don't have a precise statement of the API.)
# The <div class="enclose_geogebra_object> and <div class="geogebra_object" do nothing for now
# but perhaps they might have a use later. style="height:306 ptx,width: 486 ptx" is inserted in
# the class="enclose_geogebra_object" div by the geogebra applet.

use constant GEOGEBRAWEB_OBJECT_TEXT =><<'END_OBJECT_TEXT';
<div class="enclose_geogebra_object">
<div class="geogebra_object">
<script language="javascript">ww_applet_list["$appletName"].visible = 1; // don't submit things if not visible
</script>
<script type="text/javascript" language="javascript" src="//web.geogebra.org/4.4/web/web.nocache.js"></script>

$webgeogebraParameters

</div>
</div>
END_OBJECT_TEXT

sub new {
Expand Down
108 changes: 72 additions & 36 deletions lib/Label.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@ This module defines labels for the graph objects (WWPlot).

=head2 Usage

$label1 = new Label($x_value, $y_value, $label_string, $label_color, @justification)
$justification = one of ('left', 'center', 'right) and ('bottom', 'center', 'top')
describes the position of the ($x_value, $y_value) within the string.
The default is 'left', 'top'
$label1 = new Label($x_value, $y_value, $label_string, $label_color, @options)
$options is an array with (*'d defaults)
- one of 'left'*, 'center', 'right' (horizontal alignment)
- one of 'bottom', 'center', 'top'* (verical alignment)
- one of 'horizontal'*, 'vertical' (orientation)
- one of 'small', 'large', 'mediumbold'*, 'tiny', 'giant' (which gd font to use)
Note the alignment specifications are relative to the English reading of the string,
even when the orientation is vertical.



=head2 Example
=head2 Example:

$new_label = new Label ( 0,0, 'origin','red','left', 'top')
@labels = $graph->lb($new_label);
Expand All @@ -51,14 +55,15 @@ use strict;
@Label::ISA = qw(WWPlot);

my %fields =(
'x' => 0,
'y' => 0,
color => 'black',
font => GD::gdMediumBoldFont, #gdLargeFont
# constants from GD need to be addressed fully, they have not been imported.
str => "",
lr_nudge => 0, #justification parameters
tb_nudge => 0,
'x' => 0,
'y' => 0,
color => 'black',
font => GD::gdMediumBoldFont, #gdLargeFont
# constants from GD need to be addressed fully, they have not been imported.
str => "",
lr_nudge => 0, #justification parameters
tb_nudge => 0,
orientation => 'horizontal',
);


Expand All @@ -74,31 +79,46 @@ sub new {
}

sub _initialize {
my $self = shift;
my ($x,$y,$str,$color,@justification) = @_;
$self -> x($x);
$self -> y($y);
$self -> str($str);
$self -> color($color) if defined($color);
my $j;
foreach $j (@justification) {
$self->lr_nudge( - length($self->str) ) if $j eq 'right';
$self->tb_nudge( - 1 ) if $j eq 'bottom';
$self->lr_nudge( - ( length($self->str) )/2)if $j eq 'center';
$self->tb_nudge(-0.5) if $j eq 'middle';
# print "\njustification=$j",$self->lr_nudge,$self->tb_nudge,"\n";
}
my $self = shift;
my ($x,$y,$str,$color,@justification) = @_;
$self -> x($x);
$self -> y($y);
$self -> str($str);
$self -> color($color) if defined($color);
my $j;
foreach $j (@justification) {
if ($j eq 'right') {$self->lr_nudge( - length($self->str) ); }
elsif ($j eq 'bottom') {$self->tb_nudge( - 1 ); }
elsif ($j eq 'center') {$self->lr_nudge( - ( length($self->str) )/2); }
elsif ($j eq 'middle') {$self->tb_nudge(-0.5); }
elsif ($j eq 'vertical') {$self->orientation($j); }
#there are only five avialble fonts: http://search.cpan.org/~rurban/GD-2.68/lib/GD.pm#Font_Utilities
elsif ($j eq 'small') {$self->font(GD::gdSmallFont); }
elsif ($j eq 'large') {$self->font(GD::gdLargeFont); }
elsif ($j eq 'tiny') {$self->font(GD::gdTinyFont); }
elsif ($j eq 'giant') {$self->font(GD::gdGiantFont); }
}
}
sub draw {
my $self = shift;
my $g = shift; #the containing graph
$g->im->string( $self->font,
$g->ii($self->x)+int( $self->lr_nudge*($self->font->width) ),
$g->jj($self->y)+int( $self->tb_nudge*($self->font->height) ),
$self->str,
${$g->colors}{$self->color}
);

my $self = shift;
my $g = shift; #the containing graph
if ($self->orientation eq 'horizontal') {
$g->im->string( $self->font,
$g->ii($self->x)+int( $self->lr_nudge*($self->font->width) ),
$g->jj($self->y)+int( $self->tb_nudge*($self->font->height) ),
$self->str,
${$g->colors}{$self->color}
);
}
elsif ($self->orientation eq 'vertical') {
$g->im->stringUp( $self->font,
$g->ii($self->x)+int( $self->tb_nudge*($self->font->height) ),
$g->jj($self->y)-int( $self->lr_nudge*($self->font->width) ),
$self->str,
${$g->colors}{$self->color}
);

}
}

sub AUTOLOAD {
Expand Down Expand Up @@ -214,6 +234,22 @@ sub tb_nudge {
return $self->{tb_nudge}
}
}

sub orientation {
my $self = shift;
my $type = ref($self) || die "$self is not an object";
unless (exists $self->{orientation} ) {
die "Can't find orientation field in object of class $type";
}

if (@_) {
return $self->{orientation} = shift;
} else {
return $self->{orientation}
}
}


sub DESTROY {
# doing nothing about destruction, hope that isn't dangerous
}
Expand Down
84 changes: 57 additions & 27 deletions lib/Matrix.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
Matrix - Matrix of Reals

Implements overrides for MatrixReal.pm for WeBWorK
In general it is better to use MathObjects Matrices (Value::Matrix)
in writing PG problem. The answer checking is much superior with better
error messages for syntax errors in student entries. Some of the
subroutines in this file are still used behind the scenes
by Value::Matrix to perform calculations,
such as decompose_LR().

=head1 DESCRIPTION

Expand Down Expand Up @@ -68,8 +74,23 @@ sub _stringify {
return($s);
}

# obtain the Left Right matrices of the decomposition and the two pivot permutation matrices
# the original is M = PL*L*R*PR
=head3 Accessor functions

(these are deprecated for direct use. Use the covering Methods
provided by MathObject Matrices instead.)

L($matrix) - return matrix L of the LR decomposition
R($matrix) - return matrix R of the LR decomposition
PL($matrix) - return permutation matrix
PR($matrix) - return permutation matrix
Original matrix is PL * L * R *PR = M

Obtain the Left Right matrices of the decomposition
and the two pivot permutation matrices
the original is M = PL*L*R*PR

=cut

sub L {
my $matrix = shift;
my $rows = $matrix->[1];
Expand All @@ -83,6 +104,7 @@ sub L {
}
$L_matrix;
}

sub R {
my $matrix = shift;
my $rows = $matrix->[1];
Expand Down Expand Up @@ -117,12 +139,14 @@ sub PR { # use this permuation on the right PL*L*R*PR =M
$PR_matrix;

}
# obtain the Left Right matrices of the decomposition and the two pivot permutation matrices
# the original is M = PL*L*R*PR


=head4

Method $matrix->rh_options

Meant for internal use when dealing with MatrixReal1

=cut

sub rh_options {
Expand All @@ -137,9 +161,13 @@ sub rh_options {
Method $matrix->trace

Returns: scalar which is the trace of the matrix.

Used by MathObject Matrices for calculating the trace.
Deprecated for direct use in PG questions.

=cut


sub trace {
my $self = shift;
my $rows = $self->[1];
Expand All @@ -152,9 +180,12 @@ sub trace {
$sum;
}


=head4

Method $matrix->new_from_array_ref
Method $new_matrix = $matrix->new_from_array_ref ([[a,b,c],[d,e,f]])

Deprecated in favor of using creation tools for MathObject Matrices

=cut

Expand All @@ -172,6 +203,8 @@ sub new_from_array_ref { # this will build a matrix or a row vector from [a, b

Method $matrix->array_ref

Converts Matrix from an ARRAY to an ARRAY reference.

=cut

sub array_ref {
Expand All @@ -183,6 +216,8 @@ sub array_ref {

Method $matrix->list

Converts a Matrix column vector to an ARRAY (list).

=cut

sub list { # this is used only for column vectors
Expand All @@ -196,29 +231,14 @@ sub list { # this is used only for column vectors
@list;
}

=head4

Method $matrix->new_from_list

=cut

sub new_from_list { # this builds a row vector from an array
my $class = shift;
my @list = @_;
my $cols = @list;
my $rows = 1;
my $matrix = new Matrix($rows, $cols);
my $i=1;
while(@list) {
my $elem = shift(@list);
$matrix->assign($i++,1, $elem);
}
$matrix;
}

=head4

Method $matrix->new_row_matrix

Deprecated -- there are better tools for MathObject Matrices.

Create a row 1 by n matrix from a list. This subroutine appears to be broken

=cut

Expand All @@ -239,7 +259,9 @@ sub new_row_matrix { # this builds a row vector from an array
=head4

Method $matrix->proj

Provides behind the scenes calculations for MathObject Matrix->proj
Deprecated for direct use in favor of methods of MathObject matrix

=cut

sub proj{
Expand All @@ -251,6 +273,8 @@ sub proj{
=head4

Method $matrix->proj_coeff
Provides behind the scenes calculations for MathObject Matrix->proj_coeff
Deprecated for direct use in favor of methods of MathObject matrix

=cut

Expand All @@ -271,6 +295,8 @@ sub proj_coeff{

Method $matrix->new_column_matrix

Create column matrix from an ARRAY reference (list reference)

=cut

sub new_column_matrix {
Expand All @@ -293,6 +319,8 @@ sub new_column_matrix {
vectors.

Method $matrix->new_from_col_vecs

Deprecated: The tools for creating MathObjects Matrices are simpler

=cut

Expand Down Expand Up @@ -343,8 +371,8 @@ sub new_from_col_vecs

=head4

Method $matrix->new_from_col_vecs

Function: cp()
Provides ability to use complex numbers.
=cut

sub cp { # MEG makes new copies of complex number
Expand Down Expand Up @@ -462,6 +490,8 @@ sub transpose

Method $matrix->decompose_LR

Used by MathObjects Matrix for LR decomposition
Deprecated for direct use in PG problems.
=cut

sub decompose_LR
Expand Down
Loading