mathmaker
0.6(alpha)
|
00001 # -*- coding: utf-8 -*- 00002 00003 # Mathmaker creates automatically maths exercises sheets 00004 # with their answers 00005 # Copyright 2006-2014 Nicolas Hainaux <nico_h@users.sourceforge.net> 00006 00007 # This file is part of Mathmaker. 00008 00009 # Mathmaker is free software; you can redistribute it and/or modify 00010 # it under the terms of the GNU General Public License as published by 00011 # the Free Software Foundation; either version 3 of the License, or 00012 # any later version. 00013 00014 # Mathmaker is distributed in the hope that it will be useful, 00015 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 # GNU General Public License for more details. 00018 00019 # You should have received a copy of the GNU General Public License 00020 # along with Mathmaker; if not, write to the Free Software 00021 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 import os 00024 import sys 00025 import locale 00026 00027 from lib.common import default 00028 from lib.common import latex 00029 00030 from core import * 00031 from core.base_calculus import * 00032 from core.calculus import * 00033 00034 from maintenance.autotest import common 00035 00036 try: 00037 locale.setlocale(locale.LC_ALL, default.LANGUAGE + '.' + default.ENCODING) 00038 except: 00039 locale.setlocale(locale.LC_ALL, '') 00040 00041 check = common.check 00042 00043 00044 def action(): 00045 if common.verbose: 00046 os.write(common.output, bytes("--- EQUATIONS\n", 'utf-8')) 00047 00048 eq_basic1 = Equation((Polynomial([Monomial(('+', 1, 1)), 00049 Monomial(('+', 7, 0)) 00050 ]), 00051 Item(3) 00052 ), 00053 number=1) 00054 00055 eq_basic2 = Equation((Polynomial([Monomial(('-', 8, 0)), 00056 Monomial(('+', 1, 1)) 00057 ]), 00058 00059 Item(-2) 00060 ), 00061 number=1) 00062 00063 eq_basic_r1 = Equation((Item(-5), 00064 Polynomial([Monomial(('+', 1, 1)), 00065 Monomial(('+', 3, 0)) 00066 ]), 00067 ), 00068 number=1) 00069 00070 eq_basic_r2 = Equation((Item(-6), 00071 Monomial(('+', 5, 1)) 00072 ), 00073 number=1) 00074 00075 00076 eq_basic3 = Equation((Monomial(('+', 8, 1)), 00077 Item(1) 00078 ), 00079 number=1) 00080 00081 00082 eq_basic4 = Equation((Monomial(('+', 12, 1)), 00083 Item(8) 00084 ), 00085 number=1) 00086 00087 eq_standard1 = Equation((Polynomial([Monomial(('+', 2, 1)), 00088 Monomial(('+', 3, 0)) 00089 ]), 00090 Item(8) 00091 ), 00092 number=1) 00093 00094 # 19+3x=2x 00095 eq_standard2 = Equation((Polynomial([Monomial(('+', 19, 0)), 00096 Monomial(('+', 3, 1)) 00097 ]), 00098 Monomial(('+', 2, 1)) 00099 ), 00100 number=1) 00101 00102 eq_difficult1 = Equation((Polynomial([Monomial(('+', 4, 1)), 00103 Monomial(('+', 2, 0)) 00104 ]), 00105 Polynomial([Monomial(('-', 3, 0)), 00106 Monomial(('+', 2, 1)) 00107 ]) 00108 ), 00109 number=1) 00110 00111 eq_difficult2 = Equation((Polynomial([Monomial(('-', 2, 1)), 00112 Monomial(('+', 5, 0)) 00113 ]), 00114 Polynomial([Monomial(('+', 3, 1)), 00115 Monomial(('-', 4, 0)) 00116 ]) 00117 ), 00118 number=1) 00119 00120 eq_difficult3 = Equation((Polynomial([Monomial(('+', 5, 0)), 00121 Monomial(('+', 4, 1)) 00122 ]), 00123 Polynomial([Monomial(('-', 20, 1)), 00124 Monomial(('+', 3, 0)) 00125 ]) 00126 ), 00127 number=1) 00128 # 5-x=5x 00129 eq_difficult4 = Equation((Polynomial([Monomial(('+', 5, 0)), 00130 Monomial(('-', 1, 1)) 00131 ]), 00132 Polynomial([Monomial(('+', 5, 1)) 00133 ]) 00134 ), 00135 number=1) 00136 00137 eq_leading_to_0 = Equation((Polynomial([Monomial(('+', 2, 1)), 00138 Monomial(('+', 1, 0)) 00139 ]), 00140 Item(1) 00141 ), 00142 number=1) 00143 00144 eq_leading_to_0_bis = Equation((Polynomial([Monomial(('+', 1, 1)), 00145 Monomial(('+', 5, 0)) 00146 ]), 00147 Polynomial([Monomial(('+', 1, 1)), 00148 Monomial(('+', 2, 0)) 00149 ]) 00150 ), 00151 number=1) 00152 00153 eq_leading_to_0_ter = Equation((Sum([Monomial(('+', 3, 0)), 00154 Monomial(('+', 10, 1))]), 00155 Monomial(('+', 10, 1)) 00156 )) 00157 00158 eq_impossible = Equation((Item(1), Item(2)), number=1) 00159 00160 # 9x+9(-4-x)=8 00161 eq_impossible_2 = Equation((Sum([Monomial(('+', 9, 1)), 00162 Expandable((Monomial(('+', 9, 0)), 00163 Sum([Monomial(('-', 00164 4, 00165 0)), 00166 Monomial(('-', 00167 1, 00168 1)) 00169 ]) 00170 )) 00171 ]), 00172 Item(8) 00173 ), 00174 number=1 00175 ) 00176 00177 eq_infinity_of_solutions = Equation((Item(2), Item(2)), number=1) 00178 00179 00180 00181 # -(-11x-10)=(-15+12x)-1 00182 eq_with_expd_1 = Equation((Expandable((Item(-1), 00183 Sum([Monomial((-11, 1)), 00184 Item(-10) 00185 ]) 00186 )), 00187 Sum([Expandable((Item(1), 00188 Sum([Item(-15), 00189 Monomial((12, 1)) 00190 ]) 00191 )), 00192 Item(-1) 00193 ]) 00194 ), 00195 number=1) 00196 00197 # -8+9-1 = 10(-2-12x) 00198 eq_with_expd_2 = Equation((Sum([Monomial(('-', 8, 0)), 00199 Monomial(('+', 9, 0)), 00200 Monomial(('-', 1, 0)) 00201 ]), 00202 Expandable((Item(10), 00203 Sum([Item(-2), 00204 Monomial((-12, 1)) 00205 ]) 00206 )) 00207 ), 00208 number=1) 00209 00210 # -x-2x+7=(7x+5) 00211 eq_with_expd_3 = Equation((Sum([Monomial(('-', 1, 1)), 00212 Monomial(('-', 2, 1)), 00213 Monomial(('+', 7, 0)) 00214 ]), 00215 Expandable((Item(1), 00216 Sum([Monomial(('+', 7, 1)), 00217 Monomial(('+', 5, 0)) 00218 ]) 00219 )) 00220 ), 00221 number=1) 00222 00223 # 5x=(2-5x)-2 00224 eq_with_expd_4 = Equation((Sum([Monomial(('+', 5, 1)) 00225 ]), 00226 Sum([ 00227 Expandable((Item(1), 00228 Sum([Monomial(('+', 2, 0)), 00229 Monomial(('-', 5, 1)) 00230 ]) 00231 )), 00232 Monomial(('-', 2, 0)) 00233 ]) 00234 ), 00235 number=1) 00236 00237 00238 # - 1 - 4x = -9 00239 eq_buggy = Equation((Sum([Monomial(('-', 1, 0)), Monomial(('-', 4, 1))]), 00240 Monomial(('-', 9, 0)) 00241 )) 00242 00243 00244 # 3(-9+6x)-8=9 00245 eq_with_expd_5 = Equation((Sum([Expandable((Item(3), 00246 Sum([Monomial(('-', 9, 0)), 00247 Monomial(('+', 6, 1)) 00248 ]) 00249 )), 00250 Item(-8) 00251 ]), 00252 (Sum([Item(9) 00253 ]) 00254 )), 00255 number=1) 00256 00257 # 5=(x-2)+7 00258 eq_with_expd_6 = Equation((Item(5), 00259 Sum([Expandable((Item(1), 00260 Sum([Monomial(('+', 1, 1)), 00261 Monomial(('-', 2, 0))]) 00262 )), 00263 Item(7) 00264 ]) 00265 ), 00266 number=1) 00267 00268 # x = 4² + 5² 00269 eq_with_exponents_1 = Equation((Monomial(('+', 1, 1)), 00270 Sum([Item(('+', 4, 2)), 00271 Item(('+', 5, 2))]) 00272 ), 00273 number=1 00274 ) 00275 00276 # 5² = 4² + x 00277 eq_with_exponents_2 = Equation((Item(('+', 5, 2)), 00278 Sum([Item(('+', 4, 2)), 00279 Monomial(('+', 1, 1))]) 00280 ), 00281 number=1 00282 ) 00283 00284 # 2x = 1 (to test with option decimal_result=1) 00285 eq_with_decimal_result_01 = Equation((Monomial(('+', 2, 1)), 00286 Item(1) 00287 ), 00288 number=1 00289 ) 00290 00291 # 3x = 1 (to test with option decimal_result=2) 00292 eq_with_decimal_result_02 = Equation((Monomial(('+', 3, 1)), 00293 Item(1) 00294 ), 00295 number=1 00296 ) 00297 00298 # 8x = 6 (to test with option decimal_result=2) 00299 eq_with_decimal_result_03 = Equation((Monomial(('+', 8, 1)), 00300 Item(6) 00301 ), 00302 number=1 00303 ) 00304 00305 # x = 4² + 5² (to test *with* the option decimal_result=2) 00306 eq_with_decimal_result_04 = eq_with_exponents_1 00307 00308 # x = 1/4 + 1/8 (to test with/without option decimal_result=2) 00309 eq_with_decimal_result_05 = Equation((Monomial(('+', 1, 1)), 00310 Sum([Fraction((Item(1), Item(4))), 00311 Fraction((Item(1), Item(8))) 00312 ]) 00313 ), 00314 number=1 00315 ) 00316 00317 # AB = 3² + 4² (to test with/without option decimal_result=0 / 1) 00318 eq_with_different_variable_letter = Equation((Item("AB"), 00319 Sum([Item(('+', 3, 2)), 00320 Item(('+', 4, 2))]) 00321 ), 00322 number=1, 00323 variable_letter_name="AB") 00324 00325 # x = sqrt{5} 00326 eq_with_sqrt5 = Equation((Monomial(('+', 1, 1)), 00327 SquareRoot(Item(5)))) 00328 00329 # x = sqrt{16} 00330 eq_with_sqrt16 = Equation((Monomial(('+', 1, 1)), 00331 SquareRoot(Item(16)))) 00332 00333 # x² = 16 00334 eq_with_xsquare_equal_to_16 = Equation((Monomial(('+', 1, 2)), 00335 (Item(16)) 00336 )) 00337 00338 # x² = 5 00339 eq_with_xsquare_equal_to_5 = Equation((Monomial(('+', 1, 2)), 00340 (Item(5)) 00341 )) 00342 00343 # 73² = 48² + AB² 00344 pythagorean_1 = Equation((Item(('+', 73, 2)), 00345 Sum([Item(('+', 48, 2)), 00346 Item(('+', "AB", 2))]) 00347 ), 00348 number=1, 00349 variable_letter_name="AB") 00350 00351 # EF² = 60² + 91² 00352 pythagorean_2 = Equation((Item(('+', "EF", 2)), 00353 Sum([Item(('+', 60, 2)), 00354 Item(('+', 91, 2))]) 00355 ), 00356 number=1, 00357 variable_letter_name="AB") 00358 00359 # 2/3 x = 4/5 00360 with_fractions = Equation((Monomial((Fraction((Item(2), Item(3))), 1)), 00361 Fraction((Item(4), Item(5))) 00362 )) 00363 00364 # 1/4 x + 1/7 = - 3/14 00365 with_fractions2 = Equation((Sum([Monomial((Fraction((Item(1), Item(4))), 00366 1 00367 )), 00368 Fraction((Item(1), Item(7))) 00369 ]), 00370 Fraction(('-', Item(3), Item(14))) 00371 )) 00372 00373 # 2 x - 1/5 = 4/5 00374 with_fractions3 = Equation((Sum([Monomial((Fraction((Item(2), Item(1))\ 00375 ).simplified(), 00376 1 00377 )), 00378 Fraction((Item(1), Item(5))) 00379 ]), 00380 Fraction(('-', Item(4), Item(5))) 00381 )) 00382 00383 00384 00385 # ------------------------------------------------------------------------------- 00386 # ------------------------------------------------------------------------------- 00387 # ------------------------------------------------------------------------------- 00388 # ------------------------------------------------------------------------------- 00389 # ------------------------------------------------------------------------------- 00390 # ------------------------------------------------------------------------------- 00391 00392 00393 # 01 00394 check(eq_basic1.auto_resolution(), 00395 [ "$(E_{1}): $" \ 00396 + "\[x+7=3\]" \ 00397 + "\[x=3-7\]" \ 00398 + "\[x=-4\]" ]) 00399 00400 # 02 00401 check(eq_basic2.auto_resolution(), 00402 [ "$(E_{1}): $" \ 00403 + "\[-8+x=-2\]" \ 00404 + "\[x=-2+8\]" \ 00405 + "\[x=6\]" ]) 00406 00407 # 03 00408 check(eq_basic_r1.auto_resolution(), 00409 [ "$(E_{1}): $" \ 00410 + "\[-5=x+3\]" \ 00411 + "\[x=-5-3\]" \ 00412 + "\[x=-8\]" ]) 00413 00414 # 04 00415 check(eq_basic_r2.auto_resolution(), 00416 [ "$(E_{1}): $" \ 00417 + "\[-6=5x\]" \ 00418 + "\[x=-\\frac{6}{5}\]"]) 00419 00420 00421 check(eq_basic3.auto_resolution(), 00422 [ "$(E_{1}): $" \ 00423 + "\[8x=1\]" \ 00424 + "\[x=\\frac{1}{8}\]"]) 00425 00426 # 06 00427 check(eq_basic4.auto_resolution(), 00428 [ "$(E_{1}): $" \ 00429 + "\[12x=8\]" \ 00430 + "\[x=\\frac{8}{12}\]" \ 00431 + "\[x=\\frac{\\bcancel{4}\\times 2}{\\bcancel{4}\\times 3}\]" \ 00432 + "\[x=\\frac{2}{3}\]" ]) 00433 00434 00435 check(eq_standard1.auto_resolution(), 00436 [ "$(E_{1}): $" \ 00437 + "\[2x+3=8\]" \ 00438 + "\[2x=8-3\]" \ 00439 + "\[2x=5\]" \ 00440 + "\[x=\\frac{5}{2}\]"]) 00441 00442 # 08 00443 check(eq_standard2.auto_resolution(), 00444 [ "$(E_{1}): $" \ 00445 + "\[19+3x=2x\]" \ 00446 + "\[3x-2x=-19\]" \ 00447 + "\[(3-2)x=-19\]" \ 00448 + "\[x=-19\]"]) 00449 00450 check(eq_difficult1.auto_resolution(), 00451 [ "$(E_{1}): $" \ 00452 + "\[4x+2=-3+2x\]" \ 00453 + "\[4x-2x=-3-2\]" \ 00454 + "\[(4-2)x=-5\]" \ 00455 + "\[2x=-5\]" \ 00456 + "\[x=-\\frac{5}{2}\]"]) 00457 00458 # 10 00459 check(eq_leading_to_0.auto_resolution(), 00460 [ "$(E_{1}): $" \ 00461 + "\[2x+1=1\]" \ 00462 + "\[2x=1-1\]" \ 00463 + "\[2x=0\]" \ 00464 + "\[x=0\]" ]) 00465 00466 00467 check(eq_impossible.auto_resolution(), 00468 [ "$(E_{1}): $" \ 00469 + "\[1=2\]" \ 00470 + "This equation has no solution.\\newline "]) 00471 00472 00473 # 12 00474 check(eq_impossible_2.auto_resolution(), 00475 [ "$(E_{1}): $" \ 00476 + "\[9x+9(-4-x)=8\]" \ 00477 + "\[9x+9\\times (-4)+9\\times (-x)=8\]" \ 00478 + "\[9x-36-9x=8\]" \ 00479 + "\[(9-9)x-36=8\]" \ 00480 + "\[0x-36=8\]" \ 00481 + "\[-36=8\]" \ 00482 + "This equation has no solution.\\newline "]) 00483 00484 check(eq_leading_to_0_bis.auto_resolution(), 00485 [ "$(E_{1}): $" \ 00486 + "\[x+5=x+2\]" \ 00487 + "\[x-x=2-5\]" \ 00488 + "\[(1-1)x=-3\]" \ 00489 + "\[0x=-3\]" \ 00490 + "\[0=-3\]" \ 00491 + "This equation has no solution.\\newline "]) 00492 00493 00494 # 14 00495 check(eq_leading_to_0_ter.auto_resolution(), 00496 [ "$(E): $" \ 00497 + "\[3+10x=10x\]" \ 00498 + "\[10x-10x=-3\]" \ 00499 + "\[(10-10)x=-3\]" \ 00500 + "\[0x=-3\]" \ 00501 + "\[0=-3\]" \ 00502 + "This equation has no solution.\\newline "]) 00503 00504 00505 # 15 00506 eq_infinity_of_solutions 00507 check(eq_infinity_of_solutions, 00508 ["2=2"]) 00509 00510 eq_infinity_of_solutions_letter = eq_infinity_of_solutions.variable_letter 00511 00512 # 16 00513 eq_infinity_of_solutions = eq_infinity_of_solutions.solve_next_step() 00514 check(eq_infinity_of_solutions, 00515 [_("Any value of") + " " \ 00516 + eq_infinity_of_solutions_letter \ 00517 + " " + _("is solution of the equation.")]) 00518 00519 # 17 00520 check(eq_difficult2.auto_resolution(), 00521 [ "$(E_{1}): $" \ 00522 + "\[-2x+5=3x-4\]" \ 00523 + "\[-2x-3x=-4-5\]" \ 00524 + "\[(-2-3)x=-9\]" \ 00525 + "\[-5x=-9\]" \ 00526 + "\[x=\\frac{-9}{-5}\]" \ 00527 + "\[x=\\frac{9}{5}\]"]) 00528 00529 check(eq_difficult3.auto_resolution(), 00530 [ "$(E_{1}): $" \ 00531 + "\[5+4x=-20x+3\]" \ 00532 + "\[4x+20x=3-5\]" \ 00533 + "\[(4+20)x=-2\]" \ 00534 + "\[24x=-2\]" \ 00535 + "\[x=-\\frac{2}{24}\]" \ 00536 + "\[x=-\\frac{\\bcancel{2}}{\\bcancel{2}\\times 12}\]" \ 00537 + "\[x=-\\frac{1}{12}\]"]) 00538 00539 # 19 00540 check(eq_difficult4.auto_resolution(), 00541 [ "$(E_{1}): $" \ 00542 + "\[5-x=5x\]" \ 00543 + "\[-x-5x=-5\]" \ 00544 + "\[(-1-5)x=-5\]" \ 00545 + "\[-6x=-5\]" \ 00546 + "\[x=\\frac{-5}{-6}\]"\ 00547 + "\[x=\\frac{5}{6}\]"]) 00548 00549 00550 check(eq_with_expd_1.auto_resolution(), 00551 [ "$(E_{1}): $" \ 00552 + "\[-(-11x-10)=(-15+12x)-1\]" \ 00553 + "\[11x+10=-15+12x-1\]" \ 00554 + "\[11x+10=-15-1+12x\]" \ 00555 + "\[11x+10=-16+12x\]" \ 00556 + "\[11x-12x=-16-10\]" \ 00557 + "\[(11-12)x=-26\]" \ 00558 + "\[-x=-26\]" \ 00559 + "\[x=26\]" ]) 00560 00561 # 21 00562 check(eq_with_expd_2.auto_resolution(), 00563 [ "$(E_{1}): $" \ 00564 + "\[-8+9-1=10(-2-12x)\]" \ 00565 + "\[0=10\\times (-2)+10\\times (-12x)\]" \ 00566 + "\[0=-20-120x\]" \ 00567 + "\[120x=-20\]" \ 00568 + "\[x=-\\frac{20}{120}\]" \ 00569 + "\[x=-\\frac{\\bcancel{10}\\times 2}{\\bcancel{10}\\times 12}\]" \ 00570 + "\[x=-\\frac{\\bcancel{2}}{\\bcancel{2}\\times 6}\]" \ 00571 + "\[x=-\\frac{1}{6}\]"]) 00572 00573 check(eq_with_expd_3.auto_resolution(), 00574 [ "$(E_{1}): $" \ 00575 + "\[-x-2x+7=(7x+5)\]" \ 00576 + "\[(-1-2)x+7=7x+5\]" \ 00577 + "\[-3x+7=7x+5\]" \ 00578 + "\[-3x-7x=5-7\]" \ 00579 + "\[(-3-7)x=-2\]" \ 00580 + "\[-10x=-2\]" \ 00581 + "\[x=\\frac{-2}{-10}\]" \ 00582 + "\[x=\\frac{+\\bcancel{2}}{+\\bcancel{2}\\times 5}\]" \ 00583 + "\[x=\\frac{1}{5}\]" ]) 00584 00585 # 23 00586 check(eq_with_expd_4.auto_resolution(), 00587 [ "$(E_{1}): $" \ 00588 + "\[5x=(2-5x)-2\]" \ 00589 + "\[5x=2-5x-2\]" \ 00590 + "\[5x=2-2-5x\]" \ 00591 + "\[5x=-5x\]" \ 00592 + "\[5x+5x=0\]" \ 00593 + "\[(5+5)x=0\]" \ 00594 + "\[10x=0\]" \ 00595 + "\[x=0\]" ]) 00596 00597 # 24 00598 check(eq_buggy.auto_resolution(), 00599 [ "$(E): $" \ 00600 + "\[-1-4x=-9\]" \ 00601 + "\[-4x=-9+1\]" \ 00602 + "\[-4x=-8\]" \ 00603 + "\[x=\\frac{-8}{-4}\]" \ 00604 + "\[x=\\frac{+\\bcancel{4}\\times 2}{+\\bcancel{4}}\]" \ 00605 + "\[x=2\]"]) 00606 00607 00608 check(eq_with_expd_5.auto_resolution(), 00609 [ "$(E_{1}): $" \ 00610 + "\[3(-9+6x)-8=9\]" \ 00611 + "\[3\\times (-9)+3\\times 6x-8=9\]" \ 00612 + "\[-27+18x-8=9\]" \ 00613 + "\[-27-8+18x=9\]" \ 00614 + "\[-35+18x=9\]" \ 00615 + "\[18x=9+35\]" \ 00616 + "\[18x=44\]" \ 00617 + "\[x=\\frac{44}{18}\]" \ 00618 + "\[x=\\frac{\\bcancel{2}\\times 22}{\\bcancel{2}\\times 9}\]" \ 00619 + "\[x=\\frac{22}{9}\]" ]) 00620 00621 # 26 00622 check(eq_with_exponents_1.auto_resolution(), 00623 [ "$(E_{1}): $" \ 00624 + "\[x=4^{2}+5^{2}\]" \ 00625 + "\[x=16+25\]" \ 00626 + "\[x=41\]" ]) 00627 00628 00629 check(eq_with_exponents_2.auto_resolution(dont_display_equations_name=True), 00630 [ "\[5^{2}=4^{2}+x\]" \ 00631 + "\[25=16+x\]" \ 00632 + "\[x=25-16\]" \ 00633 + "\[x=9\]" ]) 00634 00635 # 28 00636 check(eq_with_expd_6.auto_resolution(), 00637 [ "$(E_{1}): $" \ 00638 + "\[5=(x-2)+7\]" \ 00639 + "\[5=x-2+7\]" \ 00640 + "\[5=x+5\]" \ 00641 + "\[x=5-5\]" \ 00642 + "\[x=0\]"]) 00643 00644 00645 check(eq_with_decimal_result_01.auto_resolution(decimal_result=1), 00646 [ "$(E_{1}): $" \ 00647 + "\[2x=1\]" \ 00648 + "\[x=\\frac{1}{2}\]" \ 00649 + "\[x=" + locale.str(0.5) + "\]"]) 00650 00651 00652 # 30 00653 check(eq_with_decimal_result_02.auto_resolution(decimal_result=2), 00654 [ "$(E_{1}): $" \ 00655 + "\[3x=1\]" \ 00656 + "\[x=\\frac{1}{3}\]" \ 00657 + "\[x\\simeq" + locale.str(0.33) + "\]"]) 00658 00659 check(eq_with_decimal_result_03.auto_resolution(decimal_result=2), 00660 [ "$(E_{1}): $" \ 00661 + "\[8x=6\]" \ 00662 + "\[x=\\frac{6}{8}\]" \ 00663 + "\[x=" + locale.str(0.75) + "\]"]) 00664 00665 00666 check(eq_with_decimal_result_04.auto_resolution(decimal_result=2), 00667 [ "$(E_{1}): $" \ 00668 + "\[x=4^{2}+5^{2}\]" \ 00669 + "\[x=16+25\]" \ 00670 + "\[x=41\]" ]) 00671 00672 # 33 00673 check(eq_with_decimal_result_05.auto_resolution(decimal_result=2), 00674 [ "$(E_{1}): $" \ 00675 + "\[x=\\frac{1}{4}+\\frac{1}{8}\]" \ 00676 + "\[x=\\frac{1\\times 2}{4\\times 2}+\\frac{1}{8}\]" \ 00677 + "\[x=\\frac{2}{8}+\\frac{1}{8}\]" \ 00678 + "\[x=\\frac{2+1}{8}\]" \ 00679 + "\[x=\\frac{3}{8}\]" \ 00680 + "\[x\\simeq" + locale.str(0.38) + "\]"]) 00681 00682 check(eq_with_different_variable_letter.auto_resolution( 00683 dont_display_equations_name=True, 00684 decimal_result=0), 00685 [ "\[\\text{AB}=3^{2}+4^{2}\]" \ 00686 + "\[\\text{AB}=9+16\]" \ 00687 + "\[\\text{AB}=25\]" ]) 00688 00689 # 35 00690 check(eq_with_different_variable_letter.auto_resolution( 00691 dont_display_equations_name=True, 00692 decimal_result=1), 00693 [ "\[\\text{AB}=3^{2}+4^{2}\]" \ 00694 + "\[\\text{AB}=9+16\]" \ 00695 + "\[\\text{AB}=25\]" ]) 00696 00697 00698 check(eq_with_sqrt5.auto_resolution(dont_display_equations_name=True, 00699 decimal_result=2), 00700 [ "\[x=\\sqrt{5}\]" \ 00701 + "\[x\\simeq" + locale.str(2.24) + "\]" ]) 00702 00703 00704 check(eq_with_sqrt16.auto_resolution(dont_display_equations_name=True, 00705 decimal_result=2), 00706 [ "\[x=\\sqrt{16}\]" \ 00707 + "\[x=4\]" ]) 00708 00709 # 38 00710 check(eq_with_xsquare_equal_to_16.auto_resolution( 00711 dont_display_equations_name=True), 00712 [ "\[x^{2}=16\]" \ 00713 + "\[x=\\sqrt{16} or x=-\\sqrt{16}\]" \ 00714 + "\[x=4 or x=-4\]" ]) 00715 00716 check(eq_with_xsquare_equal_to_16.auto_resolution( 00717 dont_display_equations_name=True, 00718 decimal_result=2), 00719 [ "\[x^{2}=16\]" \ 00720 + "\[x=\\sqrt{16} or x=-\\sqrt{16}\]" \ 00721 + "\[x=4 or x=-4\]" ]) 00722 00723 check(eq_with_xsquare_equal_to_5.auto_resolution( 00724 dont_display_equations_name=True), 00725 [ "\[x^{2}=5\]" \ 00726 + "\[x=\\sqrt{5} or x=-\\sqrt{5}\]"]) 00727 00728 # 41 00729 check(eq_with_xsquare_equal_to_5.auto_resolution( 00730 dont_display_equations_name=True, 00731 decimal_result=2), 00732 [ "\[x^{2}=5\]" \ 00733 + "\[x=\\sqrt{5} or x=-\\sqrt{5}\]" \ 00734 + "\[x\\simeq" + locale.str(2.24) \ 00735 + " or " \ 00736 + "x\\simeq-" + locale.str(2.24)+ "\]" ]) 00737 00738 check(eq_with_xsquare_equal_to_5.auto_resolution( 00739 dont_display_equations_name=True, 00740 decimal_result=2, 00741 pythagorean_mode='yes'), 00742 [ "\[x^{2}=5\]" \ 00743 + "\[x=\\sqrt{5}\\text{ because x is positive.}\]" \ 00744 + "\[x\\simeq" + locale.str(2.24) + "\]" ]) 00745 00746 # 43 00747 check(pythagorean_1.auto_resolution(dont_display_equations_name=True, 00748 decimal_result=2, 00749 pythagorean_mode='yes'), 00750 [ "\[73^{2}=48^{2}+\\text{AB}^{2}\]" \ 00751 + "\[5329=2304+\\text{AB}^{2}\]" \ 00752 + "\[\\text{AB}^{2}=5329-2304\]" \ 00753 + "\[\\text{AB}^{2}=3025\]" \ 00754 + "\[\\text{AB}=\\sqrt{3025}" \ 00755 + "\\text{ because \\text{AB} is positive.}\]" \ 00756 + "\[\\text{AB}=55\]" ]) 00757 00758 # 44 00759 check(pythagorean_2.auto_resolution(dont_display_equations_name=True, 00760 pythagorean_mode='yes', 00761 unit='cm'), 00762 [ "\[\\text{EF}^{2}=60^{2}+91^{2}\]" \ 00763 + "\[\\text{EF}^{2}=3600+8281\]" \ 00764 + "\[\\text{EF}^{2}=11881\]" 00765 + "\[\\text{EF}=\\sqrt{11881}" \ 00766 + "\\text{ because \\text{EF} is positive.}\]" \ 00767 + "\[\\text{EF}=109\\text{ cm}\]" ]) 00768 00769 #45 00770 check(with_fractions.auto_resolution(dont_display_equations_name=True), 00771 [ "\[\\frac{2}{3}x=\\frac{4}{5}\]" \ 00772 + "\[x=\\frac{4}{5}\div \\frac{2}{3}\]" \ 00773 + "\[x=\\frac{4}{5}\\times \\frac{3}{2}\]" \ 00774 + "\[x=\\frac{4\\times 3}{5\\times 2}\]" \ 00775 + "\[x=\\frac{\\bcancel{2}\\times 2\\times 3}" \ 00776 + "{5\\times \\bcancel{2}}\]"\ 00777 + "\[x=\\frac{6}{5}\]"]) 00778 00779 00780 check(with_fractions2.auto_resolution(dont_display_equations_name=True), 00781 [ "\[\\frac{1}{4}x+\\frac{1}{7}=-\\frac{3}{14}\]" \ 00782 + "\[\\frac{1}{4}x=-\\frac{3}{14}-\\frac{1}{7}\]" \ 00783 + "\[\\frac{1}{4}x=-\\frac{3}{14}-\\frac{1\\times 2}{7\\times 2}\]"\ 00784 + "\[\\frac{1}{4}x=-\\frac{3}{14}-\\frac{2}{14}\]"\ 00785 + "\[\\frac{1}{4}x=\\frac{-3-2}{14}\]"\ 00786 + "\[\\frac{1}{4}x=-\\frac{5}{14}\]" \ 00787 + "\[x=-\\frac{5}{14}\div \\frac{1}{4}\]"\ 00788 + "\[x=-\\frac{5}{14}\\times \\frac{4}{1}\]"\ 00789 + "\[x=-\\frac{5\\times 4}{14\\times 1}\]"\ 00790 + "\[x=-\\frac{5\\times \\bcancel{2}\\times 2}"\ 00791 + "{\\bcancel{2}\\times 7}\]"\ 00792 + "\[x=-\\frac{10}{7}\]"]) 00793 00794 check(with_fractions3.auto_resolution(dont_display_equations_name=True), 00795 [ "\[2x+\\frac{1}{5}=-\\frac{4}{5}\]" \ 00796 + "\[2x=-\\frac{4}{5}-\\frac{1}{5}\]" \ 00797 + "\[2x=\\frac{-4-1}{5}\]" \ 00798 + "\[2x=-\\frac{5}{5}\]" \ 00799 + "\[2x=-\\frac{\\bcancel{5}}{\\bcancel{5}}\]" \ 00800 + "\[2x=-1\]" \ 00801 + "\[x=-\\frac{1}{2}\]"]) 00802 00803