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 ALL_TRIPLES_5_100 = [ \ 00024 [3, 4, 5], 00025 [6, 8, 10], 00026 [5, 12, 13], 00027 [9, 12, 15], 00028 [8, 15, 17], 00029 [12, 16, 20], 00030 [7, 24, 25], 00031 [15, 20, 25], 00032 [10, 24, 26], 00033 [20, 21, 29], 00034 [18, 24, 30], 00035 [16, 30, 34], 00036 [21, 28, 35], 00037 [12, 35, 37], 00038 [15, 36, 39], 00039 [24, 32, 40], 00040 [9, 40, 41], 00041 [27, 36, 45], 00042 [14, 48, 50], 00043 [24, 45, 51], 00044 [20, 48, 52], 00045 [28, 45, 53], 00046 [33, 44, 55], 00047 [40, 42, 58], 00048 [36, 48, 60], 00049 [11, 60, 61], 00050 [16, 63, 65], 00051 [25, 60, 65], 00052 [33, 56, 65], 00053 [39, 52, 65], 00054 [32, 60, 68], 00055 [42, 56, 70], 00056 [48, 55, 73], 00057 [24, 70, 74], 00058 [21, 72, 75], 00059 [45, 60, 75], 00060 [30, 72, 78], 00061 [48, 64, 80], 00062 [18, 80, 82], 00063 [13, 84, 85], 00064 [36, 77, 85], 00065 [40, 75, 85], 00066 [51, 68, 85], 00067 [60, 63, 87], 00068 [39, 80, 89], 00069 [54, 72, 90], 00070 [35, 84, 91], 00071 [57, 76, 95], 00072 [65, 72, 97], 00073 [28, 96, 100] 00074 ] 00075 00076 TRIPLES_101_200_WO_TEN_MULTIPLES = [ \ 00077 [20, 99, 101], 00078 [48, 90, 102], 00079 [40, 96, 104], 00080 [63, 84, 105], 00081 [56, 90, 106], 00082 [60, 91, 109], 00083 [66, 88, 110], 00084 [36, 105, 111], 00085 [15, 112, 113], 00086 [69, 92, 115], 00087 [80, 84, 116], 00088 [45, 108, 117], 00089 [56, 105, 119], 00090 [72, 96, 120], 00091 [22, 120, 122], 00092 [27, 120, 123], 00093 [35, 120, 125], 00094 [44, 117, 125], 00095 [75, 100, 125], 00096 [32, 126, 130], 00097 [66, 112, 130], 00098 [78, 104, 130], 00099 [81, 108, 135], 00100 [64, 120, 136], 00101 [88, 105, 137], 00102 [84, 112, 140], 00103 [55, 132, 143], 00104 [17, 144, 145], 00105 [24, 143, 145], 00106 [87, 116, 145], 00107 [100, 105, 145], 00108 [96, 110, 146], 00109 [48, 140, 148], 00110 [51, 140, 149], 00111 [42, 144, 150], 00112 [72, 135, 153], 00113 [93, 124, 155], 00114 [60, 144, 156], 00115 [85, 132, 157], 00116 [84, 135, 159], 00117 [96, 128, 160], 00118 [36, 160, 164], 00119 [99, 132, 165], 00120 [65, 156, 169], 00121 [119, 120, 169], 00122 [26, 168, 170], 00123 [72, 154, 170], 00124 [102, 136, 170], 00125 [52, 165, 173], 00126 [120, 126, 174], 00127 [49, 168, 175], 00128 [105, 140, 175], 00129 [78, 160, 178], 00130 [108, 144, 180], 00131 [19, 180, 181], 00132 [70, 168, 182], 00133 [33, 180, 183], 00134 [57, 176, 185], 00135 [60, 175, 185], 00136 [104, 153, 185], 00137 [111, 148, 185], 00138 [88, 165, 187], 00139 [114, 152, 190], 00140 [95, 168, 193], 00141 [130, 144, 194], 00142 [48, 189, 195], 00143 [75, 180, 195], 00144 [99, 168, 195], 00145 [117, 156, 195], 00146 [28, 195, 197], 00147 [56, 192, 200], 00148 ] 00149 00150 ALL_TRIPLES_5_200 = [ \ 00151 [3, 4, 5], 00152 [6, 8, 10], 00153 [5, 12, 13], 00154 [9, 12, 15], 00155 [8, 15, 17], 00156 [12, 16, 20], 00157 [7, 24, 25], 00158 [15, 20, 25], 00159 [10, 24, 26], 00160 [20, 21, 29], 00161 [18, 24, 30], 00162 [16, 30, 34], 00163 [21, 28, 35], 00164 [12, 35, 37], 00165 [15, 36, 39], 00166 [24, 32, 40], 00167 [9, 40, 41], 00168 [27, 36, 45], 00169 [14, 48, 50], 00170 [30, 40, 50], 00171 [24, 45, 51], 00172 [20, 48, 52], 00173 [28, 45, 53], 00174 [33, 44, 55], 00175 [40, 42, 58], 00176 [36, 48, 60], 00177 [11, 60, 61], 00178 [16, 63, 65], 00179 [25, 60, 65], 00180 [33, 56, 65], 00181 [39, 52, 65], 00182 [32, 60, 68], 00183 [42, 56, 70], 00184 [48, 55, 73], 00185 [24, 70, 74], 00186 [21, 72, 75], 00187 [45, 60, 75], 00188 [30, 72, 78], 00189 [48, 64, 80], 00190 [18, 80, 82], 00191 [13, 84, 85], 00192 [36, 77, 85], 00193 [40, 75, 85], 00194 [51, 68, 85], 00195 [60, 63, 87], 00196 [39, 80, 89], 00197 [54, 72, 90], 00198 [35, 84, 91], 00199 [57, 76, 95], 00200 [65, 72, 97], 00201 [28, 96, 100], 00202 [60, 80, 100], 00203 [20, 99, 101], 00204 [48, 90, 102], 00205 [40, 96, 104], 00206 [63, 84, 105], 00207 [56, 90, 106], 00208 [60, 91, 109], 00209 [66, 88, 110], 00210 [36, 105, 111], 00211 [15, 112, 113], 00212 [69, 92, 115], 00213 [80, 84, 116], 00214 [45, 108, 117], 00215 [56, 105, 119], 00216 [72, 96, 120], 00217 [22, 120, 122], 00218 [27, 120, 123], 00219 [35, 120, 125], 00220 [44, 117, 125], 00221 [75, 100, 125], 00222 [32, 126, 130], 00223 [50, 120, 130], 00224 [66, 112, 130], 00225 [78, 104, 130], 00226 [81, 108, 135], 00227 [64, 120, 136], 00228 [88, 105, 137], 00229 [84, 112, 140], 00230 [55, 132, 143], 00231 [17, 144, 145], 00232 [24, 143, 145], 00233 [87, 116, 145], 00234 [100, 105, 145], 00235 [96, 110, 146], 00236 [48, 140, 148], 00237 [51, 140, 149], 00238 [42, 144, 150], 00239 [90, 120, 150], 00240 [72, 135, 153], 00241 [93, 124, 155], 00242 [60, 144, 156], 00243 [85, 132, 157], 00244 [84, 135, 159], 00245 [96, 128, 160], 00246 [36, 160, 164], 00247 [99, 132, 165], 00248 [65, 156, 169], 00249 [119, 120, 169], 00250 [26, 168, 170], 00251 [72, 154, 170], 00252 [80, 150, 170], 00253 [102, 136, 170], 00254 [52, 165, 173], 00255 [120, 126, 174], 00256 [49, 168, 175], 00257 [105, 140, 175], 00258 [78, 160, 178], 00259 [108, 144, 180], 00260 [19, 180, 181], 00261 [70, 168, 182], 00262 [33, 180, 183], 00263 [57, 176, 185], 00264 [60, 175, 185], 00265 [104, 153, 185], 00266 [111, 148, 185], 00267 [88, 165, 187], 00268 [114, 152, 190], 00269 [95, 168, 193], 00270 [130, 144, 194], 00271 [48, 189, 195], 00272 [75, 180, 195], 00273 [99, 168, 195], 00274 [117, 156, 195], 00275 [28, 195, 197], 00276 [56, 192, 200], 00277 [120, 160, 200] 00278 ] 00279 00280 00281 00282 00283 00284 # -------------------------------------------------------------------------- 00285 ## 00286 # @brief Will return all [first_leg, second_leg] matching a given hypotenuse 00287 def get_legs_matching_given_hypotenuse(side_length): 00288 if not type(side_length) == int: 00289 raise error.WrongArgument(str(side_length), "int") 00290 00291 result = [] 00292 00293 for elt in ALL_TRIPLES_5_200: 00294 if elt[2] == side_length: 00295 result += [elt[0], elt[1]] 00296 00297 return result 00298 00299 00300 00301 00302 00303 # -------------------------------------------------------------------------- 00304 ## 00305 # @brief Will return all leg values matching a given one 00306 def get_legs_matching_given_leg(side_length): 00307 if not type(side_length) == int: 00308 raise error.WrongArgument(str(side_length), "int") 00309 00310 result = [] 00311 00312 for elt in ALL_TRIPLES_5_200: 00313 if elt[0] == side_length: 00314 result += [elt[1]] 00315 00316 elif elt[1] == side_length: 00317 result += [elt[0]] 00318 00319 return result 00320 00321