diff --git a/Contrib/METU-NCC/Applied_Math/fourier/Omega.pg b/Contrib/METU-NCC/Applied_Math/fourier/Omega.pg index 217a953fd7..8caf0e7bd5 100644 --- a/Contrib/METU-NCC/Applied_Math/fourier/Omega.pg +++ b/Contrib/METU-NCC/Applied_Math/fourier/Omega.pg @@ -58,6 +58,10 @@ $wj = Complex(cos(2*pi*$j/$N),-sin(2*pi*$j/$N)); Context("Numeric"); Context()->variables->are('i'=>"Real"); Context()->functions->disable('Trig'); +Context()->flags->set( + tolerance => 0.001, + tolType => "absolute", +); $w = Formula($w->string ); $wbar = Formula($wbar->string); diff --git a/Contrib/METU-NCC/Applied_Math/trusses/truss-2node-4bar.pg b/Contrib/METU-NCC/Applied_Math/trusses/truss-2node-4bar.pg index c19d333113..edde467be6 100644 --- a/Contrib/METU-NCC/Applied_Math/trusses/truss-2node-4bar.pg +++ b/Contrib/METU-NCC/Applied_Math/trusses/truss-2node-4bar.pg @@ -13,11 +13,11 @@ DOCUMENT() ; loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "parserVectorUtils.pl", - "PGcourse.pl" -); +"PGstandard.pl", +"MathObjects.pl", +"parserVectorUtils.pl", +"PGcourse.pl" +) ; TEXT(beginproblem()); ####################################### diff --git a/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar.pg b/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar.pg index c9564886fa..732754d34a 100644 --- a/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar.pg +++ b/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar.pg @@ -13,15 +13,14 @@ DOCUMENT() ; loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGchoicemacros.pl", - "parserPopUp.pl", - "unionTables.pl", - "MatrixCheckers.pl", - "PGcourse.pl" -); +"PGstandard.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", +"PGchoicemacros.pl", +"parserPopUp.pl", +"unionTables.pl", +"MatrixCheckers.pl" +) ; TEXT(beginproblem()); ####################################### diff --git a/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar_diamond.pg b/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar_diamond.pg index e0adfa5472..b90fcac774 100644 --- a/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar_diamond.pg +++ b/Contrib/METU-NCC/Applied_Math/trusses/truss-3node-4bar_diamond.pg @@ -13,16 +13,15 @@ DOCUMENT() ; loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGchoicemacros.pl", - "parserPopUp.pl", - "unionTables.pl", - "MatrixCheckers.pl", - "PGmatrixmacros.pl", - "PGcourse.pl" -); +"PGstandard.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", +"PGchoicemacros.pl", +"parserPopUp.pl", +"unionTables.pl", +"MatrixCheckers.pl", +"PGmatrixmacros.pl" +) ; TEXT(beginproblem()); ####################################### diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-cx.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-cx.pg index 538d58abb0..8e72856a37 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-cx.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-cx.pg @@ -25,7 +25,6 @@ loadMacros( "MathObjects.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-rep.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-rep.pg index a6e1c785e3..6b19c8518e 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-rep.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog-rep.pg @@ -25,7 +25,6 @@ loadMacros( "MathObjects.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog.pg index 6a97f002cf..9959945a43 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system-nonhomog.pg @@ -25,7 +25,6 @@ loadMacros( "MathObjects.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-cx.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-cx.pg index 5b9c00ad0d..a1eda36ccd 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-cx.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-cx.pg @@ -21,12 +21,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGmatrixmacros.pl", - "parserMultiAnswer.pl", - "unionTables.pl", - "PGcourse.pl" +"PGstandard.pl", +"MathObjects.pl", +"PGmatrixmacros.pl", +"parserMultiAnswer.pl", +"PGcourse.pl", +"unionTables.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-rep.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-rep.pg index 9715fdac26..ef62b801b8 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-rep.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln-rep.pg @@ -21,12 +21,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGmatrixmacros.pl", - "parserMultiAnswer.pl", - "unionTables.pl", - "PGcourse.pl" +"PGstandard.pl", +"MathObjects.pl", +"PGmatrixmacros.pl", +"parserMultiAnswer.pl", +"PGcourse.pl", +"unionTables.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln.pg b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln.pg index 25d469e1c2..77044098a4 100644 --- a/Contrib/METU-NCC/Diff_Eq/2x2-system_soln.pg +++ b/Contrib/METU-NCC/Diff_Eq/2x2-system_soln.pg @@ -21,12 +21,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGmatrixmacros.pl", - "parserMultiAnswer.pl", - "unionTables.pl", - "PGcourse.pl" +"PGstandard.pl", +"MathObjects.pl", +"PGmatrixmacros.pl", +"parserMultiAnswer.pl", +"PGcourse.pl", +"unionTables.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/3x3-system-convert.pg b/Contrib/METU-NCC/Diff_Eq/3x3-system-convert.pg index 09b9336baf..5b71ecebe8 100644 --- a/Contrib/METU-NCC/Diff_Eq/3x3-system-convert.pg +++ b/Contrib/METU-NCC/Diff_Eq/3x3-system-convert.pg @@ -17,7 +17,6 @@ loadMacros( "MathObjects.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); Context("Numeric"); diff --git a/Contrib/METU-NCC/Diff_Eq/bvp-eigen.pg b/Contrib/METU-NCC/Diff_Eq/bvp-eigen.pg index 4a12dc72a0..35cf1554fe 100644 --- a/Contrib/METU-NCC/Diff_Eq/bvp-eigen.pg +++ b/Contrib/METU-NCC/Diff_Eq/bvp-eigen.pg @@ -10,12 +10,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "unionLists.pl", - "PGchoicemacros.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "unionLists.pl", + "PGchoicemacros.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/bvp.pg b/Contrib/METU-NCC/Diff_Eq/bvp.pg index 6ea5caa1b9..29eb759a77 100644 --- a/Contrib/METU-NCC/Diff_Eq/bvp.pg +++ b/Contrib/METU-NCC/Diff_Eq/bvp.pg @@ -10,14 +10,13 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "parserMultiAnswer.pl", - "unionLists.pl", - "PGchoicemacros.pl", - "contextFraction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "parserMultiAnswer.pl", + "unionLists.pl", + "PGchoicemacros.pl", + "contextFraction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/fourier-cos.pg b/Contrib/METU-NCC/Diff_Eq/fourier-cos.pg index 19debcafb2..8c90b13c59 100644 --- a/Contrib/METU-NCC/Diff_Eq/fourier-cos.pg +++ b/Contrib/METU-NCC/Diff_Eq/fourier-cos.pg @@ -21,7 +21,6 @@ loadMacros( "PGgraphmacros.pl", "answerHints.pl", "unionLists.pl", - "PGcourse.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/fourier-sin.pg b/Contrib/METU-NCC/Diff_Eq/fourier-sin.pg index a703be6039..c704c784c6 100644 --- a/Contrib/METU-NCC/Diff_Eq/fourier-sin.pg +++ b/Contrib/METU-NCC/Diff_Eq/fourier-sin.pg @@ -21,7 +21,6 @@ loadMacros( "PGgraphmacros.pl", "answerHints.pl", "unionLists.pl", - "PGcourse.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/fourier-sin_cos.pg b/Contrib/METU-NCC/Diff_Eq/fourier-sin_cos.pg index 29219c1876..e5c9fdea9f 100644 --- a/Contrib/METU-NCC/Diff_Eq/fourier-sin_cos.pg +++ b/Contrib/METU-NCC/Diff_Eq/fourier-sin_cos.pg @@ -21,7 +21,6 @@ loadMacros( "PGgraphmacros.pl", "answerHints.pl", "unionLists.pl", - "PGcourse.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/high-order-linear_1.pg b/Contrib/METU-NCC/Diff_Eq/high-order-linear_1.pg index 74a5623562..a36d1ab0a6 100644 --- a/Contrib/METU-NCC/Diff_Eq/high-order-linear_1.pg +++ b/Contrib/METU-NCC/Diff_Eq/high-order-linear_1.pg @@ -18,7 +18,6 @@ loadMacros( "PGmatrixmacros.pl", "MathObjects.pl", "parserMultiAnswer.pl", - "PGcourse.pl" ); ##################################### diff --git a/Contrib/METU-NCC/Diff_Eq/impulse-response.pg b/Contrib/METU-NCC/Diff_Eq/impulse-response.pg index 4ef0068ce2..9fb9e1c529 100644 --- a/Contrib/METU-NCC/Diff_Eq/impulse-response.pg +++ b/Contrib/METU-NCC/Diff_Eq/impulse-response.pg @@ -20,7 +20,6 @@ loadMacros( "PGmatrixmacros.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-inv_I.pg b/Contrib/METU-NCC/Diff_Eq/laplace-inv_I.pg index 583bdbf78e..29cc5c3c71 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-inv_I.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-inv_I.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-inv_II.pg b/Contrib/METU-NCC/Diff_Eq/laplace-inv_II.pg index abb925b60c..5a21284542 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-inv_II.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-inv_II.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-inv_III.pg b/Contrib/METU-NCC/Diff_Eq/laplace-inv_III.pg index 76d1eb5a14..c1819275d3 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-inv_III.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-inv_III.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-inv_random.pg b/Contrib/METU-NCC/Diff_Eq/laplace-inv_random.pg index 83312a552c..9538d321d2 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-inv_random.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-inv_random.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_t.pg b/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_t.pg index 347dba764e..e046a29279 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_t.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_t.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_trig.pg b/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_trig.pg index f5f9923738..e9a1077329 100644 --- a/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_trig.pg +++ b/Contrib/METU-NCC/Diff_Eq/laplace-step_exp_trig.pg @@ -16,13 +16,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGunion.pl", - "answerHints.pl", - "parserAssignment.pl", - "parserFunction.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "PGunion.pl", + "answerHints.pl", + "parserAssignment.pl", + "parserFunction.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog.pg b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog.pg index 9c0771ad0d..6fd0341758 100644 --- a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog.pg +++ b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog.pg @@ -21,7 +21,6 @@ loadMacros( "parserMultiAnswer.pl", "answerHints.pl", "extraAnswerEvaluators.pl", # needed for equation_cmp - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_euler.pg b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_euler.pg index 80dd4fa341..649313286d 100644 --- a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_euler.pg +++ b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_euler.pg @@ -21,7 +21,6 @@ loadMacros( "parserMultiAnswer.pl", "answerHints.pl", "extraAnswerEvaluators.pl", # needed for equation_cmp - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_undet-coef.pg b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_undet-coef.pg index b7d29bba5c..1c00e4a667 100644 --- a/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_undet-coef.pg +++ b/Contrib/METU-NCC/Diff_Eq/linear-nonhomog_undet-coef.pg @@ -21,7 +21,6 @@ loadMacros( "parserMultiAnswer.pl", "answerHints.pl", "extraAnswerEvaluators.pl", # needed for equation_cmp - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Diff_Eq/pde-heat1.pg b/Contrib/METU-NCC/Diff_Eq/pde-heat1.pg index eb1dc34225..e5a39f2eb0 100644 --- a/Contrib/METU-NCC/Diff_Eq/pde-heat1.pg +++ b/Contrib/METU-NCC/Diff_Eq/pde-heat1.pg @@ -17,13 +17,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "parserMultiAnswer.pl", - "unionLists.pl", - "scaffold.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "parserMultiAnswer.pl", + "unionLists.pl", + "scaffold.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/pde-heat2.pg b/Contrib/METU-NCC/Diff_Eq/pde-heat2.pg index 44e731a998..b02526df0c 100644 --- a/Contrib/METU-NCC/Diff_Eq/pde-heat2.pg +++ b/Contrib/METU-NCC/Diff_Eq/pde-heat2.pg @@ -17,13 +17,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "parserMultiAnswer.pl", - "unionLists.pl", - "scaffold.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "parserMultiAnswer.pl", + "unionLists.pl", + "scaffold.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/pde-heat3.pg b/Contrib/METU-NCC/Diff_Eq/pde-heat3.pg index 110643b2ab..acd7e2b8fb 100644 --- a/Contrib/METU-NCC/Diff_Eq/pde-heat3.pg +++ b/Contrib/METU-NCC/Diff_Eq/pde-heat3.pg @@ -17,13 +17,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "parserMultiAnswer.pl", - "unionLists.pl", - "scaffold.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "parserMultiAnswer.pl", + "unionLists.pl", + "scaffold.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/pde-separation.pg b/Contrib/METU-NCC/Diff_Eq/pde-separation.pg index 588a016b44..94561a711e 100644 --- a/Contrib/METU-NCC/Diff_Eq/pde-separation.pg +++ b/Contrib/METU-NCC/Diff_Eq/pde-separation.pg @@ -12,12 +12,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "answerHints.pl", - "parserMultiAnswer.pl", - "unionLists.pl", - "PGcourse.pl" + "PGstandard.pl", + "MathObjects.pl", + "answerHints.pl", + "parserMultiAnswer.pl", + "unionLists.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Diff_Eq/pplane-match_1.pg b/Contrib/METU-NCC/Diff_Eq/pplane-match_1.pg index 3fdd24905d..f00c5ba2b2 100644 --- a/Contrib/METU-NCC/Diff_Eq/pplane-match_1.pg +++ b/Contrib/METU-NCC/Diff_Eq/pplane-match_1.pg @@ -17,12 +17,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "PGgraphmacros.pl", - "PGunion.pl", - "imageChoice.pl", - "PGcourse.pl" +"PGstandard.pl", +"MathObjects.pl", +"PGgraphmacros.pl", +"PGunion.pl", +"imageChoice.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Linear_Algebra/2.1.8.pg b/Contrib/METU-NCC/Linear_Algebra/2.1.8.pg new file mode 100644 index 0000000000..8fc9cea7d2 --- /dev/null +++ b/Contrib/METU-NCC/Linear_Algebra/2.1.8.pg @@ -0,0 +1,102 @@ +# DESCRIPTION +# Converting matrix equation to system of equations +# ENDDESCRIPTION +## DBsubject(Linear algebra) +## DBchapter(Matrices) +## DBsection(Matrix algebra) +## Author(Benjamin Walter) +## Level(3) +## KEYWORDS('linear algebra','vectors') +## MO(1) +## Static(0) + +DOCUMENT(); +loadMacros( +"PG.pl", +"PGbasicmacros.pl", +"PGchoicemacros.pl", +"PGanswermacros.pl", +"PGgraphmacros.pl", +"PGmatrixmacros.pl", +"PGnumericalmacros.pl", +"PGauxiliaryFunctions.pl", +"PGmorematrixmacros.pl", +"MathObjects.pl", +"freemanMacros.pl", +"PGasu.pl", +"PG.pl", + +); + +# make sure we're in the context we want +Context("Numeric")->variables->are(x=>'Real',y=>'Real'); +$v11=random(1,9,1); +$v12=random(-9,9,1); +$v13=random(-9,9,1); +$v21=random(-9,9,1); +$v22=random(1,9,1); +$v23=random(-9,9,1); +if($v11*$v22==$v12*$v21){$v22=-$v22;} +$v31=random(1,9,1)*random(-1,1,2); +$v32=random(-9,9,1); +$v33=random(1,9,1); +if($v11*$v22*$v33+$v21*$v32*$v13+$v31*$v12*$v23-$v13*$v22*$v31-$v23*$v32*$v11-$v33*$v12*$v21==0){$v33=-$v33;} + + +TEXT(beginproblem()); +$showPartialCorrectAnswers = 1; +BEGIN_TEXT +$PAR +Consider the following vector equation. +$PAR +\[ + \left[\begin{array}{rr} + $v11 & $v12 \\ + $v21 & $v22 \\ + $v31 & $v32 + \end{array}\right] \mathbf{x} = + \left[\begin{array}{r} + $v13 \\ + $v23 \\ + $v33 + \end{array}\right] +\] +$PAR +Express the vector equation as a system of linear equations. (Order your equations from the top.) +$PAR +The first equation is \{ans_rule(5)\}\(x_1+\) \{ans_rule(5)\}\(x_2\) = \{ans_rule(5)\}. +$PAR +The second equation is \{ans_rule(5)\}\(x_1+\) \{ans_rule(5)\}\(x_2\) = \{ans_rule(5)\}. +$PAR +The third equation is \{ans_rule(5)\}\(x_1+\) \{ans_rule(5)\}\(x_2\) = \{ans_rule(5)\}. +$PAR +$PAR +END_TEXT +Context()->normalStrings; + +ANS(num_cmp($v11) ); +ANS(num_cmp($v12) ); +ANS(num_cmp($v13) ); +ANS(num_cmp($v21) ); +ANS(num_cmp($v22) ); +ANS(num_cmp($v23) ); +ANS(num_cmp($v31) ); +ANS(num_cmp($v32) ); +ANS(num_cmp($v33) ); + + +Context()->texStrings; +SOLUTION(EV3(<<'END_SOLUTION')); +$PAR +SOLUTION +$PAR + +Each row of the vector equation becomes a linear equation. +$PAR + + + +END_SOLUTION +Context()->normalStrings; + +ENDDOCUMENT(); diff --git a/Contrib/METU-NCC/Linear_Algebra/2x2-eig_def.pg b/Contrib/METU-NCC/Linear_Algebra/2x2-eig_def.pg index e3636fc4f9..576bcd2780 100644 --- a/Contrib/METU-NCC/Linear_Algebra/2x2-eig_def.pg +++ b/Contrib/METU-NCC/Linear_Algebra/2x2-eig_def.pg @@ -22,11 +22,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval.pg b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval.pg index bdfc53029b..96476d7160 100644 --- a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval.pg +++ b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval.pg @@ -20,11 +20,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_2.pg b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_2.pg index 89763c1243..285f2a9f98 100644 --- a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_2.pg +++ b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_2.pg @@ -20,11 +20,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_cx.pg b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_cx.pg index f63267b469..899c9a28b3 100644 --- a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_cx.pg +++ b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_cx.pg @@ -20,11 +20,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_rep.pg b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_rep.pg index 99e1bf3d90..f9f91234ee 100644 --- a/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_rep.pg +++ b/Contrib/METU-NCC/Linear_Algebra/2x2-eigenval_rep.pg @@ -20,11 +20,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-2d_eig.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-2d_eig.pg index 1a1562bf19..c70c4dd06c 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-2d_eig.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-2d_eig.pg @@ -18,12 +18,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MatrixUnits.pl", # Needed for GL3Z() - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGmatrixmacros.pl", - "PGcourse.pl" + "MatrixUnits.pl", # Needed for GL3Z() + "MathObjects.pl", + "parserMultiAnswer.pl", + "PGmatrixmacros.pl", + "PGstandard.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def-small.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def-small.pg index 6679284abf..9fb41d73ab 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def-small.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def-small.pg @@ -22,11 +22,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def.pg index 11f374ea91..614eebfa82 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eig_def.pg @@ -22,11 +22,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_0.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_0.pg index 4b6f302321..ab3ed1bc65 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_0.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_0.pg @@ -21,11 +21,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_1.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_1.pg index b6991546e0..096fc068f3 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_1.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_1.pg @@ -21,11 +21,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_2.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_2.pg index 84d3a9cb06..cc7ff7395c 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_2.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_2.pg @@ -21,11 +21,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_3.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_3.pg index 029d6e203d..ef655db628 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_3.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-eigenval_3.pg @@ -23,11 +23,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", +"PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig.pg index c3c33a9384..228b615065 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig.pg @@ -18,12 +18,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MatrixUnits.pl", # Needed for GL3Z() - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGmatrixmacros.pl", - "PGcourse.pl" + "MatrixUnits.pl", # Needed for GL3Z() + "MathObjects.pl", + "parserMultiAnswer.pl", + "PGmatrixmacros.pl", + "PGstandard.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig_prop.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig_prop.pg index 741166b8d4..9aad7d01ea 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig_prop.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_eig_prop.pg @@ -27,7 +27,6 @@ loadMacros( "MathObjects.pl", "parserMultiAnswer.pl", "answerHints.pl", - "PGcourse.pl" ); diff --git a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_gen_eig.pg b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_gen_eig.pg index c0ad29dfcf..81f88f94a3 100644 --- a/Contrib/METU-NCC/Linear_Algebra/3x3-gen_gen_eig.pg +++ b/Contrib/METU-NCC/Linear_Algebra/3x3-gen_gen_eig.pg @@ -18,12 +18,11 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MatrixUnits.pl", # Needed for GL3Z() - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" + "MatrixUnits.pl", # Needed for GL3Z() + "PGstandard.pl", + "PGmatrixmacros.pl", + "MathObjects.pl", + "parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/4x4-det_block.pg b/Contrib/METU-NCC/Linear_Algebra/4x4-det_block.pg index b2cc8c2768..c27cbd7dac 100644 --- a/Contrib/METU-NCC/Linear_Algebra/4x4-det_block.pg +++ b/Contrib/METU-NCC/Linear_Algebra/4x4-det_block.pg @@ -12,15 +12,15 @@ ## Level(2) ## MO(1) ## Static(0) -## KEYWORDS('algebra', 'matrix operation', 'matrix', 'determinant') +# KEYWORDS('algebra', 'matrix operation', 'matrix', 'determinant') DOCUMENT(); # This should be the first executable line in the problem. loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "MathObjects.pl", - "PGcourse.pl", +"PGstandard.pl", +"PGchoicemacros.pl", +"MathObjects.pl", +"PGcourse.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Linear_Algebra/4x4-det_triangle.pg b/Contrib/METU-NCC/Linear_Algebra/4x4-det_triangle.pg index f4d5cd10a9..065f19d12f 100644 --- a/Contrib/METU-NCC/Linear_Algebra/4x4-det_triangle.pg +++ b/Contrib/METU-NCC/Linear_Algebra/4x4-det_triangle.pg @@ -17,10 +17,10 @@ DOCUMENT(); # This should be the first executable line in the problem. loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "MathObjects.pl", - "PGcourse.pl", +"PGstandard.pl", +"PGchoicemacros.pl", +"MathObjects.pl", +"PGcourse.pl", ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/Linear_Algebra/4x4-eig_def.pg b/Contrib/METU-NCC/Linear_Algebra/4x4-eig_def.pg index 36262494f8..ef39f8641d 100644 --- a/Contrib/METU-NCC/Linear_Algebra/4x4-eig_def.pg +++ b/Contrib/METU-NCC/Linear_Algebra/4x4-eig_def.pg @@ -22,11 +22,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "MathObjects.pl", - "parserMultiAnswer.pl", - "PGcourse.pl" +"PGstandard.pl", +"PGmatrixmacros.pl", +"MathObjects.pl", +"parserMultiAnswer.pl", ); diff --git a/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Intersect_plane_3.pg b/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Intersect_plane_3.pg index 55f45993a3..e37f540e15 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Intersect_plane_3.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Intersect_plane_3.pg @@ -142,6 +142,9 @@ $PAR $PAR \(\qquad \displaystyle B = \bigl\lbrace $vars\ \Big|\ \ $Beqn=$Bd \bigr\rbrace\) $PAR +Note: for this problem to be checked correctly, all of your answers must be +points. If any of your answers are numbers or words then none of your +answers will be checked. \{$MAns->ans_rule(10);\} $BR \{$MAns->ans_rule(10);\} $BR diff --git a/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Minus_P2.pg b/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Minus_P2.pg index 48c8e35330..70598f5615 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Minus_P2.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week1/Set-Minus_P2.pg @@ -40,20 +40,20 @@ Context()->variables->are(x=>"Real"); $i = random(0,1); @ineq = ("\le","\ge"); -($a,$c) = pick(2,(-2..2)); +do { ($a,$c) = pick(2,(-2..2)); } until ($c!=0); do { $b = non_zero_random(-2,2) } until ($b!=$a); $d = ($b-$a)+$c + (($i==0) ? random(1,3) : -random(1,3)); -$m1 = (($i==0) xor ($b-$a < 0)) - ? ceil(($d-$c)/($b-$a))+1 - : floor(($d-$c)/($b-$a))-1; -$m2 = (($i==0) xor ($b*($b-$a) < 0)) - ? ceil(($d-$c)/($b*($b-$a)))+1 - : floor(($d-$c)/($b*($b-$a)))-1; +$m1 = (($i==0) xor ($c-$a < 0)) + ? floor(($d-$b)/($c-$a))-1 + : ceil(($d-$b)/($c-$a))+1; +$m2 = (($i==0) xor ($c*($c-$a) < 0)) + ? floor(($d-$b)/($c*($c-$a)))-1 + : ceil(($d-$b)/($c*($c-$a)))+1; -$ans1 = Formula("$m1*x+($c-$m1*$a)")->reduce; -$ans2 = Formula("$m2*x(x-$a)+$c")->reduce; +$ans1 = Formula("$m1*x+($b-$m1*$a)")->reduce; +$ans2 = Formula("$m2*x(x-$a)+$b")->reduce; $MAns = MultiAnswer($ans1, $ans2 )->with( diff --git a/Contrib/METU-NCC/Linear_Algebra/Week11/reduce-4x5r3.pg b/Contrib/METU-NCC/Linear_Algebra/Week11/reduce-4x5r3.pg index 0d216e81bd..a97cf20e31 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week11/reduce-4x5r3.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week11/reduce-4x5r3.pg @@ -60,6 +60,9 @@ foreach my $i (0 .. $m-1) { ($j==0) ? non_zero_random(-1,1) : non_zero_random(-2,2); } } +while ( Vector(@{$La[$m-1]}[0..($m-2)])->isParallel(Vector(@{$La[$m-2]}[0..($m-2)])) ) { + foreach my $j (0 .. $m-2) { $La[$m-1][$j] = non_zero_random(-2,2); } +} my $Lm = Matrix(@La); diff --git a/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_h.pg b/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_h.pg index 93fe446a71..d5107e6e70 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_h.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_h.pg @@ -97,6 +97,9 @@ foreach my $i (0 .. $m-1) { ($j==0) ? non_zero_random(-1,1) : non_zero_random(-2,2); } } +while ( Vector(@{$La[$m-1]}[0..($m-2)])->isParallel(Vector(@{$La[$m-2]}[0..($m-2)])) ) { + foreach my $j (0 .. $m-2) { $La[$m-1][$j] = non_zero_random(-2,2); } +} my $Lm = Matrix(@La); diff --git a/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_nh.pg b/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_nh.pg index 3a01498dfd..2bbafea5ec 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_nh.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week11/solve-4x5r3_nh.pg @@ -96,6 +96,9 @@ foreach my $i (0 .. $m-1) { ($j==0) ? non_zero_random(-1,1) : non_zero_random(-2,2); } } +while ( Vector(@{$La[$m-1]}[0..($m-2)])->isParallel(Vector(@{$La[$m-2]}[0..($m-2)])) ) { + foreach my $j (0 .. $m-2) { $La[$m-1][$j] = non_zero_random(-2,2); } +} my $Lm = Matrix(@La); diff --git a/Contrib/METU-NCC/Linear_Algebra/Week5/Intersect_basis-R.pg b/Contrib/METU-NCC/Linear_Algebra/Week5/Intersect_basis-R.pg index d6a87cc77b..07060198d3 100644 --- a/Contrib/METU-NCC/Linear_Algebra/Week5/Intersect_basis-R.pg +++ b/Contrib/METU-NCC/Linear_Algebra/Week5/Intersect_basis-R.pg @@ -32,7 +32,7 @@ sub pick { } -sub gcd { +sub GCD { my $a = abs(shift); my $b = abs(shift); ($a,$b) = ($b,$a) if $a < $b; return $a if $b == 0; @@ -79,20 +79,20 @@ foreach (0..3) { } my $gcd; -$gcd = 0; -foreach (0..$#v) { $gcd = gcd($v[$_],$gcd); } +$gcd = $v[0]; +foreach (1..$#v) { $gcd = GCD($v[$_],$gcd); } foreach (0..$#v) { $v[$_] = $v[$_]/$gcd; } -$gcd = 0; -foreach (0..$#w) { $gcd = gcd($w[$_],$gcd); } +$gcd = $w[0]; +foreach (1..$#w) { $gcd = GCD($w[$_],$gcd); } foreach (0..$#w) { $w[$_] = $w[$_]/$gcd; } -$gcd = 0; -foreach (0..$#wa) { $gcd = gcd($wa[$_],$gcd); } +$gcd = $wa[0]; +foreach (1..$#wa) { $gcd = GCD($wa[$_],$gcd); } foreach (0..$#wa) { $wa[$_] = $wa[$_]/$gcd; } -$gcd = 0; -foreach (0..$#vp) { $gcd = gcd($vp[$_],$gcd); } +$gcd = $vp[0]; +foreach (1..$#vp) { $gcd = GCD($vp[$_],$gcd); } foreach (0..$#vp) { $vp[$_] = $vp[$_]/$gcd; } -$gcd = 0; -foreach (0..$#wp) { $gcd = gcd($wp[$_],$gcd); } +$gcd = $wp[0]; +foreach (1..$#wp) { $gcd = GCD($wp[$_],$gcd); } foreach (0..$#wp) { $wp[$_] = $wp[$_]/$gcd; } diff --git a/Contrib/METU-NCC/Linear_Algebra/solve_lower-triangular.pg b/Contrib/METU-NCC/Linear_Algebra/solve_lower-triangular.pg index 6404a786da..68c9475253 100644 --- a/Contrib/METU-NCC/Linear_Algebra/solve_lower-triangular.pg +++ b/Contrib/METU-NCC/Linear_Algebra/solve_lower-triangular.pg @@ -11,11 +11,12 @@ DOCUMENT(); # This should be the first executable line in the problem. loadMacros( - "PGstandard.pl", - "PGmatrixmacros.pl", - "PGmorematrixmacros.pl", - "MathObjects.pl", - "PGcourse.pl" + "PG.pl", + "PGbasicmacros.pl", + "PGmatrixmacros.pl", + "PGmorematrixmacros.pl", + "PGstandard.pl", + "MathObjects.pl" ); TEXT(beginproblem()); diff --git a/Contrib/METU-NCC/MAT100/23a_Degree-radian.pg b/Contrib/METU-NCC/MAT100/23a_Degree-radian.pg deleted file mode 100644 index 710d86a0ee..0000000000 --- a/Contrib/METU-NCC/MAT100/23a_Degree-radian.pg +++ /dev/null @@ -1,92 +0,0 @@ -## BEGIN_DESCRIPTION -## Convert from degrees to radians (5 conversions) -## END_DESCRIPTION -## -############################################## -## DBsubject(Trigonometry) -## DBchapter(Geometric and algebraic foundations for trigonometry) -## DBsection(Radians, converting radians & degrees) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "PGasu.pl", - "PGcourse.pl", - "MathObjects.pl", - "contextFraction.pl" -); - -sub pick { - my ($k, @in) = @_; - my @out = (); - while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } - @out; -} - -TEXT(beginproblem()); -$showPartialCorrectAnswers = 1; -Context("Fraction-NoDecimals"); - -my @c = ( - (-11,-7,-5,5,7,11)[random(0,5)], - (-7, -5,-3,3,5, 7)[random(0,5)], - (-8,-7,-5,-4,-2,2,4,5,7,8)[random(0,9)], - (-7,-5,-3,3,5,7)[random(0,5)], - (-5,-4,-3,3,4,5)[random(0,5)], -); - -@r = ( - Compute(($c[0]%12)."*pi/6")->reduce, - Compute(($c[1]%8)."*pi/4")->reduce, - Compute(($c[2]%6)."*pi/3")->reduce, - Compute(($c[3]%4)."*pi/2")->reduce, - Compute(($c[4]%2)."*pi/1")->reduce -); - -@d = ( - Compute("30*$c[0]"), - Compute("45*$c[1]"), - Compute("60*$c[2]"), - Compute("90*$c[3]"), - Compute("180*$c[4]") -); - -foreach (0..$#c) { $s[$_] = ($c[$_] < 0) ? "" : "\phantom{-}"; } - -@i = pick(5,(0..4)); - -Context()->texStrings; -BEGIN_TEXT - -Convert the following $BBOLD degree $EBOLD measures to $BBOLD radians. $EBOLD$BR -(Write your answers as angles \(0 \le \theta < 2\pi \). Write as a fraction -using \(\fbox{pi}\) for \(\pi\).) - -END_TEXT -for ($j=0; $j <= $#d; $j++) { -BEGIN_TEXT - -$PAR $SPACE $SPACE -\($s[$i[$j]]$d[$i[$j]]\ \text{degrees}\ = \ \) -\{ ans_rule(10) \} \(\text{radians}\) - -END_TEXT -} - -Context()->normalStrings; - -for ($j=0; $j <= $#r; $j++) { - ANS( $r[$i[$j]]->cmp() ); -} - -ENDDOCUMENT(); # This should be the last executable line in the problem. - diff --git a/Contrib/METU-NCC/MAT100/23b_Radian-degree.pg b/Contrib/METU-NCC/MAT100/23b_Radian-degree.pg deleted file mode 100644 index 38ed9a74dc..0000000000 --- a/Contrib/METU-NCC/MAT100/23b_Radian-degree.pg +++ /dev/null @@ -1,91 +0,0 @@ -## BEGIN_DESCRIPTION -## Convert from radians to degrees (5 conversions) -## END_DESCRIPTION -## -############################################## -## DBsubject(Trigonometry) -## DBchapter(Geometric and algebraic foundations for trigonometry) -## DBsection(Radians, converting radians & degrees) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "PGasu.pl", - "PGcourse.pl", - "MathObjects.pl", - "contextFraction.pl" -); - -sub pick { - my ($k, @in) = @_; - my @out = (); - while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } - @out; -} - -TEXT(beginproblem()); -$showPartialCorrectAnswers = 1; -Context("Fraction-NoDecimals"); - -my @c = ( - (-11,-7,-5,5,7,11)[random(0,5)], - (-7, -5,-3,3,5, 7)[random(0,5)], - (-8,-7,-5,-4,-2,2,4,5,7,8)[random(0,9)], - (-7,-5,-3,3,5,7)[random(0,5)], - (-5,-4,-3,3,4,5)[random(0,5)], -); - -@r = ( - "\frac{$c[0]\pi}{6}", - "\frac{$c[1]\pi}{4}", - "\frac{$c[2]\pi}{3}", - "\frac{$c[3]\pi}{2}", - "$c[4]\pi" -); - -@d = ( - Compute((30*$c[0])%360), - Compute((45*$c[1])%360), - Compute((60*$c[2])%360), - Compute((90*$c[3])%360), - Compute((180*$c[4])%360) -); - -foreach (0..$#c) { $s[$_] = ($c[$_] < 0) ? "" : "\phantom{x}"; } - -@i = pick(5,(0..4)); - -Context()->texStrings; -BEGIN_TEXT - -Convert the following $BBOLD radian $EBOLD measures to $BBOLD degrees. $EBOLD$BR -(Write your answers as angles \(0^\circ \le \theta < 360^\circ \).) - -END_TEXT -for ($j=0; $j <= $#r; $j++) { -BEGIN_TEXT - -$PAR $SPACE $SPACE -\($s[$i[$j]]$r[$i[$j]]\ \text{radians}\ = \ \) -\{ ans_rule(10) \} \(\text{degrees}\) - -END_TEXT -} - -Context()->normalStrings; - -for ($j=0; $j <= $#d; $j++) { - ANS( $d[$i[$j]]->cmp() ); -} - -ENDDOCUMENT(); # This should be the last executable line in the problem. - diff --git a/Contrib/METU-NCC/MAT100/26_Trig-identities.pg b/Contrib/METU-NCC/MAT100/26_Trig-identities.pg deleted file mode 100644 index 05892affd6..0000000000 --- a/Contrib/METU-NCC/MAT100/26_Trig-identities.pg +++ /dev/null @@ -1,105 +0,0 @@ -## BEGIN_DESCRIPTION -## Solve trigonometric equation using trig identities -## END_DESCRIPTION -## -############################################## -## DBsubject(Trigonometry) -## DBchapter(Analytic trigonometry) -## DBsection(Solving trigonometric equations exactly) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - - -DOCUMENT(); - -loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "AnswerFormatHelp.pl", - "PGcourse.pl" -); - -TEXT(beginproblem()); - -COMMENT("Randomly choose one of eight problems$BR (all use double angle for cos)"); - -################################### -# Setup - -Context("Numeric"); -Context()->functions->disable("Trig"); - -@expression = ( - " \cos(x) + \cos(2x) = 0", #1. (2cos(x)-1)(cos(x)+1) = 0 - "3\cos(x) + \cos(2x) = -2", #2. (2cos(x)+1)(cos(x)+1) = 0 - "\cos(2x) + 2 = 3\cos(x)", #3. (2cos(x)-1)(cos(x)-1) = 0 - "\cos(2x) = \cos(x)", #4. (2cos(x)+1)(cos(x)-1) = 0 - "\cos(2x) + 3 = 5\cos(x)", #5. (2cos(x)-1)(cos(x)-2) = 0 - "\cos(2x) = 1 + 3\cos(x)", #6. (2cos(x)+1)(cos(x)-2) = 0 - "5\cos(x) + cos(2x) = -3", #7. (2cos(x)+1)(cos(x)+2) = 0 - "3\cos(x) + cos(2x) = 1", #8. (2cos(x)-1)(cos(x)+2) = 0 -); - - -@answer = ( - List(Compute("pi"),Compute("pi/3"),Compute("5 pi/3")), #1 - List(Compute("pi"),Compute("2 pi/3"),Compute("4 pi/3")), #2 - List(Compute("0"), Compute("pi/3"), Compute("5 pi/3")), #3 - List(Compute("0"), Compute("2 pi/3"),Compute("4 pi/3")), #4 - List(Compute("pi/3"),Compute("5 pi/3")), #5 - List(Compute("2 pi/3"),Compute("4 pi/3")), #6 - List(Compute("2 pi/3"),Compute("4 pi/3")), #7 - List(Compute("pi/3"),Compute("5 pi/3")), #8 -); - -$i = random(0,7); - - -################################### -# Main text - -Context()->texStrings; -BEGIN_TEXT -Use trigonometric identities to find all solutions to -\[ $expression[$i] \] -for \( 0 \leq x < 2\pi \). -$PAR -\( x =\) \{ ans_rule(30) \} -$PAR -$SPACE $SPACE Write -solutions separated by commas. -$BR -$SPACE $SPACE Write angles in radians, using "${BTT}pi${ETT}" for \(\pi\). -$BR -$SPACE $SPACE -For example -"${BTT}2pi / 3, 5pi / 4${ETT}" -END_TEXT -Context()->normalStrings; - - -################################## -# Answer evaluation - -$showPartialCorrectAnswers = 1; - -ANS($answer[$i]->cmp( - showHints=>0, - showLengthHints=>0, - partialCredit=>1, - ordered=>0, - removeParens=>1, - requireParenMatch=>0, - implicitList=>1, -) ); - -Context()->texStrings; - - -; -ENDDOCUMENT(); diff --git a/Contrib/METU-NCC/MAT100/27_Complex-roots.pg b/Contrib/METU-NCC/MAT100/27_Complex-roots.pg deleted file mode 100644 index b9dfe71d6c..0000000000 --- a/Contrib/METU-NCC/MAT100/27_Complex-roots.pg +++ /dev/null @@ -1,58 +0,0 @@ -## BEGIN_DESCRIPTION -## Find complex roots to equation -## END_DESCRIPTION -## -############################################## -## DBsubject(Algebra) -## DBchapter(Quadratic equations and functions) -## DBsection(Complex roots) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "MathObjects.pl", - "PGcourse.pl" -); - -TEXT(beginproblem()); - -Context("Complex"); -Context()->variables->are(z=>'Real'); - -$showPartialCorrectAnswers = 0; - -$a = random(2,4,1) * random(-1,1,2); -do { $b = random(2,4,1); } until (abs($b)!=abs($a)); -my $c = $a**2 + $b**2; - -$f = Formula("z^2 - 2*$a z + $c")->reduce; - -Context("LimitedComplex"); -Context()->operators->undefine("^","**","sqrt"); - -$roots = List(Complex("$a+$b i"),Complex("$a-$b i")); - -Context()->texStrings; -TEXT(EV2(<normalStrings; - -ANS( $roots->cmp(partialCredit=>1) ); - -ENDDOCUMENT(); # This should be the last executable line in the problem. - diff --git a/Contrib/METU-NCC/MAT100/3_Absolute-equality.pg b/Contrib/METU-NCC/MAT100/3_Absolute-equality.pg deleted file mode 100644 index 01284ef56e..0000000000 --- a/Contrib/METU-NCC/MAT100/3_Absolute-equality.pg +++ /dev/null @@ -1,63 +0,0 @@ -## BEGIN_DESCRIPTION -## Solve equality with absolute value -## END_DESCRIPTION -## -############################################## -## DBsubject(Algebra) -## DBchapter(Absolute value expressions and functions) -## DBsection(Solving equations with absolute values) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "AnswerFormatHelp.pl", - "PGcourse.pl" -); - -###################################### -# Setup - -$var = ("a","b","t","x","y")[random(0,4)]; - -$a = random(1,7,2); -$b = random(3,9,2); -$c = random(1,3,2); - -$ans = List(Compute("($a-$b*$c)/2"),Compute("($a+$b*$c)/2")); - -###################################### -# Main text - -TEXT(beginproblem()); -$showPartialCorrectAnswers = 0; - -BEGIN_TEXT -Solve the following equality. -\[ \left|\frac{2 $var - $a}{$b}\right| = $c \] -$PAR -Answer: \( $var = \)\{ ans_rule(20) \} -$PAR -$SPACE $SPACE -Enter multiple solutions separated by commas - e.g. "3/2 , sqrt(2)". -END_TEXT - -###################################### -# Answer - -ANS( $ans->cmp(partialCredit=>1)); - - -###################################### - -; -ENDDOCUMENT(); diff --git a/Contrib/METU-NCC/MAT100/3_Simplify.pg b/Contrib/METU-NCC/MAT100/3_Simplify.pg deleted file mode 100644 index cef5a80eb8..0000000000 --- a/Contrib/METU-NCC/MAT100/3_Simplify.pg +++ /dev/null @@ -1,46 +0,0 @@ -## BEGIN_DESCRIPTION -## Simplify expression with negative fractional power -## END_DESCRIPTION -## -############################################## -## DBsubject(Algebra) -## DBchapter(Properties of exponents, rational exponents and radicals) -## DBsection(Properties of rational exponents and radicals) -## Institution(METU-NCC) -## Author(Benjamin Walter) -## MO(1) -## Static(0) -## Level(2) -## Language(en) -############################################### - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", - "PGchoicemacros.pl", - "MathObjects.pl", - "contextFraction.pl", - "PGcourse.pl" -); - -TEXT(beginproblem()); -Context("Fraction-NoDecimals"); -Context()->operators->undefine("^","**"); - -$showPartialCorrectAnswers = 0; - -$a = random(2,5); -$a3 = $a**3; -$ans = Fraction(1,$a**4); - -TEXT(EV2(<cmp() ); - -ENDDOCUMENT(); # This should be the last executable line in the problem. - diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.2_Abs_value2.pg b/Contrib/METU-NCC/MAT100/Ch1/1.2_Abs_value2.pg new file mode 100644 index 0000000000..e273e0d3f5 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.2_Abs_value2.pg @@ -0,0 +1,99 @@ +## BEGIN_DESCRIPTION +## Solve equality with sum of absolute values +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Absolute value expressions and functions) +## DBsection(Solving equations with absolute values) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Date(October 2022) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + + +DOCUMENT(); + +loadMacros( +"PGstandard.pl", +"PGcourse.pl", +"MathObjects.pl", +"contextFraction.pl" +); + +TEXT(beginproblem()); + +COMMENT('random slopes could make answers ugly...'); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +} + +Context("Fraction"); + + +do { + @a = map { non_zero_random(-4,4); } (0,1); + @m = map { random(1,3) } @a; +} until ($a[0]*$m[1] != $a[1]*$m[0]); + +if ($a[0]*$m[1] > $a[1]*$m[0]) { @a = @a[1,0]; @m = @m[1,0]} + +@crit = (abs($m[1]*$a[0]/$m[0] - $a[1]), abs($m[0]*$a[1]/$m[1] - $a[0])); +@crits = PGsort(sub {$_[0] < $_[1]}, @crit); + +do { $b = random(ceil($crits[0])+1,ceil($crits[1])+4); } +until ($b != $crits[1]); + +@x = (); + +if ($b > $crit[0]) { + push(@x, ( + Fraction($a[0]+$a[1]-$b, + $m[0]+$m[1])->reduce + )); +} +if ($b == (PGsort(sub {$_[0] < $_[1]}, ($b,$crit[0],$crit[1])))[1]) { + push(@x, ( + Fraction(-$a[0]+$a[1]-$b, + -$m[0]+$m[1])->reduce + )); +} +if ($b > $crit[1]) { + push(@x, ( + Fraction($a[0]+$a[1]+$b, + $m[0]+$m[1])->reduce + )); +} + +$ans = List(@x); + +# if (random(0,1)==1) {@a=@a[1,0]; @m=@m[1,0];} + +$f = Formula("abs($m[0] x - $a[0]) + abs($m[1] x - $a[1])")->reduce; + +Context()->texStrings; +BEGIN_TEXT + +Solve the following equation. +\[ \displaystyle $f = $b\] +$PAR +\(x= \) \{ $ans->ans_rule(10) \} + + +END_TEXT +Context()->normalStrings; + +ANS( $ans->cmp() ); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.3_Abs_value2.pg b/Contrib/METU-NCC/MAT100/Ch1/1.3_Abs_value2.pg index 0e049ee72d..d9c97afc69 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.3_Abs_value2.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.3_Abs_value2.pg @@ -42,8 +42,8 @@ do { $B = random(1,7); } until (($B!=$A) && ($B!=$C)); -$expr[0] = "$A\," . Formula("|x-$B|-x")->reduce->TeX . - "\ =\ $C\, |x|"; +$expr[0] = Formula("$A abs(x-$B)-x")->reduce->TeX . + "\ =\ " . Formula("$C abs(x)")->TeX; my @end = (Fraction($A*$B,($A+1)-$C), Fraction($A*$B,$A+$C+1)); @@ -58,8 +58,8 @@ Context()->noreduce('(-x)-y','(-x)+y'); my $i = random(0,3); -$expr[1] = "$A\," . Formula("|x-$B|-x")->reduce->TeX . - ("\ \le\ ","\ <\ ","\ \ge\ ","\ >\ ")[$i] . "$C\, |x|"; +$expr[1] = Formula("$A abs(x-$B)-x")->reduce->TeX . + ("\ \le\ ","\ <\ ","\ \ge\ ","\ >\ ")[$i] . Formula("$C abs(x)")->TeX; $ans[1] = (Inequality("(-inf,$end[0]] U [$end[1],inf)"), diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_div.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_div.pg index 2e4018d526..276bb39013 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_div.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_div.pg @@ -8,10 +8,9 @@ ## DBsection(Conversion to a + bi form) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### @@ -33,6 +32,7 @@ sub pick { TEXT(beginproblem()); +COMMENT("Uses LimitedComplex"); Context("Complex"); my $n = random(2010,2029); diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_mult.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_mult.pg index cfe2fdcc72..e6248a0da2 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_mult.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_mult.pg @@ -8,10 +8,9 @@ ## DBsection(Multiplication) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### @@ -69,6 +68,9 @@ $BBOLD ($index[1]) $EBOLD $BR \(\qquad P($z) = \) \{ans_rule(10);\} +$PAR +(Hint: This is easier if you use the answer from part $BBOLD(A)$EBOLD) + END_TEXT diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-div.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-div.pg new file mode 100644 index 0000000000..57463b3804 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-div.pg @@ -0,0 +1,128 @@ +## BEGIN_DESCRIPTION +## 5x complex division problems +## END_DESCRIPTION +## +############################################## +## DBsubject(Complex analysis) +## DBchapter(Arithmetic) +## DBsection(Division) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextLimitedComplex.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("Current setup picks 5 out of 266 possible distinct division problems using complex numbers with distinct real and imaginary parts less than 5."); + +Context("Complex"); + +my $number_of_problems = 5; + +# basic numbers to work with + +my @z = (Complex(1,2), + Complex(1,3), + Complex(1,4), + Complex(2,3) +); + +# generate new numbers by +# swapping real and imaginary parts +# changing sign on real or imaginary parts +# +# total possible numbers is @z * 6 +# consecutive pairs of numbers will give problem +# +# (this way we ensure problems are simple and unique) +# +my @num = pick($number_of_problems*2,(0..(@z*6-1))); + +my @cx_num = map { @z[$_%@z] } @num; + +for($i=0;$i<@num;$i++) { + if ($num[$i] >= 3*@z) { $cx_num[$i] = Complex(Im($cx_num[$i]),Re($cx_num[$i])); } + + $num[$i] = (($num[$i] - ($num[$i]%@z))/@z) %3; + if ($num[$i] == 1) { $cx_num[$i] = conj($cx_num[$i]); } + if ($num[$i] == 2) { $cx_num[$i] = -conj($cx_num[$i]); } +} + +for ($i=0;$i<@num/2;$i++) { + $question[$i] = "\frac{" . $cx_num[2*$i]->TeX . "}{" . $cx_num[2*$i+1]->TeX . "}"; + $ans[$i] = $cx_num[2*$i] / $cx_num[2*$i+1]; +} + + +# impliment poor man's alignment? +@align = ("","\phantom{-}","\phantom{-}\phantom{-}"); +for ($i=0;$i<@num/2;$i++) { + $question[$i] = $align[((Re($cx_num[2*$i])>0)&&(Re($cx_num[2*$i+1])>0)) ? 1 : 0] + . $question[$i]; +} +for ($i=0;$i<@num/2;$i++) { + if (((abs(Im($cx_num[2*$i]))==1)&&(abs(Im($cx_num[2*$i+1]))==1)) || + ((abs(Im($cx_num[2*$i] ))==1)&&(Re($cx_num[2*$i] )<0)&&(Re($cx_num[2*$i+1])>0)) || + ((abs(Im($cx_num[2*$i+1]))==1)&&(Re($cx_num[2*$i+1])<0)&&(Re($cx_num[2*$i ])>0))) + { $question[$i] = "\phantom{2}" . $question[$i]; } +} + + +Context("LimitedComplex"); + +@ans = map { Compute($_) } @ans; + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT +Compute the following complex quotients: +$PAR + +END_TEXT +for($i=0;$i<=$#ans;$i++){ +BEGIN_TEXT + +$BBOLD ($index[$i]) $EBOLD +\(\displaystyle \quad $question[$i]= \) \{ans_rule(10);\} + +$PAR + +END_TEXT +} + +BEGIN_TEXT +You answers must be simplified to the form \(a+bi\). No \(i\) allowed in denominators! +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-pow.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-pow.pg new file mode 100644 index 0000000000..7142600dd8 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-pow.pg @@ -0,0 +1,123 @@ +## BEGIN_DESCRIPTION +## 5x complex powers problems +## END_DESCRIPTION +## +############################################## +## DBsubject(Complex analysis) +## DBchapter(Arithmetic) +## DBsection(Multiplication) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextLimitedComplex.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); +COMMENT("Current setup picks 5 out of 24 possible complex numbers with distinct real and imaginary parts less than 5. Final two are cubed."); + +Context("Complex"); + +my $number_of_problems = 5; + +# basic numbers to work with + +my @z = (Complex(1,2), + Complex(1,3), + Complex(1,4), + Complex(2,3) +); + +# generate new numbers by +# swapping real and imaginary parts +# changing sign on real or imaginary parts +# +# total possible numbers is @z * 6 +# +# (this way we ensure problems are simple and unique) +# +my @num = pick($number_of_problems,(0..(@z*6-1))); + +my @cx_num = map { @z[$_%@z] } @num; + +# all powers are squares except for final two, which are cubes +# this could be modified to random powers, instead.... +my @pow = (2)x@cx_num; @pow[$#pow]=3; @pow[$#pow-1]=3; + +for($i=0;$i<@num;$i++) { + if ($num[$i] >= 3*@z) { $cx_num[$i] = Complex(Im($cx_num[$i]),Re($cx_num[$i])); } + + $num[$i] = (($num[$i] - ($num[$i]%@z))/@z) %3; + if ($num[$i] == 1) { $cx_num[$i] = conj($cx_num[$i]); } + if ($num[$i] == 2) { $cx_num[$i] = -conj($cx_num[$i]); } +} + +for ($i=0;$i<@num;$i++) { + $question[$i] = "(" . $cx_num[$i]->TeX . ")^$pow[$i]"; + $ans[$i] = ($cx_num[$i])**$pow[$i]; +} + + +# impliment poor man's alignment? +@align = ("","\phantom{-}","\phantom{-}\phantom{-}"); +for ($i=0;$i<@num;$i++) { + $question[$i] = $align[((Re($cx_num[$i])>0) ? 1 : 0)] . $question[$i]; +} +@align = ("","\phantom{2}","\phantom{2}\phantom{2}"); +for ($i=0;$i<@num;$i++) { + $question[$i] = $align[((abs(Im($cx_num[$i]))==1) ? 1 : 0)] . $question[$i]; +} + + +Context("LimitedComplex"); + +@ans = map { Compute($_) } @ans; + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT +Compute the following complex squares and cubes: +$PAR + +END_TEXT +for($i=0;$i<=$#ans;$i++){ +BEGIN_TEXT + +$BBOLD ($index[$i]) $EBOLD +\(\quad $question[$i]= \) \{ans_rule(10);\} + +$PAR + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-prod.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-prod.pg new file mode 100644 index 0000000000..2b94d45b03 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-prod.pg @@ -0,0 +1,122 @@ +## BEGIN_DESCRIPTION +## 5x complex multiplication problems +## END_DESCRIPTION +## +############################################## +## DBsubject(Complex analysis) +## DBchapter(Arithmetic) +## DBsection(Multiplication) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextLimitedComplex.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); +COMMENT("Current setup picks 5 out of 266 possible distinct multiplication problems using complex numbers with distinct real and imaginary parts less than 5."); + +Context("Complex"); + +my $number_of_problems = 5; + +# basic numbers to work with + +my @z = (Complex(1,2), + Complex(1,3), + Complex(1,4), + Complex(2,3) +); + +# generate new numbers by +# swapping real and imaginary parts +# changing sign on real or imaginary parts +# +# total possible numbers is @z * 6 +# consecutive pairs of numbers will give problem +# +# (this way we ensure problems are simple and unique) +# +my @num = pick($number_of_problems*2,(0..(@z*6-1))); + +my @cx_num = map { @z[$_%@z] } @num; + +for($i=0;$i<@num;$i++) { + if ($num[$i] >= 3*@z) { $cx_num[$i] = Complex(Im($cx_num[$i]),Re($cx_num[$i])); } + + $num[$i] = (($num[$i] - ($num[$i]%@z))/@z) %3; + if ($num[$i] == 1) { $cx_num[$i] = conj($cx_num[$i]); } + if ($num[$i] == 2) { $cx_num[$i] = -conj($cx_num[$i]); } +} + +for ($i=0;$i<@num/2;$i++) { + $question[$i] = "(" . $cx_num[2*$i]->TeX . ")\,(" . $cx_num[2*$i+1]->TeX . ")"; + $ans[$i] = $cx_num[2*$i] * $cx_num[2*$i+1]; +} + + +# impliment poor man's alignment? +@align = ("","\phantom{-}","\phantom{-}\phantom{-}"); +for ($i=0;$i<@num/2;$i++) { + $question[$i] = $align[((Re($cx_num[2*$i])>0) ? 1 : 0) + + ((Re($cx_num[2*$i+1])>0) ? 1 : 0)] . $question[$i]; +} +@align = ("","\phantom{2}","\phantom{2}\phantom{2}"); +for ($i=0;$i<@num/2;$i++) { + $question[$i] = $align[((abs(Im($cx_num[2*$i]))==1) ? 1 : 0) + + ((abs(Im($cx_num[2*$i+1]))==1) ? 1 : 0)] . $question[$i]; +} + + +Context("LimitedComplex"); + +@ans = map { Compute($_) } @ans; + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT +Compute the following complex products: +$PAR + +END_TEXT +for($i=0;$i<=$#ans;$i++){ +BEGIN_TEXT + +$BBOLD ($index[$i]) $EBOLD +\(\quad $question[$i]= \) \{ans_rule(10);\} + +$PAR + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-sum.pg b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-sum.pg new file mode 100644 index 0000000000..4462e50ef9 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.4_C_multi-sum.pg @@ -0,0 +1,125 @@ +## BEGIN_DESCRIPTION +## 5x complex addition/subtraction problems +## END_DESCRIPTION +## +############################################## +## DBsubject(Complex analysis) +## DBchapter(Arithmetic) +## DBsection(Addition/subtraction) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextLimitedComplex.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); +COMMENT("Current setup picks 5 out of 266 possible distinct sum/diff problems using complex numbers with distinct real and imaginary parts less than 5."); + +Context("Complex"); + +my $number_of_problems = 5; + +# basic numbers to work with + +my @z = (Complex(1,2), + Complex(1,3), + Complex(1,4), + Complex(2,3) +); + +# generate new numbers by +# swapping real and imaginary parts +# changing sign on real or imaginary parts +# +# total possible numbers is @z * 6 +# consecutive pairs of numbers will give problem +# +# (this way we ensure problems are simple and unique) +# +my @num = pick($number_of_problems*2,(0..(@z*6-1))); + +my @cx_num = map { @z[$_%@z] } @num; + +for($i=0;$i<@num;$i++) { + if ($num[$i] >= 3*@z) { $cx_num[$i] = Complex(Im($cx_num[$i]),Re($cx_num[$i])); } + + $num[$i] = (($num[$i] - ($num[$i]%@z))/@z) %3; + if ($num[$i] == 1) { $cx_num[$i] = conj($cx_num[$i]); } + if ($num[$i] == 2) { $cx_num[$i] = -conj($cx_num[$i]); } +} + +@sign = ("+")x(@num/2); +@sign[(pick(ceil(@num/4),(0..(@num/2))))] = ("-")x(ceil(@num/4)); + +for ($i=0;$i<@num/2;$i++) { + $question[$i] = "(" . $cx_num[2*$i]->TeX . ") $sign[$i] (" . $cx_num[2*$i+1]->TeX . ")"; + $ans[$i] = Compute("$cx_num[2*$i] $sign[$i] $cx_num[2*$i+1]"); +} + + +# impliment poor man's alignment? +@align = ("","\phantom{-}","\phantom{-}\phantom{-}"); +for ($i=0;$i<@num/2;$i++) { + $question[$i] = $align[((Re($cx_num[2*$i])>0) ? 1 : 0) + + ((Re($cx_num[2*$i+1])>0) ? 1 : 0)] . $question[$i]; +} +@align = ("","\phantom{2}","\phantom{2}\phantom{2}"); +for ($i=0;$i<@num/2;$i++) { + $question[$i] = $align[((abs(Im($cx_num[2*$i]))==1) ? 1 : 0) + + ((abs(Im($cx_num[2*$i+1]))==1) ? 1 : 0)] . $question[$i]; +} + + +Context("LimitedComplex"); + +@ans = map { Compute($_) } @ans; + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT +Compute the following complex sums or differences: +$PAR + +END_TEXT +for($i=0;$i<=$#ans;$i++){ +BEGIN_TEXT + +$BBOLD ($index[$i]) $EBOLD +\(\quad $question[$i]= \) \{ans_rule(10);\} + +$PAR + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula1.pg b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula1.pg new file mode 100644 index 0000000000..e41dd51c47 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula1.pg @@ -0,0 +1,88 @@ +## BEGIN_DESCRIPTION +## Quadratic formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Quadratic formula) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("Equation is x^2 + 2bx + c; does not factor in Z"); + +Context("Numeric"); +Context()->noreduce('(-x)-y','(-x)+y'); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +# generate coefficients for quadratic x^2 + 2bx + c that +# does NOT factor in Z ($d is discriminant) +do { + ($b,$c) = (non_zero_random(-6,6),non_zero_random(-8,8)); + $d = ($b)**2-$c; $d = ($d < 1) ? 1 : sqrt($d); +} while ($d==int($d)) ; + +$expr[0] = Formula("x^2 + 2*$b x + $c")->reduce; + +$ans[0] = Formula("-$b"); +$ans[1] = Formula("2 sqrt(($b)^2-$c)"); + +Context()->texStrings; + +BEGIN_TEXT +The following questions are about the solutions to +\[ $expr[0] = 0 \] +$PAR + +$BBOLD ($index[0]) $EBOLD + What is the $BBOLD average value $EBOLD of the solutions? +$BR + \(\quad \text{average value} = \) \{ans_rule(10);\} + + +$PAR +$BBOLD ($index[1]) $EBOLD + What is the $BBOLD distance between $EBOLD the solutions? +$BR +\(\quad \text{distance} = \) \{ans_rule(10);\} + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +map {ANS($_->cmp())} @ans; + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula2.pg b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula2.pg new file mode 100644 index 0000000000..f2a73176cf --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula2.pg @@ -0,0 +1,66 @@ +## BEGIN_DESCRIPTION +## Quadratic formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Quadratic formula) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +TEXT(beginproblem()); + +COMMENT("Either x coeff or const is a variable."); + +Context("Numeric"); +Context()->variables->add(b=>"Real",c=>"Real"); + +($b,$c) = (non_zero_random(-5,5),non_zero_random(-9,9)); + +$expr[0] = Formula("x^2 + 2*$b x + c")->reduce; +$expr[1] = Formula("x^2 + 2*b x + $c")->reduce; + +@ans = ([Formula("-$b + sqrt(($b)^2 - c)")->reduce, + Formula("-$b - sqrt(($b)^2 - c)")->reduce], + [Formula("- b + sqrt(( b)^2 -$c)")->reduce, + Formula("- b - sqrt(( b)^2 -$c)")->reduce]); + +@word = ("larger","smaller"); + +($i,$j) = (random(0,1),random(0,1)); + +Context()->texStrings; + +BEGIN_TEXT + +Find the $BBOLD $word[$j] $EBOLD of the two solutions to +\[$expr[$i] = 0\] +$PAR +\(\quad x = \) \{ans_rule(10);\} + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS($ans[$i][$j]->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula3.pg b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula3.pg new file mode 100644 index 0000000000..772f99557c --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.5_Quad_formula3.pg @@ -0,0 +1,76 @@ +## BEGIN_DESCRIPTION +## Quadratic formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Quadratic formula) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +TEXT(beginproblem()); + +COMMENT("one coeff is number, others involve an unknonwn (only 6 possible questions)"); + +Context("Numeric"); +Context()->variables->add( + a=>["Real",limits=>[.01,5]], + b=>["Real",limits=>[.01,5]] +); + +@expr = (Formula("x^2 + 2b x - b**2"), + Formula("a x^2 + 2a x - 1"), + Formula("a x^2 + 2x - a") +); + +@ans = ([Formula(" b (-1 + sqrt(2))")->reduce, + Formula(" b (-1 - sqrt(2))")->reduce], + [Formula("-1 + sqrt(1 + 1/a)")->reduce, + Formula("-1 - sqrt(1 + 1/a)")->reduce], + [Formula("1/a*(-1 + sqrt(1+a^2))")->reduce, + Formula("1/a*(-1 - sqrt(1+a^2))")->reduce] +); + +@word = ("larger","smaller"); +@letter = ("b","a","a"); + +($i,$j) = (random(0,2),random(0,1)); + +Context()->texStrings; + +BEGIN_TEXT + +Find the $BBOLD $word[$j] $EBOLD (assuming \($letter[$i] > 0\)) +of the two solutions to +\[$expr[$i] = 0\] +$PAR +\(\quad x = \) \{ans_rule(10);\} +$BR + + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS($ans[$i][$j]->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple1.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple1.pg new file mode 100644 index 0000000000..9bdb9e13eb --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple1.pg @@ -0,0 +1,81 @@ +## BEGIN_DESCRIPTION +## Quadratic substitution +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Solve by factoring) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("One negative solution in (A), so only one solution to (B)"); + +Context("Numeric"); +Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add(u => "Real"); + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +($a,$b) = pick(2,(1..9)); $b = -$b; + +$expr[0] = Formula("u^2 - ($a+$b) u + ($a*$b)")->reduce; +$expr[1] = Formula("x - ($a+$b)sqrt(x) + ($a*$b)")->reduce; + +$ans[0] = List($a,$b); +$ans[1] = List($a**2); + +Context()->texStrings; + +BEGIN_TEXT +Solve the following linked problems. +$PAR + +$BBOLD ($index[0]) $EBOLD + Solve \(\displaystyle\ $expr[0]=0\) +$BR +\(\qquad u = \) \{ans_rule(5);\} + + +$PAR +$BBOLD ($index[1]) $EBOLD + Solve \(\displaystyle\ $expr[1]=0\) +$BR +\(\qquad x = \) \{ans_rule(10);\} + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +map {ANS($_->cmp())} @ans; + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple2.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple2.pg new file mode 100644 index 0000000000..0e614d67ff --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple2.pg @@ -0,0 +1,81 @@ +## BEGIN_DESCRIPTION +## Quadratic substitution +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Solve by factoring) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("One negative solution in (A), so only two solutions to (B)"); + +Context("Numeric"); +Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add(u => "Real"); + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +($a,$b) = pick(2,(1..9)); $b = -$b; + +$expr[0] = Formula("u^2 - ($a+$b) u + ($a*$b)")->reduce; +$expr[1] = Formula("x^4 - ($a+$b) x^2 + ($a*$b)")->reduce; + +$ans[0] = List($a,$b); +$ans[1] = List(-sqrt($a),sqrt($a)); + +Context()->texStrings; + +BEGIN_TEXT +Find all real solutions to the following linked problems. +$PAR + +$BBOLD ($index[0]) $EBOLD + Solve \(\displaystyle\ $expr[0]=0\) +$BR +\(\qquad u = \) \{ans_rule(5);\} + + +$PAR +$BBOLD ($index[1]) $EBOLD + Solve \(\displaystyle\ $expr[1]=0\) +$BR +\(\qquad x = \) \{ans_rule(10);\} + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +map {ANS($_->cmp())} @ans; + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple3.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple3.pg new file mode 100644 index 0000000000..9a0bc12cf3 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_simple3.pg @@ -0,0 +1,89 @@ +## BEGIN_DESCRIPTION +## Quadratic substitution +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Quadratic equations and functions) +## DBsection(Solve by factoring) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("One negative solution in (A), so only two solutions to (B)"); + +Context("Numeric"); +Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add( + u => "Real", + x43 => ["Real",TeX=>"x^{4/3}"], + x23 => ["Real",TeX=>"x^{2/3}"] +); + + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +($a,$b) = pick(2,(1..9)); ($a,$b)=($b,$a) if ($a==1); $b = -$b; + +$expr[0] = Formula("u^2 - ($a+$b) u + ($a*$b)")->reduce; +$expr[1] = Formula("x43 - ($a+$b) x23 + ($a*$b)")->reduce; + +Context()->flags->set( + reduceConstantFunctions => 0, +); + +$ans[0] = List($a,$b); +$ans[1] = List(Formula("-sqrt($a**3)"),Formula("sqrt($a**3)")); + +Context()->texStrings; + +BEGIN_TEXT +Find all real solutions to the following linked problems. +$PAR + +$BBOLD ($index[0]) $EBOLD + Solve \(\displaystyle\ $expr[0]=0\) +$BR +\(\qquad u = \) \{ans_rule(5);\} + + +$PAR +$BBOLD ($index[1]) $EBOLD + Solve \(\displaystyle\ $expr[1]=0\) +$BR +\(\qquad x = \) \{ans_rule(10);\} + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +map {ANS($_->cmp())} @ans; + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst1.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst1.pg index e607a2cc20..315448607f 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst1.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst1.pg @@ -35,7 +35,7 @@ COMMENT("Four real solutions"); Context("Numeric"); Context()->noreduce('(-x)-y','(-x)+y'); - +Context()->variables->add(u => "Real"); # This is a problem of type u^2 + B u + C = 0 # where u = (x^2 + b x + c) @@ -58,7 +58,7 @@ my $u = Formula("x^2 - ($a+$b)x + $E")->reduce; # # displaying (u)^2 + b(u) + c with parenthesis is tricky # -$expr[0] = Formula("x^2 - ($A+$B)x + $A*$B")->reduce->TeX . "=0"; +$expr[0] = Formula("u^2 - ($A+$B)u + $A*$B")->reduce->TeX . "=0"; $expr[1] = Formula("($u)^2")->reduce->TeX . ( ($A+$B > 0) ? "-" : "+" ) . ( (abs($A+$B)==1) ? "" : abs($A+$B) ) . @@ -79,7 +79,7 @@ $PAR $BBOLD ($index[0]) $EBOLD Solve \(\displaystyle\ $expr[0]\) $BR -\(\qquad x = \) \{ans_rule(5);\} +\(\qquad u = \) \{ans_rule(5);\} $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst2.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst2.pg index 3a1bfb3ef9..d32770e24e 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst2.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst2.pg @@ -35,6 +35,8 @@ COMMENT("Only two real solutions"); Context("Numeric"); Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add(u => "Real"); + # This is a problem of type u^2 + B u + C = 0 # where u = (x^2 + b x + c) only 2 real roots @@ -54,7 +56,7 @@ do { my $u = Formula("x^2 - ($a+$b)x + $E")->reduce; -$expr[0] = Formula("x^2 - ($A+$B)x + $A*$B")->reduce->TeX . "=0"; +$expr[0] = Formula("u^2 - ($A+$B)u + $A*$B")->reduce->TeX . "=0"; $expr[1] = Formula("($u)^2")->reduce->TeX . ( ($A+$B > 0) ? "-" : "+" ) . ( (abs($A+$B)==1) ? "" : abs($A+$B) ) . @@ -69,13 +71,13 @@ $ans[1] = List($a,$b); Context()->texStrings; BEGIN_TEXT -Solve the following linked problems. +Find all real solutions to the following linked problems. $PAR $BBOLD ($index[0]) $EBOLD Solve \(\displaystyle\ $expr[0]\) $BR -\(\qquad x = \) \{ans_rule(5);\} +\(\qquad u = \) \{ans_rule(5);\} $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst3.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst3.pg index 58ff291433..273b617b37 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst3.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst3.pg @@ -35,6 +35,8 @@ COMMENT("Only two real solutions"); Context("Numeric"); Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add(u => "Real"); + # This is a problem of type u^2 + B u + C = 0 # where u = sqrt(x^2 + b x + c) only 2 real roots @@ -44,7 +46,7 @@ my ($A,$B) = pick(2,(-6..-1,1..6)); # these will be solns my $u = Formula("x^2 - ($A+$B)x + ($A*$B + $a**2)")->reduce; -$expr[0] = Formula("x^2 - ($a+$b)x + $a*$b")->reduce->TeX . "=0"; +$expr[0] = Formula("u^2 - ($a+$b)u + $a*$b")->reduce->TeX . "=0"; $expr[1] = "(" . $u->TeX . ( ($a+$b>0) ? ")" : ")+" ) . Formula("-($a+$b)sqrt($u) + $a*$b")->reduce->TeX . "=0"; @@ -63,7 +65,7 @@ $PAR $BBOLD ($index[0]) $EBOLD Solve \(\displaystyle\ $expr[0]\) $BR -\(\qquad x = \) \{ans_rule(5);\} +\(\qquad u = \) \{ans_rule(5);\} $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst4.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst4.pg index 3783d808cf..b33d590c7f 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst4.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Quad_subst4.pg @@ -35,6 +35,8 @@ COMMENT("Only one real solution"); Context("Numeric"); Context()->noreduce('(-x)-y','(-x)+y'); +Context()->variables->add(u => "Real"); + # This is a problem of type u^2 + B u + C = 0 # where u = sqrt(x) + A @@ -45,9 +47,9 @@ if ($b-$a==1) { $b=$b+1; } # ensure that there is an integer between a&b my $A = non_zero_random($a+1,$b-1); my $B = $a+$b; my $C = $a*$b; -$expr[0] = Formula("x^2 - $B x + $C")->reduce->TeX . "=0"; +$expr[0] = Formula("u^2 - $B u + $C")->reduce->TeX . "=0"; $expr[1] = Formula("(sqrt(x)+$A)^2")->reduce->TeX . - (($B<0) ? "+" : "-") . abs($B) . "(" . + (($B<0) ? "+" : "-") . ((abs($B)==1) ? "" : abs($B)) . "(" . Formula("sqrt(x)+$A")->reduce->TeX . ")" . (($C<0) ? "-" : "+") . abs($C) . "=0"; @@ -65,7 +67,7 @@ $PAR $BBOLD ($index[0]) $EBOLD Solve \(\displaystyle\ $expr[0] \) $BR -\(\qquad x = \) \{ans_rule(5);\} +\(\qquad u = \) \{ans_rule(5);\} $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch1/1.6_Rad_subst1.pg b/Contrib/METU-NCC/MAT100/Ch1/1.6_Rad_subst1.pg index 62c03d68c3..563ffd4e52 100644 --- a/Contrib/METU-NCC/MAT100/Ch1/1.6_Rad_subst1.pg +++ b/Contrib/METU-NCC/MAT100/Ch1/1.6_Rad_subst1.pg @@ -33,7 +33,7 @@ sub pick { TEXT(beginproblem()); Context("Numeric"); -Context()->variables->are(x=>"Real",y=>"Real"); +Context()->variables->are(x=>"Real",y=>"Real",u=>"Real"); Context()->noreduce('(-x)-y','(-x)+y'); START: @@ -49,7 +49,7 @@ my $A = $a*$b - ($B)**2; if ($a-$B < 0) { goto START; } # ensure that $a is a solution -$eqn1 = "x = " . Formula("sqrt(x-$A) + $B")->reduce->TeX; +$eqn1 = "u = " . Formula("sqrt(u-$A) + $B")->reduce->TeX; $eqn2 = "\sqrt{x} = " .Formula("sqrt(sqrt(x)-$A)+$B")->reduce->TeX; @@ -71,7 +71,7 @@ $PAR $BBOLD ($index[0]) $EBOLD Find all real solutions to the equation \( $eqn1 \) $BR -\(\qquad x=\) \{ans_rule(10);\} +\(\qquad u=\) \{ans_rule(10);\} $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts-v2.pg b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts-v2.pg new file mode 100644 index 0000000000..950e326fcd --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts-v2.pg @@ -0,0 +1,105 @@ +## BEGIN_DESCRIPTION +## Circle through three points (0,0) (A,0) (0,B) +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Linear equations and functions) +## DBsection() +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "parserImplicitEquation.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +Context("ImplicitEquation"); +# webwork.maa.org example suggests blanking these error messages ??? +Context()->{error}{msg}{"Can't find any solutions to your equation"} = " "; +Context()->{error}{msg}{"Can't generate enough valid points for comparison"} = " "; + +my ($A,$B,$C) = map { $_ * random(-2,2,4) } pick(3,(1..5)); + +my $a = $A/2; +my $b = (($C)**2 + ($B)**2 - $A*$B)/(2*$C); + +# $b is usually an integer... so why not ensure it? +while ($b != ceil($b)) { + ($A,$B,$C) = map { $_ * random(-2,2,4) } pick(3,(1..5)); + + $a = $A/2; + $b = (($C)**2 + ($B)**2 - $A*$B)/(2*$C); +} + +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + + + +if (random(0,1)==0) { + $P = Point($A,0); $Q = Point($B,$C); + + $ans[0] = Point($a,$b); +} else { + $P = Point(0,$A); $Q = Point($C,$B); + + $ans[0] = Point($b,$a); +} + +($a,$b) = (abs($a),abs($b)); + +$ans[1] = Formula("sqrt($a**2 + $b**2)"); +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT + +Find the center and radius of the circle passing through the points +\((0,0)\), \($P\), \($Q\). + +$PAR + +Center: \{ ans_rule(25) \} $BR +Radius: \{ ans_rule(10) \} + +$PAR + +Hint: Use the standard form of the circle equation $BR +\(x^2 + y^2 + Ax + By = C\) + +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts.pg b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts.pg index 486e77ea5c..0f79d03a51 100644 --- a/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts.pg +++ b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_3pts.pg @@ -84,6 +84,10 @@ $PAR \{ ans_rule(25) \} +$PAR + +Hint: Use the standard form of the circle equation $BR +\(x^2 + y^2 + Ax + By = C\) END_TEXT diff --git a/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_Rad.pg b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_Rad.pg new file mode 100644 index 0000000000..5450c1615f --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch2/2.2_Circle_Rad.pg @@ -0,0 +1,79 @@ +## BEGIN_DESCRIPTION +## Find coefficient in standard form for given radius +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Cartesian coordinate system) +## DBsection(Circles) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); +Context("Numeric"); +Context()->variables->add(A=>'Real',y=>'Real'); +Context()->flags->set(reduceConstantFunctions=>0); +Context()->noreduce('(-x)-y','(-x)+y'); + +@c = pick(3,(1..5)); # center and radius + +$r = $c[2]; $c[2] = ($c[2])**2 - ($c[0])**2 - ($c[1])**2; + +@c[(0,1)] = map { $_*2*random(-1,1) } @c[(0,1)]; + +my $i = random(0,1); + +$ans[0] = List(Real($c[$i]), Real(-$c[$i])); +$c[$i] = Formula("A"); + +$circle = Formula("x^2 + y^2 + $c[0] x + $c[1] y")->reduce->TeX . " = $c[2]"; + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; + +BEGIN_TEXT + Find all values of \(A\) so that the circle \( $circle \) has radius \($r\). + +$BR +\(\qquad A=\) \{ans_rule(25);\} + + + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + +#ANS( essay_cmp() ); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_paral-v2.pg b/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_paral-v2.pg new file mode 100644 index 0000000000..e11221d347 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_paral-v2.pg @@ -0,0 +1,76 @@ +## BEGIN_DESCRIPTION +## Linked questions -- line equation and intercepts +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Linear equations and functions) +## DBsection(Equations of lines: slope-intercept form) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextFraction.pl", + "parserImplicitPlane.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +Context("Fraction"); +Context()->variables->are(x=>"Real",y=>"Real"); + +($a,$b) = map {$_ * random(-1,1,2)} pick(2,1..5); + +my ($dx,$dy) = map {$_ * random(-1,1,2)} pick(2,1..5); +if (($dx<0)&&($dy<0)) {$dx = -$dx;} +my $m = Fraction($dy,$dx); +my $d = non_zero_random(-5,5); + +$parallel = Formula("$dy x - $dx y")->reduce->TeX . " = $d"; + +$ans[0] = Formula("$m (x-$a) + $b")->reduce; + +Context("ImplicitPlane"); +Context()->variables->are(x=>"Real",y=>"Real"); + +@ans = map { ImplicitPlane("y=$_") } @ans; + +Context()->texStrings; +BEGIN_TEXT +Write an equation of the line that passes through \(($a,$b)\) and is +parallel to the line \($parallel\). +$PAR +\(\qquad \) \{ans_rule(10);\} + + +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_perp-v2.pg b/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_perp-v2.pg new file mode 100644 index 0000000000..69e73289fc --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch2/2.3_Line_perp-v2.pg @@ -0,0 +1,76 @@ +## BEGIN_DESCRIPTION +## Linked questions -- line equation and intercepts +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Linear equations and functions) +## DBsection(Equations of lines: slope-intercept form) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextFraction.pl", + "parserImplicitPlane.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +Context("Fraction"); +Context()->variables->are(x=>"Real",y=>"Real"); + +($a,$b) = map {$_ * random(-1,1,2)} pick(2,1..5); + +my ($dx,$dy) = map {$_ * random(-1,1,2)} pick(2,1..5); +if (($dx<0)&&($dy<0)) { $dx = -$dx; } +my $m = Fraction($dy,$dx); +my $d = non_zero_random(-5,5); + +$perp = Formula("$dx x + $dy y")->reduce->TeX . " = $d"; + +$ans[0] = Formula("$m (x-$a) + $b")->reduce; + +Context("ImplicitPlane"); +Context()->variables->are(x=>"Real",y=>"Real"); + +@ans = map { ImplicitPlane("y=$_") } @ans; + +Context()->texStrings; +BEGIN_TEXT +Write an equation of the line that passes through \(($a,$b)\) and is +perpendicular to the line \($perp\). +$PAR +\(\qquad \) \{ans_rule(10);\} + + +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch3/3.3_Transf_Match.pg b/Contrib/METU-NCC/MAT100/Ch3/3.3_Transf_Match.pg index e45523a4d1..cf321d38a7 100644 --- a/Contrib/METU-NCC/MAT100/Ch3/3.3_Transf_Match.pg +++ b/Contrib/METU-NCC/MAT100/Ch3/3.3_Transf_Match.pg @@ -8,8 +8,6 @@ ## DBsection(Three or more transformations) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(0) -## Static(0) ## Level(2) ## Language(en) ############################################### @@ -20,7 +18,6 @@ DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", "parserPopUp.pl", - "PGcourse.pl" ); sub pick { diff --git a/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table1.pg b/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table1.pg index a2d7758eed..e539d4f209 100644 --- a/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table1.pg +++ b/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table1.pg @@ -19,10 +19,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "niceTables.pl", - "PGcourse.pl", +"PGstandard.pl", +"PGcourse.pl", +"MathObjects.pl", +"niceTables.pl", ); sub pick { diff --git a/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table2.pg b/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table2.pg index c7fca139db..aafb2dd8ad 100644 --- a/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table2.pg +++ b/Contrib/METU-NCC/MAT100/Ch3/3.5_Comp_Table2.pg @@ -19,10 +19,10 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", - "MathObjects.pl", - "niceTables.pl", - "PGcourse.pl", +"PGstandard.pl", +"PGcourse.pl", +"MathObjects.pl", +"niceTables.pl", ); sub pick { diff --git a/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad.pg b/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad.pg index 3f01076a0b..f24b1fba05 100644 --- a/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad.pg +++ b/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad.pg @@ -8,10 +8,9 @@ ## DBsection(Finding the inverse function) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### @@ -19,8 +18,8 @@ DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", - "MathObjects.pl", "PGcourse.pl", + "MathObjects.pl", ); sub pick { diff --git a/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad_Restricted.pg b/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad_Restricted.pg index 848a6994b7..3b5e7e822f 100644 --- a/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad_Restricted.pg +++ b/Contrib/METU-NCC/MAT100/Ch3/3.6_Inv_Quad_Restricted.pg @@ -8,10 +8,9 @@ ## DBsection(Finding the inverse function) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### @@ -19,9 +18,9 @@ DOCUMENT(); # This should be the first executable line in the problem. loadMacros( "PGstandard.pl", + "PGcourse.pl", "MathObjects.pl", "contextInequalities.pl", - "PGcourse.pl", ); sub pick { diff --git a/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_1.pg b/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_1.pg index 9eaf2c0fe4..53c4b5d069 100644 --- a/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_1.pg +++ b/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_1.pg @@ -8,10 +8,9 @@ ## DBsection(Zeros and multiplicities) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### diff --git a/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_2.pg b/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_2.pg index 8c34e6b440..5d55342968 100644 --- a/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_2.pg +++ b/Contrib/METU-NCC/MAT100/Ch4/4.1_Find_poly_2.pg @@ -8,10 +8,9 @@ ## DBsection(Zeros and multiplicities) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### diff --git a/Contrib/METU-NCC/MAT100/Ch4/4.3_Find_poly_C.pg b/Contrib/METU-NCC/MAT100/Ch4/4.3_Find_poly_C.pg index 2fd9778f96..4e663d969f 100644 --- a/Contrib/METU-NCC/MAT100/Ch4/4.3_Find_poly_C.pg +++ b/Contrib/METU-NCC/MAT100/Ch4/4.3_Find_poly_C.pg @@ -8,10 +8,9 @@ ## DBsection(Zeros and multiplicities) ## Institution(METU-NCC) ## Author(Benjamin Walter) -## MO(1) -## Static(0) ## Level(2) ## Language(en) +## MO(1) ############################################### diff --git a/Contrib/METU-NCC/MAT100/Ch5/5.5_Exp_Log_Eqns.pg b/Contrib/METU-NCC/MAT100/Ch5/5.5_Exp_Log_Eqns.pg index 01903d8839..6d87c5fcd3 100644 --- a/Contrib/METU-NCC/MAT100/Ch5/5.5_Exp_Log_Eqns.pg +++ b/Contrib/METU-NCC/MAT100/Ch5/5.5_Exp_Log_Eqns.pg @@ -91,6 +91,8 @@ $BBOLD ($index[0]) $EBOLD Solve \(\displaystyle\ $expr[0]\) $PAR \(\qquad x=\) \{ans_rule(20);\} +$PAR +$SPACE $SPACE $BITALIC (You may need to change base, writing your answer using \(\ln\), in order for webwork to compute correctly.)$EITALIC $PAR diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_1.pg new file mode 100644 index 0000000000..312d9c6503 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_1.pg @@ -0,0 +1,103 @@ +## BEGIN_DESCRIPTION +## Equivalent phase shifts +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Trigonometric functions) +## DBsection(Sine & cosine functions - definitions, graphs, & properties) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextFraction.pl", +); + +sub pick { + my ($k, @in) = @_; + return $in[random(0,$#in)] if ($k==1); + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +# Euclidean algorithm (from perlmonks.org) +sub reduce { + ($x,$y) = @_; + ($x,$y) = ($y%$x,$x) while $x; + map $_/$y,@_ +} + +TEXT(beginproblem()); + +COMMENT("equivalent phase shifts"); + + +Context("Fraction"); +Context()->variables->are(x=>"Real"); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + +my $b = random(5,7); +my $a = random(1,$b-1); +($a,$b) = reduce($a,$b); + +my $phi = Formula("$a pi/$b")->reduce; + +$expr = Formula("sin(x+$phi)"); + +@q = ( + " \sin\Bigl(x-", + " \cos\Bigl(x+", + "-\sin\Bigl(x+", + "-\cos\Bigl(x+", +); + +@ans = ( + Formula("2 pi - $phi")->reduce, + Formula("$phi - pi/2")->reduce, + Formula("$phi + pi")->reduce, + Formula("$phi + pi/2")->reduce, +); + +$ans[1] = Formula("$phi + 3 pi/2")->reduce if ($ans[1] < 0); + +@index = ("a","b","c","d","e","f","g"); + +Context()->texStrings; + +BEGIN_TEXT + +Fill in the angle between \(0\) and \(2\pi\) making expressions equal. + +END_TEXT +for($i=0;$i<=$#ans;$i++) { +BEGIN_TEXT + +$PAR +($index[$i]) \(\quad $expr = $q[$i]\) \{ans_rule(10);\} \(\Bigr)\) + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_2.pg b/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_2.pg new file mode 100644 index 0000000000..b21b965e61 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.2_Equiv_2.pg @@ -0,0 +1,103 @@ +## BEGIN_DESCRIPTION +## Equivalent phase shifts +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Trigonometric functions) +## DBsection(Sine & cosine functions - definitions, graphs, & properties) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextFraction.pl", +); + +sub pick { + my ($k, @in) = @_; + return $in[random(0,$#in)] if ($k==1); + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +# Euclidean algorithm (from perlmonks.org) +sub reduce { + ($x,$y) = @_; + ($x,$y) = ($y%$x,$x) while $x; + map $_/$y,@_ +} + +TEXT(beginproblem()); + +COMMENT("equivalent phase shifts"); + + +Context("Fraction"); +Context()->variables->are(x=>"Real"); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + +my $b = random(5,7); +my $a = random(1,$b-1); +($a,$b) = reduce($a,$b); + +my $phi = Formula("$a pi/$b")->reduce; + +$expr = Formula("cos(x+$phi)"); + +@q = ( + " \cos\Bigl(x-", + " \sin\Bigl(x+", + "-\cos\Bigl(x+", + "-\sin\Bigl(x+", +); + +@ans = ( + Formula("2 pi - $phi")->reduce, + Formula("$phi + pi/2")->reduce, + Formula("$phi + pi")->reduce, + Formula("$phi - pi/2")->reduce, +); + +$ans[3] = Formula("$phi + 3 pi/2")->reduce if ($ans[3] < 0); + +@index = ("a","b","c","d","e","f","g"); + +Context()->texStrings; + +BEGIN_TEXT + +Fill in the angle between \(0\) and \(2\pi\) making expressions equal. + +END_TEXT +for($i=0;$i<=$#ans;$i++) { +BEGIN_TEXT + +$PAR +($index[$i]) \(\quad $expr = $q[$i]\) \{ans_rule(10);\} \(\Bigr)\) + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.4_Mixed_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.4_Mixed_1.pg new file mode 100644 index 0000000000..8958dcf47e --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.4_Mixed_1.pg @@ -0,0 +1,127 @@ +## BEGIN_DESCRIPTION +## Product to Sum & Sum to Product Formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Product-to-sum & sum-to-product formulas) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("product-sum and sum-product formulas"); + + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); +# code below modified from +# /Library/LoyolaChicago/Precalc/Chap7Sec3/Connally3-7-3-01-Angle-sum-formulas.pg +Context()->functions->remove("sin","cos"); +package NewFunc; +# this next line makes the function a +# function from reals to reals +our @ISA = qw(Parser::Function::numeric); +sub sin { + shift; my $x = shift; + return $x - $x**3 / 6; +} +sub cos { + shift; my $x = shift; + return 1 - $x**2 / 2; +} +package main; +# Make it work on formulas as well as numbers +#sub sin {Parser::Function->call('sin',@_)} # if uncommented, this line will generate error messages +# Add the new functions to the Context +Context()->functions->add( + sin => {class => 'NewFunc', TeX => '\sin'}, + cos => {class => 'NewFunc', TeX => '\cos'} +); + +($a,$b) = pick(2,(1..9)); + + +@ans =( + Formula("2 sin(($a+$b)/2 x) cos(abs($a-$b)/2 x)"), + Formula("2 sin(($a-$b)/2 x) cos(abs($a+$b)/2 x)"), + Formula("2 cos(($a+$b)/2 x) cos(abs($a-$b)/2 x)"), + Formula("2 sin(($a+$b)/2 x) sin(($b-$a)/2 x)"), + Formula("1/2(sin(($a+$b) x) + sin(($a-$b) x))"), + Formula("1/2(sin(($a+$b) x) + sin(($b-$a) x))"), + Formula("1/2(cos(($a+$b) x) + cos(abs($a-$b) x))"), + Formula("1/2(cos(abs($a-$b) x) - cos(($a+$b) x))"), +); + +$a = "" if ($a==1); +$b = "" if ($b==1); + +@q = ( + Formula("sin($a x) + sin($b x)"), + Formula("sin($a x) - sin($b x)"), + Formula("cos($a x) + cos($b x)"), + Formula("cos($a x) - cos($b x)"), + Formula("sin($a x) cos($b x)"), + Formula("cos($a x) sin($b x)"), + Formula("cos($a x) cos($b x)"), + Formula("sin($a x) sin($b x)"), +); +my @p = (random(0,1),random(2,3)); + @p = (@p, map($_+4,@p)); + @p = pick(4,@p); + +@q = @q[@p]; +@ans = @ans[@p]; + +@index = ("a","b","c","d","e","f","g"); + +Context()->texStrings; + +BEGIN_TEXT + +Convert between products and sums. + +END_TEXT +for($i=0;$i<=$#ans;$i++) { +BEGIN_TEXT + +$PAR +($index[$i]) \(\quad $q[$i] = \) \{ans_rule(10);\} + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.4_Prod-Sum_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.4_Prod-Sum_1.pg new file mode 100644 index 0000000000..083e2bd52b --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.4_Prod-Sum_1.pg @@ -0,0 +1,115 @@ +## BEGIN_DESCRIPTION +## Product to Sum Formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Product-to-sum & sum-to-product formulas) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("product to sum formula"); + + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); +# code below modified from +# /Library/LoyolaChicago/Precalc/Chap7Sec3/Connally3-7-3-01-Angle-sum-formulas.pg +Context()->functions->remove("sin","cos"); +package NewFunc; +# this next line makes the function a +# function from reals to reals +our @ISA = qw(Parser::Function::numeric); +sub sin { + shift; my $x = shift; + return $x - $x**3 / 6; +} +sub cos { + shift; my $x = shift; + return 1 - $x**2 / 2; +} +package main; +# Make it work on formulas as well as numbers +#sub sin {Parser::Function->call('sin',@_)} # if uncommented, this line will generate error messages +# Add the new functions to the Context +Context()->functions->add( + sin => {class => 'NewFunc', TeX => '\sin'}, + cos => {class => 'NewFunc', TeX => '\cos'} +); + +($a,$b) = pick(2,(1..9)); + +my @sum = ( + Formula("1/2(sin(($a+$b) x) + sin(($a-$b) x))"), + Formula("1/2(sin(($a+$b) x) + sin(($b-$a) x))"), + Formula("1/2(cos(($a+$b) x) + cos(abs($a-$b) x))"), + Formula("1/2(cos(abs($a-$b) x) - cos(($a+$b) x))") +); +$a = "" if ($a==1); +$b = "" if ($b==1); +my @prod =( + Formula("sin($a x) cos($b x)"), + Formula("cos($a x) sin($b x)"), + Formula("cos($a x) cos($b x)"), + Formula("sin($a x) sin($b x)") +); + +my @p = pick(4,(0..3)); + +@q = @prod[@p]; +@ans = @sum[@p]; + +@index = ("a","b","c","d","e","f","g"); + +Context()->texStrings; + +BEGIN_TEXT + +Convert products to sums. + +END_TEXT +for($i=0;$i<=$#ans;$i++) { +BEGIN_TEXT + +$PAR +($index[$i]) \(\quad $q[$i] = \) \{ans_rule(10);\} + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.4_Sum-Prod_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.4_Sum-Prod_1.pg new file mode 100644 index 0000000000..8b2a5cc07c --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.4_Sum-Prod_1.pg @@ -0,0 +1,113 @@ +## BEGIN_DESCRIPTION +## Sum to Product Formula +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Product-to-sum & sum-to-product formulas) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("sum to product formula"); + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); +# code below modified from +# /Library/LoyolaChicago/Precalc/Chap7Sec3/Connally3-7-3-01-Angle-sum-formulas.pg +Context()->functions->remove("sin","cos"); +package NewFunc; +# this next line makes the function a +# function from reals to reals +our @ISA = qw(Parser::Function::numeric); +sub sin { + shift; my $x = shift; + return $x - $x**3 / 6; +} +sub cos { + shift; my $x = shift; + return 1 - $x**2 / 2; +} +package main; +# Make it work on formulas as well as numbers +#sub sin {Parser::Function->call('sin',@_)} # if uncommented, this line will generate error messages +# Add the new functions to the Context +Context()->functions->add( + sin => {class => 'NewFunc', TeX => '\sin'}, + cos => {class => 'NewFunc', TeX => '\cos'} +); + +($a,$b) = pick(2,(1..9)); + +my @prod =( + Formula("2 sin(($a+$b)/2 x) cos(abs($a-$b)/2 x)"), + Formula("2 sin(($a-$b)/2 x) cos(abs($a+$b)/2 x)"), + Formula("2 cos(($a+$b)/2 x) cos(abs($a-$b)/2 x)"), + Formula("2 sin(($a+$b)/2 x) sin(($b-$a)/2 x)") +); +$a = "" if ($a==1); +$b = "" if ($b==1); +my @sum = ( + Formula("sin($a x) + sin($b x)"), + Formula("sin($a x) - sin($b x)"), + Formula("cos($a x) + cos($b x)"), + Formula("cos($a x) - cos($b x)") +); +my @p = pick(4,(0..3)); + +@q = @sum[@p]; +@ans = @prod[@p]; + +@index = ("a","b","c","d","e","f","g"); + +Context()->texStrings; + +BEGIN_TEXT + +Convert sums to products. + +END_TEXT +for($i=0;$i<=$#ans;$i++) { +BEGIN_TEXT + +$PAR +($index[$i]) \(\quad $q[$i] = \) \{ans_rule(10);\} + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_Trig_combo.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_Trig_combo.pg index b88a267c39..1cbbd31201 100644 --- a/Contrib/METU-NCC/MAT100/Ch7/7.5_Trig_combo.pg +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_Trig_combo.pg @@ -41,7 +41,7 @@ Context()->noreduce('(-x)-y'); my @trig = ("\sin","\cos"); my $t = random(0,1); my @angle; -my ($i,$j) = (random(0,2),random(-1,1)); +my ($i,$j) = (random(0,2),random(-1,1,2)); $angle[0] = $j*(30,45,60)[$i]-180; $expr[0] = "$trig[$t]\bigl( $angle[0]^\circ \bigr)"; diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_1.pg new file mode 100644 index 0000000000..7aa7921c59 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_1.pg @@ -0,0 +1,80 @@ +## BEGIN_DESCRIPTION +## trig eqn with cos2x +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Solving trigonometric equations exactly) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + + +TEXT(beginproblem()); + +COMMENT("one of eight different problems, three solutions"); + +Context("Numeric"); +#Context()->constants->remove(pi); +Context()->variables->add(pi=>['Real',TeX=>"\pi"]); +#Context()->flags->set( +# reduceConstants => 0, +# reduceConstantFunctions => 0, +#); + +my ($a,$b)=(random(0,1),random(0,1)); + +$i = random(0,1); + +my ($c,$d) = ((-1)**($a)+2*(-1)**($b),(-1)**($a+$b)+1); + +if ($i==0) { + $f = Formula("cos(2x) + $c cos(x) + $d")->reduce; + $ans = List((Formula("2 pi/3"), Formula(" pi/3"))[$a], + (Formula("4 pi/3"), Formula("5 pi/3"))[$a], + (Formula("pi"), Formula("0"))[$b]); +} else { + $f = Formula("cos(2x) - $c sin(x) - $d")->reduce; + $ans = List((Formula(" 7 pi/6"), Formula(" pi/6"))[$a], + (Formula("11 pi/6"), Formula("5 pi/6"))[$a], + (Formula(" 3 pi/2"), Formula(" pi/2"))[$b]); +} + +Context()->texStrings; + +BEGIN_TEXT + +Find all solutions \(x\in [0,2\pi)\). +\[ $f = 0 \] + +$PAR + +\(\quad x = \) \{ ans_rule(10); \} + +$PAR +Note: your answer must be written using "pi" for \(\pi\). +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS(List($ans)->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_2.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_2.pg new file mode 100644 index 0000000000..294efc8b07 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_2.pg @@ -0,0 +1,82 @@ +## BEGIN_DESCRIPTION +## trig eqn with cos2x +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Solving trigonometric equations exactly) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + + +TEXT(beginproblem()); + +COMMENT("one of four different problems"); + +Context("Numeric"); +#Context()->constants->remove(pi); +Context()->variables->add(pi=>['Real',TeX=>"\pi"]); +#Context()->flags->set( +# reduceConstants => 0, +# reduceConstantFunctions => 0, +#); + +my $a = random(0,1); + +$i = random(0,1); + +my $c = ($a+1)*(-1)**($i+$a); + +if ($i==0) { + $f = Formula("$c cos^2(x)")->reduce; + $ans = ( + List(Formula("0"),Formula("pi")), + List(Formula("pi/3"),Formula("2 pi/3"),Formula("4 pi/3"),Formula("5 pi/3")), + )[$a]; +} else { + $f = Formula("$c sin^2(x)")->reduce; + $ans = ( + List(Formula("pi/2"),Formula("3 pi/2")), + List(Formula("pi/6"),Formula("5 pi/6"),Formula("7 pi/6"),Formula("11 pi/6")), + )[$a]; +} + +Context()->texStrings; + +BEGIN_TEXT + +Find all solutions \(x\in [0,2\pi)\). +\[ \cos(2x) = $f \] + +$PAR + +\(\quad x = \) \{ ans_rule(10); \} + +$PAR +Note: your answer must be written using "pi" for \(\pi\). +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS(List($ans)->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_3.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_3.pg new file mode 100644 index 0000000000..44f167b2f1 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_cos2x_3.pg @@ -0,0 +1,112 @@ +## BEGIN_DESCRIPTION +## trig eqn with cos2x +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Solving trigonometric equations exactly) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + + +sub pick { + my ($k, @in) = @_; + return $in[random(0,$#in)] if ($k==1); + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + + +TEXT(beginproblem()); + +COMMENT("factors: cos x=1 or cos x=1/2 and cos x > 1; or equivalent with sin"); + +Context("Numeric"); +#Context()->constants->remove(pi); +Context()->variables->add(pi=>['Real',TeX=>"\pi"]); +#Context()->flags->set( +# reduceConstants => 0, +# reduceConstantFunctions => 0, +#); + +my ($a,$b) = PGsort ( sub {$_[0] < $_[1]} , pick(2, (1..6)) ); +my ($s,$t) = (random(0,1),random(0,1)); # signs of solutions + + + +if (random(0,1)==0) { # cos or sin = 1/2 + my ($c,$d) = ($a*(-1)**$s + 2*$b*(-1)**$t, $a + $b*(-1)**($s+$t)); + + if (random(0,1)==0) { # cos x = 1/2 + $f = Formula("$a cos(2x) + $c cos(x) + $d")->reduce; + + $ans = (List(Formula("2 pi/3"),Formula("4 pi/3")), + List(Formula(" pi/3"),Formula("5 pi/3")))[$s]; + + } else { # sin x = 1/2 + $f = Formula("$a cos(2x) - $c sin(x) - $d")->reduce; + + $ans = (List(Formula("7 pi/6"),Formula("11 pi/6")), + List(Formula(" pi/6"),Formula(" 5 pi/6")))[$s]; + } + +} else { # cos or sin = 1 + ($a,$b)=($a+1,$b+1) if (($a%2)!=0); + + my ($c,$d) = ($a*(-1)**$s + $b*(-1)**$t, $a/2 + $b*(-1)**($s+$t)); + + if (random(0,1)==0) { # cos x = 1 + $f = Formula("$a/2 cos(2x) + $c cos(x) + $d")->reduce; + + $ans = (List(Formula("pi")), + List(Formula("0")))[$s]; + + } else { # sin x = 1 + $f = Formula("$a/2 cos(2x) - $c sin(x) - $d")->reduce; + + $ans = (List(Formula("3 pi/2")), + List(Formula(" pi/2")))[$s]; + + } +} + +Context()->texStrings; + +BEGIN_TEXT + +Find all solutions \(x\in [0,2\pi)\). +\[ $f = 0 \] + +$PAR + +\(\quad x = \) \{ ans_rule(10); \} + +$PAR +Note: your answer must be written using "pi" for \(\pi\). +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS(List($ans)->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_1.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_1.pg new file mode 100644 index 0000000000..659f0b76d0 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_1.pg @@ -0,0 +1,107 @@ +## BEGIN_DESCRIPTION +## trig eqn with sin2x +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Solving trigonometric equations exactly) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + + +sub pick { + my ($k, @in) = @_; + return $in[random(0,$#in)] if ($k==1); + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + + +TEXT(beginproblem()); + +COMMENT("8 possibilities: sin 2x +- trig^n x = 0"); + +Context("Numeric"); +#Context()->constants->remove(pi); +Context()->variables->add(pi=>['Real',TeX=>"\pi"]); +#Context()->flags->set( +# reduceConstants => 0, +# reduceConstantFunctions => 0, +#); + +my $s = random(0,1); # signs of solutions + + +if (random(0,1)==0) { # cos + + if (random(0,1)==0) { # n = 1 + $f = ($s==0) ? "\sin(2x) + \cos(x) = 0" : "\sin(2x) = \cos(x)"; + + $ans = ($s==0) ? List(Formula("7 pi/6"),Formula("11 pi/6")) : + List(Formula(" pi/6"),Formula(" 5 pi/6")); + + } else { # n = 2 + $f = ($s==0) ? "\sin(2x) + 2\cos^2(x) = 0" : "\sin(2x) = 2\cos^2(x)"; + + $ans = ($s==0) ? List(Formula("3 pi/4"),Formula("7 pi/4")) : + List(Formula(" pi/4"),Formula("5 pi/4")); + } + $ans = List($ans->value,Formula("pi/2"),Formula("3 pi/2")); # include cos x = 0 + +} else { # sin + + if (random(0,1)==0) { # n = 1 + $f = ($s==0) ? "\sin(2x) + \sin(x) = 0" : "\sin(2x) = \sin(x)"; + + $ans = ($s==0) ? List(Formula("2 pi/3"),Formula("4 pi/3")) : + List(Formula(" pi/3"),Formula("5 pi/3")); + + } else { # n = 2 + $f = ($s==0) ? "\sin(2x) + 2\sin^2(x) = 0" : "\sin(2x) = 2\sin^2(x)"; + + $ans = ($s==0) ? List(Formula("3 pi/4"),Formula("7 pi/4")) : + List(Formula(" pi/4"),Formula("5 pi/4")); + } + $ans = List($ans->value,Formula("0"),Formula("pi")); # include sin x = 0 +} + +Context()->texStrings; + +BEGIN_TEXT + +Find all solutions \(x\in [0,2\pi)\). +\[ $f \] + +$PAR + +\(\quad x = \) \{ ans_rule(10); \} + +$PAR +Note: your answer must be written using "pi" for \(\pi\). +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS(List($ans)->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_2.pg b/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_2.pg new file mode 100644 index 0000000000..a13b5d1dab --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch7/7.5_sin2x_2.pg @@ -0,0 +1,127 @@ +## BEGIN_DESCRIPTION +## trig eqn with sin2x +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Analytic trigonometry) +## DBsection(Solving trigonometric equations exactly) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + + +sub pick { + my ($k, @in) = @_; + return $in[random(0,$#in)] if ($k==1); + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + + +TEXT(beginproblem()); + +COMMENT("16 possibilities: sin x and cos x = +-1 or = +-1/2"); + +Context("Numeric"); +#Context()->constants->remove(pi); +Context()->variables->add(pi=>['Real',TeX=>"\pi"]); +#Context()->flags->set( +# reduceConstants => 0, +# reduceConstantFunctions => 0, +#); + +my ($s,$t) = (random(0,1),random(0,1)); # signs of solutions + +($lhs,$rhs) = (Formula("sin(2x)"),Formula("0")); + +$ans = List(""); + +if (random(0,1)==0) { # 2 sin x = +-1 + + $ans = ($s==0) ? List(Formula("7 pi/6"),Formula("11 pi/6")) : + List(Formula(" pi/6"),Formula(" 5 pi/6")); + + if (random(0,1)==0) { # 2 cos x = +-1 + $lhs *= 2; + + if ($s==0) { $lhs += Formula("2 cos(x)"); } else { $rhs += Formula("2 cos(x)"); } + + $ans = List($ans->value, + ($t==0) ? (Formula("2 pi/3"),Formula("4 pi/3")) : + (Formula(" pi/3"),Formula("5 pi/3"))); + + + } else { # cos x = +-1 + if ($s==0) { $lhs += Formula(" cos(x)"); } else { $rhs += Formula(" cos(x)"); } + + $ans = List($ans->value, + ($t==0) ? Formula("pi") : + Formula("0")); + } + if ($t==0) { $lhs += Formula("2 sin(x)"); } else { $rhs += Formula("2 sin(x)"); } + if (($s+$t)%2==0) { $lhs += Formula("1"); } else { $rhs += Formula("1"); } + +} else { # sin x = +-1 + $ans = ($s==0) ? List(Formula("3 pi/2")) : + List(Formula(" pi/2")); + + if (random(0,1)==0) { # 2 cos x = +-1 + if ($t==0) { $lhs += Formula(" sin(x)"); } else { $rhs += Formula(" sin(x)"); } + if (($s+$t)%2==0) { $lhs += Formula("1"); } else { $rhs += Formula("1"); } + + $ans = List($ans->value, + ($t==0) ? (Formula("2 pi/3"),Formula("4 pi/3")) : + (Formula(" pi/3"),Formula("5 pi/3"))); + + } else { # cos x = +-1 + if ($t==0) { $lhs += Formula("2 sin(x)"); } else { $rhs += Formula("2 sin(x)"); } + if (($s+$t)%2==0) { $lhs += Formula("2"); } else { $rhs += Formula("2"); } + + $ans = List($ans->value, + ($t==0) ? Formula("pi") : + Formula("0")); + } + if ($s==0) { $lhs += Formula("2 cos(x)"); } else { $rhs += Formula("2 cos(x)"); } +} + +$lhs = $lhs->reduce; $rhs = $rhs->reduce; + +Context()->texStrings; + +BEGIN_TEXT + +Find all solutions \(x\in [0,2\pi)\). +\[ $lhs = $rhs \] + +$PAR + +\(\quad x = \) \{ ans_rule(10); \} + +$PAR +Note: your answer must be written using "pi" for \(\pi\). +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +ANS(List($ans)->cmp()); + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch8/SSA-multiple.pg b/Contrib/METU-NCC/MAT100/Ch8/SSA-multiple.pg new file mode 100644 index 0000000000..6e85073170 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch8/SSA-multiple.pg @@ -0,0 +1,84 @@ +## BEGIN_DESCRIPTION +## Law of cosines SSA (multiple lengths) +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Triangle trigonometry) +## DBsection(Law of sines or law of cosines (side-side-angle)) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("SSA law of cosines (multiple integer answers)"); + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->strings->add(none=>{}); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + + +@s = ("a","b","c")[pick(3,0..2)]; +@S = map { uc $_ } @s ; + +($r,$s) = pick(2,(1..7)); + +$v[1] = Real($r+$s); $v[0] = $v[1]**2 - $r*$s; +$v[2] = Formula("sqrt($v[0])"); + +if ( ($s[1] cmp $s[2]) == 1 ) { + @s[1,2] = @s[2,1]; + @v[1,2] = @v[2,1]; +} +$ans[0] = List($r,$s); + +Context()->texStrings; + +BEGIN_TEXT + +Find suitable value(s) for the side \($s[0]\) (if there are any) so that +\(\triangle ABC\) is the triangle with \($S[2]=60^\circ\), \($s[1]=$v[1]\), +and \($s[2]=$v[2]\). +$PAR + +\($s[0] = \) \{$ans[0]->ans_rule();\} + +$PAR +(If no values are possible, enter 'none'.) + + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Ch8/SSA-one.pg b/Contrib/METU-NCC/MAT100/Ch8/SSA-one.pg new file mode 100644 index 0000000000..36deba519e --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Ch8/SSA-one.pg @@ -0,0 +1,85 @@ +## BEGIN_DESCRIPTION +## Law of cosines SSA (one length) +## END_DESCRIPTION +## +############################################## +## DBsubject(Trigonometry) +## DBchapter(Triangle trigonometry) +## DBsection(Law of sines or law of cosines (side-side-angle)) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Level(2) +## Language(en) +## MO(1) +############################################### + + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("SSA law of cosines (one integer answer)"); + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->strings->add(none=>{}); +Context()->flags->set( + reduceConstants => 0, + reduceConstantFunctions => 0, +); + + +@s = ("a","b","c")[pick(3,0..2)]; +@S = map { uc $_ } @s ; + +($r,$s) = PGsort (sub { $_[0] < $_[1] }, pick(2,(1..7))); +$r *= -1; + +$v[1] = Real($r+$s); $v[0] = $v[1]**2 - $r*$s; +$v[2] = Formula("sqrt($v[0])"); + +if ( ($s[1] cmp $s[2]) == 1 ) { + @s[1,2] = @s[2,1]; + @v[1,2] = @v[2,1]; +} +$ans[0] = List($s); + +Context()->texStrings; + +BEGIN_TEXT + +Find suitable value(s) for the side \($s[0]\) (if there are any) so that +\(\triangle ABC\) is the triangle with \($S[2]=60^\circ\), \($s[1]=$v[1]\), +and \($s[2]=$v[2]\). +$PAR + +\($s[0] = \) \{$ans[0]->ans_rule();\} + +$PAR +(If no values are possible, enter 'none'.) + + +END_TEXT + + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +foreach (0..$#ans) { ANS($ans[$_]->cmp()); } + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify1.pg b/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify1.pg new file mode 100644 index 0000000000..d73530039e --- /dev/null +++ b/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify1.pg @@ -0,0 +1,98 @@ +## BEGIN_DESCRIPTION +## Quadratic substitution +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Algebra of real numbers and simplifying expressions) +## DBsection(Simplifying expressions) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(4) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGunion.pl", + "PGcourse.pl", + "MathObjects.pl", + "contextLimitedPolynomial.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("Factor and cancel"); + +Context("Numeric"); +Context()->variables->are(x=>"Real",y=>"Real"); +Context()->noreduce('(-x)-y','(-x)+y'); + +$a = random(1,4); + +$s = random(-1,1,2); + +@expr = (Formula("x^3+$s*($a)^3"), + Formula("x^2-($a)^2")); + + +@expr = map { $_->reduce } @expr; + + +Context("LimitedPolynomial"); + +@ans = (Formula("x^2-$s*$a*x+($a)^2"), + Formula("x - $s*$a")); + +if (random(0,1)==1) {@expr=@expr[(1,0)]; @ans=@ans[(1,0)];} + + +$frac = "\frac{(" . $expr[0]->TeX . ")}{(" . $expr[1]->TeX . ")} "; + + +if ($displayMode eq 'TeX') { + $displayfrac = + "\[ $frac = ".$ans[0]->ans_rule(10).$ans[1]->ans_rule(10)." \]"; +} else { + $displayfrac = + ColumnTable( + "\( \displaystyle $frac = \)", + $ans[0]->ans_rule(20).$BR.$HR.$ans[1]->ans_rule(20), + indent => 0, separation => 10, valign => "MIDDLE" + ); +} + + +Context()->texStrings; + +BEGIN_TEXT +Factor and simplify. Assume any factors you cancel are not zero +$PAR +$BCENTER +$displayfrac +$ECENTER + + +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + + +map { ANS($_->cmp()) } @ans; + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify2.pg b/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify2.pg new file mode 100644 index 0000000000..0737326c49 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/ChR/R.4_Simplify2.pg @@ -0,0 +1,102 @@ +## BEGIN_DESCRIPTION +## Factoring formulas and simplification +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Algebra of real numbers and simplifying expressions) +## DBsection(Simplifying expressions) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## MO(1) +## Static(0) +## Level(4) +## Language(en) +############################################### + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGunion.pl", + "PGcourse.pl", + "MathObjects.pl", +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); + +COMMENT("Factor and cancel"); + +Context("Numeric"); +Context()->variables->are(x=>"Real"); +Context()->noreduce('(-x)-y','(-x)+y'); +Context()->operators->undefine('/',' /','/ ','//'); + + +($a,$b) = pick(2,(1..4)); + +($s,$t) = map { random(-1,1,2) } (1,2); + +@expr = (Formula("x^3+$s*($a)^3"), Formula("x^2-($b)^2"), + Formula("x^2-($a)^2"), Formula("x^3+$t*($b)^3")); + +@expr = map { $_->reduce } @expr; + +@ans = (Formula("(x^2-$s*$a*x+($a)^2)(x^2-$t*$b*x+($b)^2)")->reduce, + Formula("(x - $s*$a)(x - $t*$b)")->reduce); + +if (random(0,1)==1) { + @expr=@expr[(0,3,2,1)]; + @ans = (Formula("(x^2-$s*$a*x+($a)^2)(x - $t*$b)")->reduce, + Formula("(x - $s*$a)(x^2-$t*$b*x+($b)^2)")->reduce); +} + +if (random(0,1)==1) {@expr=@expr[(3,2,1,0)];} + + +$frac = "\frac{(" . $expr[0]->TeX . ")}{(" . $expr[1]->TeX . ")} \div " . + "\frac{(" . $expr[2]->TeX . ")}{(" . $expr[3]->TeX . ")}"; + + +if ($displayMode eq 'TeX') { + $displayfrac = + "\[ $frac = ".$ans[0]->ans_rule(10).$ans[1]->ans_rule(10)." \]"; +} else { + $displayfrac = + ColumnTable( + "\( \displaystyle $frac = \)", + $ans[0]->ans_rule(20).$BR.$HR.$ans[1]->ans_rule(20), + indent => 0, separation => 10, valign => "MIDDLE" + ); +} + + +Context()->texStrings; + +BEGIN_TEXT +Factor and simplify. Assume any factors you cancel are not zero +$PAR +$BCENTER +$displayfrac +$ECENTER + + +END_TEXT + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + + +map { ANS($_->cmp()) } @ans; + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Table_Abs1.pg b/Contrib/METU-NCC/MAT100/Table_Abs1.pg new file mode 100644 index 0000000000..b3fb5ef42b --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Table_Abs1.pg @@ -0,0 +1,134 @@ +## BEGIN_DESCRIPTION +## Complete sign table for sums of absolute value functions +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Absolute value expressions and functions) +## DBsection(Absolute value inequalities) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Date(October 2021) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + + +DOCUMENT(); + +loadMacros( +"PGstandard.pl", +"PGcourse.pl", +"MathObjects.pl", +"parserPopUp.pl", +"niceTables.pl", +"contextFraction.pl" +); + +TEXT(beginproblem()); + +COMMENT('|ax+b|+c (randomly flipped)'); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +} + +Context("Fraction"); + +####################### +# Sign table constants +# + +$dne = "~~x{2205}"; +#$dne = "X"; + +@popPN = (PopUp([" ","+","-"],"+"), + PopUp([" ","+","-"],"-")); +@popZ = (PopUp([" ","0","$dne"],"0"), + PopUp([" ","0","$dne"],"$dne")); + +$br = "border-right: 3px solid;"; +$bb = "border-bottom: 3px solid; height: 2px;"; +$ht = "height:2px;"; + +# +######################## + +$a = random(2,5); +$b = non_zero_random(-6,6); +$c = random(1,10); + +$f = Formula("abs($a x - $b) - $c")->reduce; + +if (random(0,1)==1) { + $f = Formula("$c - abs($a x - $b)")->reduce; +} + +@x = (Fraction($b-$c,$a), Fraction($b+$c,$a)); + +@pop_Zer = ($popZ[0], $popZ[0]); + +@pop_f = ( + (($f->eval(x=>$x[0]-1) > 0) ? $popPN[0] : $popPN[1]) , + (($f->eval(x=>($x[0]+$x[1])/2) > 0) ? $popPN[0] : $popPN[1]) , + (($f->eval(x=>$x[1]+1) > 0) ? $popPN[0] : $popPN[1]) +); + + +Context()->texStrings; +BEGIN_TEXT + +Fill in the sign table for the expression +\(\ \ \displaystyle f(x) = $f \). + +$PAR +\{DataTable( +[ + ["\(x\)","", + [ans_rule(2),colspan=>2],"", + [ans_rule(2),colspan=>2],"" ], + [ ["",cellcss=>$bb],["",cellcss=>$bb],["",cellcss=>$bb.$br], + ["",cellcss=>$bb],["",cellcss=>$bb],["",cellcss=>$bb.$br], + ["",cellcss=>$bb],["",cellcss=>$bb] ], + [ ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], + ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], + ["",cellcss=>$ht],["",cellcss=>$ht] ], + ["\(f\)",$pop_f[0]->menu(),["0",colspan=>2], + $pop_f[1]->menu(),["0",colspan=>2], + $pop_f[2]->menu() ] +], 'align =>ccc|ccc|cc', midrules=>1 +);\} + +$PAR +In the row for \(x\): +$BR\(\quad \bullet\ \) +fill in \(x\)-values on number line where \(f\) is zero. +$BR +In the row for \(f\): +$BR\(\quad \bullet\ \) +choose "\(+\)" or "\(-\)" on ${BBOLD}intervals${EBOLD} + to indicate \(f\) is ${BBOLD}positive${EBOLD} or ${BBOLD}negative${EBOLD}. + + + + +END_TEXT +Context()->normalStrings; + +ANS( $x[0]->cmp() ); +ANS( $x[1]->cmp() ); + +ANS( $pop_f[0]->cmp() ); +ANS( $pop_f[1]->cmp() ); +ANS( $pop_f[2]->cmp() ); + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Table_Abs.pg b/Contrib/METU-NCC/MAT100/Table_Abs2.pg similarity index 84% rename from Contrib/METU-NCC/MAT100/Table_Abs.pg rename to Contrib/METU-NCC/MAT100/Table_Abs2.pg index 26b0acf955..2c006bc7f3 100644 --- a/Contrib/METU-NCC/MAT100/Table_Abs.pg +++ b/Contrib/METU-NCC/MAT100/Table_Abs2.pg @@ -104,7 +104,7 @@ if (random(0,1)==1) { Context()->texStrings; BEGIN_TEXT -Fill in the sign table for the function +Fill in the sign table for the expression \(\ \ \displaystyle f(x) = $f \). $PAR @@ -119,8 +119,8 @@ $PAR [ ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], ["",cellcss=>$ht],["",cellcss=>$ht] ], - ["\(f\)",$pop_f[0]->menu(),[$pop_Zer[0]->menu(),colspan=>2], - $pop_f[1]->menu(),[$pop_Zer[1]->menu(),colspan=>2], + ["\(f\)",$pop_f[0]->menu(),["0",colspan=>2], + $pop_f[1]->menu(),["0",colspan=>2], $pop_f[2]->menu() ] ], 'align =>ccc|ccc|cc', midrules=>1 );\} @@ -128,15 +128,12 @@ $PAR $PAR In the row for \(x\): $BR\(\quad \bullet\ \) -fill in \(x\)-values on number line where \(f\) is zero or does not exist. +fill in \(x\)-values on number line where \(f\) is zero. $BR In the row for \(f\): $BR\(\quad \bullet\ \) -mark ${BBOLD}intervals${EBOLD} as "\(+\)" or "\(-\)" - to indicate \(f\) is ${BBOLD}positive${EBOLD} or ${BBOLD}negative${EBOLD}; and -$BR\(\quad \bullet\ \) -mark ${BBOLD}points${EBOLD} as "\(0\)" or "${BTT}$dne${ETT}" - to indicate \(f\) is ${BBOLD}zero${EBOLD} or does ${BBOLD}not exist${EBOLD}. +choose "\(+\)" or "\(-\)" on ${BBOLD}intervals${EBOLD} + to indicate \(f\) is ${BBOLD}positive${EBOLD} or ${BBOLD}negative${EBOLD}. @@ -147,8 +144,8 @@ Context()->normalStrings; ANS( $x[0]->cmp() ); ANS( $x[1]->cmp() ); -ANS( $pop_f[0]->cmp() ); ANS( $pop_Zer[0]->cmp() ); -ANS( $pop_f[1]->cmp() ); ANS( $pop_Zer[1]->cmp() ); +ANS( $pop_f[0]->cmp() ); +ANS( $pop_f[1]->cmp() ); ANS( $pop_f[2]->cmp() ); diff --git a/Contrib/METU-NCC/MAT100/Table_Abs3.pg b/Contrib/METU-NCC/MAT100/Table_Abs3.pg new file mode 100644 index 0000000000..c4b2af2b33 --- /dev/null +++ b/Contrib/METU-NCC/MAT100/Table_Abs3.pg @@ -0,0 +1,162 @@ +## BEGIN_DESCRIPTION +## Complete sign table for sums of absolute value functions +## END_DESCRIPTION +## +############################################## +## DBsubject(Algebra) +## DBchapter(Absolute value expressions and functions) +## DBsection(Absolute value inequalities) +## Institution(METU-NCC) +## Author(Benjamin Walter) +## Date(October 2021) +## MO(1) +## Static(0) +## Level(2) +## Language(en) +############################################### + + + +DOCUMENT(); + +loadMacros( +"PGstandard.pl", +"PGcourse.pl", +"MathObjects.pl", +"parserPopUp.pl", +"niceTables.pl", +"contextFraction.pl" +); + +TEXT(beginproblem()); + +COMMENT('random slopes could make answers ugly...'); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +} + +Context("Fraction"); + +####################### +# Sign table constants +# + +$dne = "~~x{2205}"; +#$dne = "X"; + +@popPN = (PopUp([" ","+","-"],"+"), + PopUp([" ","+","-"],"-")); +@popZ = (PopUp([" ","0","$dne"],"0"), + PopUp([" ","0","$dne"],"$dne")); + +$br = "border-right: 3px solid;"; +$bb = "border-bottom: 3px solid; height: 2px;"; +$ht = "height:2px;"; + +# +######################## + +@a = PGsort(sub {$_[0] < $_[1]}, pick(3,(-4..-1,1..4))); +@m = map { random(1,3) } @a; + +$f = Formula("$m[0] abs(x-$a[0]) + $m[1] abs(x-$a[1]) + $m[2] abs(x-$a[2])")->reduce; + +@crit = ($f->eval(x=>$a[0]),$f->eval(x=>$a[1]),$f->eval(x=>$a[2])); +@crits = PGsort(sub {$_[0] < $_[1]}, @crit); + +do { $b = random($crits[0]+1,$crits[2]+3); } +until (($b != $crits[1]) && ($b != $crits[2])); + +$f = Formula("$f-$b")->reduce; + +@x = (); + +if ($b > $crit[0]) { + push(@x, ( + Fraction($m[0]*$a[0]+$m[1]*$a[1]+$m[2]*$a[2]-$b, + $m[0]+$m[1]+$m[2])->reduce + )); +} +if ($b == (PGsort(sub {$_[0] < $_[1]}, ($b,$crit[0],$crit[1])))[1]) { + push(@x, ( + Fraction(-$m[0]*$a[0]+$m[1]*$a[1]+$m[2]*$a[2]-$b, + -$m[0]+$m[1]+$m[2])->reduce + )); +} +if ($b == (PGsort(sub {$_[0] < $_[1]}, ($b,$crit[1],$crit[2])))[1]) { + push(@x, ( + Fraction(-$m[0]*$a[0]-$m[1]*$a[1]+$m[2]*$a[2]-$b, + -$m[0]-$m[1]+$m[2])->reduce + )); +} +if ($b > $crit[2]) { + push(@x, ( + Fraction($m[0]*$a[0]+$m[1]*$a[1]+$m[2]*$a[2]+$b, + $m[0]+$m[1]+$m[2])->reduce + )); +} + +@pop_Zer = ($popZ[0], $popZ[0]); + +@pop_f = ( + (($f->eval(x=>$x[0]-1) > 0) ? $popPN[0] : $popPN[1]) , + (($f->eval(x=>($x[0]+$x[1])/2) > 0) ? $popPN[0] : $popPN[1]) , + (($f->eval(x=>$x[1]+1) > 0) ? $popPN[0] : $popPN[1]) +); + + +Context()->texStrings; +BEGIN_TEXT + +Fill in the sign table for the expression +\(\ \ \displaystyle f(x) = $f \). + +$PAR +\{DataTable( +[ + ["\(x\)","", + [ans_rule(2),colspan=>2],"", + [ans_rule(2),colspan=>2],"" ], + [ ["",cellcss=>$bb],["",cellcss=>$bb],["",cellcss=>$bb.$br], + ["",cellcss=>$bb],["",cellcss=>$bb],["",cellcss=>$bb.$br], + ["",cellcss=>$bb],["",cellcss=>$bb] ], + [ ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], + ["",cellcss=>$ht],["",cellcss=>$ht],["",cellcss=>$ht.$br], + ["",cellcss=>$ht],["",cellcss=>$ht] ], + ["\(f\)",$pop_f[0]->menu(),["0",colspan=>2], + $pop_f[1]->menu(),["0",colspan=>2], + $pop_f[2]->menu() ] +], 'align =>ccc|ccc|cc', midrules=>1 +);\} + +$PAR +In the row for \(x\): +$BR\(\quad \bullet\ \) +fill in \(x\)-values on number line where \(f\) is zero. +$BR +In the row for \(f\): +$BR\(\quad \bullet\ \) +choose "\(+\)" or "\(-\)" on ${BBOLD}intervals${EBOLD} + to indicate \(f\) is ${BBOLD}positive${EBOLD} or ${BBOLD}negative${EBOLD}. + + + + +END_TEXT +Context()->normalStrings; + +ANS( $x[0]->cmp() ); +ANS( $x[1]->cmp() ); + +ANS( $pop_f[0]->cmp() ); +ANS( $pop_f[1]->cmp() ); +ANS( $pop_f[2]->cmp() ); + + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT100/Table_Rat.pg b/Contrib/METU-NCC/MAT100/Table_Rat.pg index dacd3990d6..d27df96a35 100644 --- a/Contrib/METU-NCC/MAT100/Table_Rat.pg +++ b/Contrib/METU-NCC/MAT100/Table_Rat.pg @@ -43,9 +43,11 @@ $dne = "~~x{2205}"; @c = ([random(1,3), random(-3,-1)], [non_zero_random(-3,3),non_zero_random(-3,3)]); do {$c[0][1] = random(-3,-1);} while (abs($c[0][0])==abs($c[0][1])); -do {$c[0][2] = non_zero_random(-3,3);} while (abs($c[0][0])==abs($c[0][2])); +do {$c[0][2] = non_zero_random(-3,3);} while (($c[0][0]==$c[0][2]) || + ($c[0][1]==$c[0][2])); do {$c[1][1] = non_zero_random(-3,3);} while (abs($c[1][0])==abs($c[1][1])); -do {$c[1][2] = non_zero_random(-3,3);} while (abs($c[1][0])==abs($c[1][2])); +do {$c[1][2] = non_zero_random(-3,3);} while (($c[1][0]==$c[1][2]) || + ($c[1][1]==$c[1][2])); my @S; $S[0] = non_zero_random(-1,1); diff --git a/Contrib/METU-NCC/MAT101/Chapter0/Exp_Solve.pg b/Contrib/METU-NCC/MAT101/Chapter0/Exp_Solve.pg index 429775bbd7..91ddb4127b 100644 --- a/Contrib/METU-NCC/MAT101/Chapter0/Exp_Solve.pg +++ b/Contrib/METU-NCC/MAT101/Chapter0/Exp_Solve.pg @@ -30,6 +30,8 @@ Context()->variables->are(x=>"Real",y=>"Real"); my $a; my $b; my $c; my $d; my $ab; +######## (A) + ($a,$b,$c) = (random(2,4),random(2,5),non_zero_random(-4,4)); $d = $b*$a+$c; @@ -37,7 +39,7 @@ $expr[0] = Formula("$b sqrt(x)+$c")->reduce; $expr[0] = $expr[0]->TeX . " = $d" ; $ans[0] = Real($a**2); -######### +######### (B) ($a,$b,$c) = (random(2,4),random(2,5),non_zero_random(-4,4)); $d = $b*$a; @@ -47,7 +49,7 @@ $expr[1] = $expr[1]->TeX . " = $d" ; $ans[1] = Real($a**2-$c); -######### +######### (C) ($a,$b,$c) = (random(2,4),random(2,4),random(2,3)); @@ -57,7 +59,7 @@ $expr[2] = "$b x^{1/$c}= $d"; $ans[2] = Real($a**$c); -######### +######### (D) ($a,$b,$c) = (random(2,3),random(3,5),random(2,4)); $d = $c*$a**$b; @@ -65,6 +67,8 @@ $d = $c*$a**$b; $expr[3] = "$c x^{-$b}= $d"; $ans[3] = Fraction(1,$a); +if ($b%2==0) { $ans[3] = List($ans[3],-$ans[3]) }; + ######### diff --git a/Contrib/METU-NCC/MAT101/Chapter3/Lines-v2.pg b/Contrib/METU-NCC/MAT101/Chapter3/Lines-v2.pg new file mode 100644 index 0000000000..e5eeee703e --- /dev/null +++ b/Contrib/METU-NCC/MAT101/Chapter3/Lines-v2.pg @@ -0,0 +1,107 @@ +## DBsubject(Algebra) +## DBchapter(Linear equations and functions) +## DBsection(Equations of lines: general) +## Level(2) +## Author(Benjamin Walter) +## Institution(METU-NCC) +## Language(en) +## MO(1) +## Static(0) + +DOCUMENT(); # This should be the first executable line in the problem. + +loadMacros( + "PGstandard.pl", + "PGchoicemacros.pl", + "PGcourse.pl", + "MathObjects.pl", + "parserImplicitPlane.pl", + "contextFraction.pl" +); + +sub pick { + my ($k, @in) = @_; + my @out = (); + while (@out < $k) { push( @out, splice(@in, random(0,$#in), 1) ); } + @out; +}; + +TEXT(beginproblem()); +Context("Fraction"); +Context()->variables->are(x=>"Real"); + +my @c; my @m; + +@c = pick(4,(-5..-1,1..5)); +do { + @m = (Fraction(pick(2,(2..5)))->reduce, + Fraction(pick(2,(2..5)))->reduce); +} while ($m[0]==$m[1]); +$m[random(0,1)] *= -1; +Context()->texStrings; +$expr[0] = "Through \(($c[0],\,$c[1])\) with slope \($m[0]\)"; +Context()->normalStrings; +$ans[0] = Formula("$m[0] (x-$c[0]) + $c[1]")->reduce; + +$expr[1] = "With \(y($c[2])=$c[3]\) and slope \($m[1]\)"; +$ans[1] = Formula("$m[1] (x-$c[2]) + $c[3]")->reduce; + +do { @c = (pick(2,(-5..-1,1..5)),pick(2,(-5..-1,1..5))); } +until (($c[0]!=$c[2]) && ($c[1] != $c[3])); +$expr[2] = "Through \(($c[0],\,$c[1])\) and \(($c[2],\,$c[3])\)"; +$ans[2] = Formula("($c[3]-$c[1])/($c[2]-$c[0]) (x-$c[0]) + $c[1]")->reduce; + +do { @c = (pick(2,(-5..-1,1..5)),pick(2,(-5..-1,1..5))); } +until (($c[0]!=$c[2]) && ($c[1] != $c[3])); +$expr[3] = "With \(y($c[0])=$c[1]\) and \(y($c[2])=$c[3]\)"; +$ans[3] = Formula("($c[3]-$c[1])/($c[2]-$c[0]) (x-$c[0]) + $c[1]")->reduce; + +$c[0] = non_zero_random(-5,5); +$m[0] = Fraction(non_zero_random(-5,5),random(2,5))->reduce; +Context()->texStrings; +$expr[4] = "With \(y\)-intercept \($c[0]\) and slope \($m[0]\)"; +Context()->normalStrings; +$ans[4] = Formula("$m[0] x + $c[0]")->reduce; + +@c = pick(2,(-5..-1,1..5)); +$expr[5] = "With \(y\)-intercept \($c[0]\) and \(x\)-intercept \($c[1]\)"; +$ans[5] = Formula("-$c[0]/$c[1] x + $c[0]"); + + +Context("ImplicitPlane"); +Context()->variables->are(x=>"Real",y=>"Real"); + +@ans = map { ImplicitPlane("y=$_") } @ans; + +my @i = pick(4,(0,2,4,5)); +@expr = @expr[@i]; @ans = @ans[@i]; + +@index = ("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"); + +Context()->texStrings; +BEGIN_TEXT + +Write formulas for the following lines. +END_TEXT +for ($i=0;$i<=$#expr;$i++) { +BEGIN_TEXT + +$PAR +$BBOLD ($index[$i]) $EBOLD $SPACE $SPACE + $expr[$i] $BR + \(\quad \) \{ans_rule(15);\} + +END_TEXT +} + +Context()->normalStrings; + +$showPartialCorrectAnswers = 1; + +for ($i=0;$i<=$#ans;$i++) { + ANS( $ans[$i]->cmp() ); +} + + +ENDDOCUMENT(); # This should be the last executable line in the problem. + diff --git a/Contrib/METU-NCC/MAT101/Chapter8/Probability-3.pg b/Contrib/METU-NCC/MAT101/Chapter8/Probability-3.pg index 9b1d0c3060..0d351076af 100644 --- a/Contrib/METU-NCC/MAT101/Chapter8/Probability-3.pg +++ b/Contrib/METU-NCC/MAT101/Chapter8/Probability-3.pg @@ -29,12 +29,11 @@ Context("IntegerFunctions"); Context()->variables->are(x=>"Real"); Context()->flags->set(reduceConstants=>0); -$b = random(5,8); -do { $g = random(5,8); } until ($g != $b); +($b,$g) = pick(2,(5..8)); $n = $b+$g; $k = random(4,min($g,$b)); -my $m = random(2,min($g,$b)-1); +my $m = random(2,min($g,$b,$k)-1); my $i = random(0,1); diff --git a/Contrib/METU-NCC/MAT101/Derivatives/Chain2.pg b/Contrib/METU-NCC/MAT101/Derivatives/Chain2.pg index 75fbdca11a..79376c0f82 100644 --- a/Contrib/METU-NCC/MAT101/Derivatives/Chain2.pg +++ b/Contrib/METU-NCC/MAT101/Derivatives/Chain2.pg @@ -76,23 +76,23 @@ Compute derivatives of the following functions (be careful about parenthesis!): $PAR $BBOLD A.$EBOLD \(\quad \displaystyle f(x) = $f_text[0]\) $BR -\(\quad f'(x) = \) \{ ans_box(2,40); \} +\(\quad f'(x) = \) \{ ans_rule(40); \} $PAR $BBOLD B.$EBOLD \(\quad \displaystyle f(x) = $f_text[1]\) $BR -\(\quad f'(x) = \) \{ ans_box(3,40); \} +\(\quad f'(x) = \) \{ ans_rule(40); \} $PAR $BBOLD C.$EBOLD \(\quad \displaystyle f(x) = $f_text[2]\) $BR -\(\quad f'(x) = \) \{ ans_box(2,40); \} +\(\quad f'(x) = \) \{ ans_rule(40); \} $PAR $BBOLD D.$EBOLD \(\quad \displaystyle f(x) = $f_text[3]\) $BR -\(\quad f'(x) = \) \{ ans_box(3,40); \} +\(\quad f'(x) = \) \{ ans_rule(40); \} $PAR diff --git a/Contrib/METU-NCC/MAT101/Derivatives/Product.pg b/Contrib/METU-NCC/MAT101/Derivatives/Product.pg index 43cf921011..630b51b3df 100644 --- a/Contrib/METU-NCC/MAT101/Derivatives/Product.pg +++ b/Contrib/METU-NCC/MAT101/Derivatives/Product.pg @@ -82,12 +82,12 @@ Compute derivatives of the following functions: $PAR $BBOLD A.$EBOLD \(\quad \displaystyle f(x) = $text_prod\) $BR -\(\quad \ \ f'(x) = \) \{ ans_box(3,40); \} +\(\quad \ \ f'(x) = \) \{ ans_rule(40); \} $PAR $BBOLD B.$EBOLD \(\quad \displaystyle f(x) = $text_quot\) $BR -\(\quad f'(x) = \) \{ ans_box(3,40); \} +\(\quad f'(x) = \) \{ ans_rule(40); \} $PAR diff --git a/Contrib/METU-NCC/MAT101/Final/Basics2.pg b/Contrib/METU-NCC/MAT101/Final/Basics2.pg index b43a56c320..5ce6d2a49a 100644 --- a/Contrib/METU-NCC/MAT101/Final/Basics2.pg +++ b/Contrib/METU-NCC/MAT101/Final/Basics2.pg @@ -75,7 +75,7 @@ $counter = 0; do { BEGIN_TEXT $BBOLD $items[$counter] $EBOLD - \(\displaystyle \frac{d}{dx} \left[ $F[$counter] \right] = \) \{ ans_box(3,20); \} + \(\displaystyle \frac{d}{dx} \left[ $F[$counter] \right] = \) \{ ans_rule(20); \} $PAR END_TEXT $counter++; diff --git a/Contrib/METU-NCC/MAT101/Final/Tangent.pg b/Contrib/METU-NCC/MAT101/Final/Tangent.pg index 3b7357225b..ef450c2c64 100644 --- a/Contrib/METU-NCC/MAT101/Final/Tangent.pg +++ b/Contrib/METU-NCC/MAT101/Final/Tangent.pg @@ -56,12 +56,12 @@ do { } } until ($unique == 1); -$a = random(0,2); +$a = random(0,1); $Tangent1 = Formula("$df[$a]*(x-($a+1)) + $f[$a]")->reduce; $Tangent2 = Formula("($df[$a]+1)*(x-($a+1)) + ($f[$a]+$a+1)")->reduce; $Tangent3 = Formula("($df[$a]*($a+1)+$f[$a])*(x-($a+1)) + $f[$a]*($a+1)")->reduce; -$Tangent4 = Formula("$df[$a+1](x-($a+1)) + $f[$a+1]")->reduce; +$Tangent4 = Formula("2*$df[2*$a+1](x-($a+1)) + $f[2*$a+1]")->reduce; $a++; @@ -100,7 +100,7 @@ $BBOLD (C) $EBOLD The tangent line to \(y= x $f\) at \(x=$a\). $PAR -$BBOLD (D) $EBOLD The tangent line to \(y= f{\small(x+1)}\) at \(x=$a\). +$BBOLD (D) $EBOLD The tangent line to \(y= f{\small(2x)}\) at \(x=$a\). $BR \(\quad y = \)\{ans_rule(10);\} diff --git a/Contrib/METU-NCC/MAT101/Integrals/Surplus.pg b/Contrib/METU-NCC/MAT101/Integrals/Surplus.pg index 170410da81..5e1e2f7057 100644 --- a/Contrib/METU-NCC/MAT101/Integrals/Surplus.pg +++ b/Contrib/METU-NCC/MAT101/Integrals/Surplus.pg @@ -108,6 +108,11 @@ $PAR $PAR$BR$PAR +END_TEXT + + +BEGIN_TEXT + $BBOLD B. $EBOLD Find the $problem[$p[0]]. $PAR $int[$p[0]] @@ -122,12 +127,12 @@ END_TEXT Context()->normalStrings; ANS(Real("$eq_quantity")->cmp()); ANS(Real("0")->cmp()); -ANS($diff[$p[0]]->cmp()); -ANS($surp[$p[0]]->cmp()); +ANS($diff[0]->cmp()); +ANS($surp[0]->cmp()); ANS(Real("$eq_quantity")->cmp()); ANS(Real("0")->cmp()); -ANS($diff[$p[1]]->cmp()); -ANS($surp[$p[1]]->cmp()); +ANS($diff[1]->cmp()); +ANS($surp[1]->cmp()); ANS( Real("$eq_quantity")->cmp() ); ANS( Real("$eq_price")->cmp() ); diff --git a/Contrib/METU-NCC/MAT101/Midterm/log.pg b/Contrib/METU-NCC/MAT101/Midterm/log.pg index 4af13d2bf1..649b7f8cfb 100644 --- a/Contrib/METU-NCC/MAT101/Midterm/log.pg +++ b/Contrib/METU-NCC/MAT101/Midterm/log.pg @@ -67,7 +67,7 @@ $expr2[1] = Formula("$c[3]"); $ans2 = Fraction($c[2]-$c[1],$c[0]); -do { @c = (random(-4,-1),random(1,4)); } +do { @c = (random(-6,-1),random(2,5)); } until ($c[0]+$c[1] != 0); $expr3[0] = "\log_{x} (" . diff --git a/Contrib/METU-NCC/R/data_create.pg b/Contrib/METU-NCC/R/data_create.pg index f24ee01771..c946ca02ec 100644 --- a/Contrib/METU-NCC/R/data_create.pg +++ b/Contrib/METU-NCC/R/data_create.pg @@ -192,11 +192,12 @@ $BR $PAR -\{ knowlLink("Weird side note", - value=>' $SPACE You can also store data using an arrow in the other direction. For example: $BR - - $SPACE $SPACE 17 $SPACE-> Age $BR - $SPACE "Ali" -> Name '); +\{ knowlLink("Weird side note", value=> < +$SPACE $SPACE 17 $SPACE-> Age $BR +$SPACE "Ali" -> Name +EOF \} END_TEXT diff --git a/Contrib/METU-NCC/R/data_frame2.pg b/Contrib/METU-NCC/R/data_frame2.pg index 76ed4cefe4..d6ddd07944 100644 --- a/Contrib/METU-NCC/R/data_frame2.pg +++ b/Contrib/METU-NCC/R/data_frame2.pg @@ -208,22 +208,24 @@ DataTable([ ],@Rbox_out,align=>'clrrp{30px}|p{10px}lrrp{30px}'); \} $PAR -\{ knowlLink("Code for Family", value=>' - Family <- data.frame($BR -$SPACE $SPACE Name = c("Benjamin","Annabet","Charlie","Daddy","Mama"),$BR -$SPACE $SPACE Age = c(15, 11, 7, 41, 41),$BR +\{ knowlLink("Code for Family", url=>'', type=>'', value=> <' - Family_named <- data.frame($BR +\{ knowlLink("Code for Family_named", value=> < < z_{5\%}\bigr) =\!= 5\%\). +EOF +\} + $PAR $HR $PAR -You may use the embedded R window below to check your code and perform computations.$BR +Click below to open an embedded R-window which you can use to check your +code or perform computations + +END_TEXT +Scaffold::Begin(can_open=>"always",is_open=>"never"); +######################################################## +Section::Begin("$BBOLD Embedded R Window $EBOLD"); + +BEGIN_TEXT + ${BCENTER} $Rframe ${ECENTER} - - END_TEXT +Section::End(); +######################################################## +Scaffold::End(); + Context()->normalStrings; # Answers diff --git a/Contrib/METU-NCC/Statistics/S3_CI/CI_t.pg b/Contrib/METU-NCC/Statistics/S3_CI/CI_t.pg index c871e506e0..c9c0eb8362 100644 --- a/Contrib/METU-NCC/Statistics/S3_CI/CI_t.pg +++ b/Contrib/METU-NCC/Statistics/S3_CI/CI_t.pg @@ -18,11 +18,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", # Standard macros for PG language - "MathObjects.pl", - "contextArbitraryString.pl", - "RserveClient.pl", - "PGcourse.pl", + "PGstandard.pl", # Standard macros for PG language + "MathObjects.pl", + "contextArbitraryString.pl", + "RserveClient.pl", + "PGcourse.pl", + "scaffold.pl" ); # Print problem number and point value (weight) for the problem @@ -101,28 +102,43 @@ $BR $PAR -$PAR -$HR -$PAR -You may use the embedded R window below to check your code and perform computations.$BR -${BCENTER} -$Rframe -${ECENTER} -$PAR +\{ knowlLink("(Reminder about R commands.)", value=> < t_{5\%}\bigr) =\!= 5\%\), and \(T\) has 9 degrees of freedom. +$BR $SPACE $SPACE $SPACE ${BTT}qt\((1-.05,\;9)\)${ETT} $BR +computes the critical value \(t_{5\%,9}\) where +\(\mathrm{P}\bigl(T \ge t_{5\%,9}\bigr) =\!= 5\%\), and \(T\) has 9 degrees of freedom. +EOF +\} +$PAR +$HR +$PAR +Click below to open an embedded R-window which you can use to check your +code or perform computations END_TEXT +Scaffold::Begin(can_open=>"always",is_open=>"never"); +######################################################## +Section::Begin("$BBOLD Embedded R Window $EBOLD"); + +BEGIN_TEXT + +${BCENTER} +$Rframe +${ECENTER} + +END_TEXT + +Section::End(); +######################################################## +Scaffold::End(); Context()->normalStrings; diff --git a/Contrib/METU-NCC/Statistics/S3_CI/CI_x.pg b/Contrib/METU-NCC/Statistics/S3_CI/CI_x.pg index 5c846998a8..4697a9f910 100644 --- a/Contrib/METU-NCC/Statistics/S3_CI/CI_x.pg +++ b/Contrib/METU-NCC/Statistics/S3_CI/CI_x.pg @@ -18,11 +18,12 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", # Standard macros for PG language - "MathObjects.pl", - "contextArbitraryString.pl", - "RserveClient.pl", - "PGcourse.pl", + "PGstandard.pl", # Standard macros for PG language + "MathObjects.pl", + "contextArbitraryString.pl", + "RserveClient.pl", + "PGcourse.pl", + "scaffold.pl" ); # Print problem number and point value (weight) for the problem @@ -81,29 +82,44 @@ $BR $PAR -$PAR -$HR -$PAR -You may use the embedded R window below to check your code and perform computations.$BR -${BCENTER} -$Rframe -${ECENTER} -$PAR -Recall that if \(X\sim \chi^2(n)\) +\{ knowlLink("(Reminder about R commands.)", value=> <"always",is_open=>"never"); +######################################################## +Section::Begin("$BBOLD Embedded R Window $EBOLD"); + +BEGIN_TEXT + +${BCENTER} +$Rframe +${ECENTER} + +END_TEXT + +Section::End(); +######################################################## +Scaffold::End(); Context()->normalStrings; diff --git a/Contrib/METU-NCC/Statistics/S3_CI/CI_z.pg b/Contrib/METU-NCC/Statistics/S3_CI/CI_z.pg index b7d9c52b7a..c0940dab02 100644 --- a/Contrib/METU-NCC/Statistics/S3_CI/CI_z.pg +++ b/Contrib/METU-NCC/Statistics/S3_CI/CI_z.pg @@ -18,14 +18,14 @@ DOCUMENT(); loadMacros( - "PGstandard.pl", # Standard macros for PG language - "MathObjects.pl", - "contextArbitraryString.pl", - "RserveClient.pl", - "PGcourse.pl", + "PGstandard.pl", # Standard macros for PG language + "MathObjects.pl", + "contextArbitraryString.pl", + "RserveClient.pl", + "PGcourse.pl", + "scaffold.pl" ); -# Print problem number and point value (weight) for the problem TEXT(beginproblem()); COMMENT('Requires integrated R server (Rserve.pm)'); @@ -96,27 +96,42 @@ $BR $PAR -$PAR -$HR -$PAR -You may use the embedded R window below to check your code and perform computations.$BR -${BCENTER} -$Rframe -${ECENTER} -$PAR +\{ knowlLink("(Reminder about R commands.)", value=> < z_{5\%}\bigr) =\!= 5\%\). +\(\mathrm{P}\bigl(Z \ge z_{5\%}\bigr) =\!= 5\%\). +EOF +\} +$PAR +$HR +$PAR +Click below to open an embedded R-window which you can use to check your +code or perform computations END_TEXT +Scaffold::Begin(can_open=>"always",is_open=>"never"); +######################################################## +Section::Begin("$BBOLD Embedded R Window $EBOLD"); + +BEGIN_TEXT + +${BCENTER} +$Rframe +${ECENTER} + +END_TEXT + +Section::End(); +######################################################## +Scaffold::End(); Context()->normalStrings;