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 00026 from core import * 00027 from core.base_calculus import * 00028 00029 from maintenance.autotest import common 00030 00031 check = common.check 00032 00033 00034 def action(): 00035 if common.verbose: 00036 os.write(common.output, bytes("--- MONOMIALS\n", 'utf-8')) 00037 00038 monom_6 = Monomial(('+', 6, 0)) 00039 monom_6_ones_away = monom_6.throw_away_the_neutrals() 00040 00041 monom_1 = Monomial((1, 0)) 00042 00043 square_monom_3x = Monomial(('+', 3, 1)) 00044 square_monom_3x.set_exponent(2) 00045 00046 square_monom_5 = Monomial(('+', 5, 0)) 00047 square_monom_5.set_exponent(2) 00048 00049 check(monom_6_ones_away, 00050 ["6"]) 00051 00052 check(monom_1.is_displ_as_a_single_neutral(Item(0)), 00053 ["False"]) 00054 00055 check(square_monom_3x, 00056 ["(3x)^{2}"]) 00057 00058 check(square_monom_5, 00059 ["5^{2}"]) 00060 00061 00062 00063 00064 00065