diff --git a/.gitignore b/.gitignore index bb46e29..46b7a81 100644 --- a/.gitignore +++ b/.gitignore @@ -141,3 +141,6 @@ cython_debug/ .vscode/ test.py + +# Vim backup files +*.swp diff --git a/.test.py.swp b/.test.py.swp deleted file mode 100644 index 78ed555..0000000 Binary files a/.test.py.swp and /dev/null differ diff --git a/docs/mathgenerator.html b/docs/mathgenerator.html index bf8f4cd..df2dd86 100644 --- a/docs/mathgenerator.html +++ b/docs/mathgenerator.html @@ -99,7 +99,8 @@ mathgenerator

mathgenerator

-

Fork of https://github.com/lukew3/mathgenerator

+

Fork of https://github.com/lukew3/mathgenerator
+Adding more Physics and Computer Science questions

A math problem generator, created for the purpose of giving teachers and students the means to easily get access to random math exercises to suit their needs.

diff --git a/docs/mathgenerator/_gen_list.html b/docs/mathgenerator/_gen_list.html index 5495da9..86f3b72 100644 --- a/docs/mathgenerator/_gen_list.html +++ b/docs/mathgenerator/_gen_list.html @@ -212,7 +212,8 @@ 134 ("velocity_of_object", "misc"), 135 ("binary_addition", "computer_science"), 136 ("kinetic_energy", "physics"), -137] +137 ("potential_dividers", "physics"), +138]
@@ -221,7 +222,7 @@
gen_list = - [('addition', 'basic_math'), ('subtraction', 'basic_math'), ('multiplication', 'basic_math'), ('division', 'basic_math'), ('binary_complement_1s', 'computer_science'), ('modulo_division', 'computer_science'), ('square_root', 'basic_math'), ('power_rule_differentiation', 'calculus'), ('square', 'basic_math'), ('lcm', 'misc'), ('DELETED', 'DELETED'), ('basic_algebra', 'algebra'), ('log', 'algebra'), ('fraction_to_decimal', 'basic_math'), ('decimal_to_binary', 'computer_science'), ('binary_to_decimal', 'computer_science'), ('divide_fractions', 'basic_math'), ('multiply_int_to_22_matrix', 'algebra'), ('area_of_triangle', 'geometry'), ('valid_triangle', 'geometry'), ('midpoint_of_two_points', 'algebra'), ('factoring', 'algebra'), ('third_angle_of_triangle', 'geometry'), ('system_of_equations', 'algebra'), ('distance_two_points', 'algebra'), ('pythagorean_theorem', 'geometry'), ('linear_equations', 'algebra'), ('prime_factors', 'misc'), ('fraction_multiplication', 'basic_math'), ('angle_regular_polygon', 'geometry'), ('combinations', 'statistics'), ('factorial', 'basic_math'), ('surface_area_cube', 'geometry'), ('surface_area_cuboid', 'geometry'), ('surface_area_cylinder', 'geometry'), ('volume_cube', 'geometry'), ('volume_cuboid', 'geometry'), ('volume_cylinder', 'geometry'), ('surface_area_cone', 'geometry'), ('volume_cone', 'geometry'), ('common_factors', 'misc'), ('intersection_of_two_lines', 'algebra'), ('permutation', 'statistics'), ('vector_cross', 'algebra'), ('compare_fractions', 'basic_math'), ('simple_interest', 'algebra'), ('matrix_multiplication', 'algebra'), ('cube_root', 'basic_math'), ('power_rule_integration', 'calculus'), ('fourth_angle_of_quadrilateral', 'geometry'), ('quadratic_equation', 'algebra'), ('DELETED', 'DELETED'), ('dice_sum_probability', 'statistics'), ('exponentiation', 'basic_math'), ('confidence_interval', 'statistics'), ('surds_comparison', 'misc'), ('fibonacci_series', 'computer_science'), ('basic_trigonometry', 'geometry'), ('sum_of_polygon_angles', 'geometry'), ('data_summary', 'statistics'), ('surface_area_sphere', 'geometry'), ('volume_sphere', 'geometry'), ('nth_fibonacci_number', 'computer_science'), ('profit_loss_percent', 'misc'), ('binary_to_hex', 'computer_science'), ('multiply_complex_numbers', 'algebra'), ('geometric_progression', 'misc'), ('geometric_mean', 'misc'), ('harmonic_mean', 'misc'), ('euclidian_norm', 'misc'), ('angle_btw_vectors', 'geometry'), ('absolute_difference', 'basic_math'), ('vector_dot', 'algebra'), ('binary_2s_complement', 'computer_science'), ('invert_matrix', 'algebra'), ('sector_area', 'geometry'), ('mean_median', 'statistics'), ('int_matrix_22_determinant', 'algebra'), ('compound_interest', 'algebra'), ('decimal_to_hexadeci', 'computer_science'), ('percentage', 'basic_math'), ('celsius_to_fahrenheit', 'misc'), ('arithmetic_progression_term', 'misc'), ('arithmetic_progression_sum', 'misc'), ('decimal_to_octal', 'computer_science'), ('decimal_to_roman_numerals', 'misc'), ('degree_to_rad', 'geometry'), ('radian_to_deg', 'geometry'), ('trig_differentiation', 'calculus'), ('definite_integral', 'calculus'), ('is_prime', 'basic_math'), ('bcd_to_decimal', 'computer_science'), ('complex_to_polar', 'misc'), ('set_operation', 'misc'), ('base_conversion', 'misc'), ('curved_surface_area_cylinder', 'geometry'), ('perimeter_of_polygons', 'geometry'), ('power_of_powers', 'basic_math'), ('quotient_of_power_same_base', 'misc'), ('quotient_of_power_same_power', 'misc'), ('complex_quadratic', 'algebra'), ('is_leap_year', 'misc'), ('minutes_to_hours', 'misc'), ('decimal_to_bcd', 'computer_science'), ('circumference', 'geometry'), ('combine_like_terms', 'algebra'), ('signum_function', 'misc'), ('conditional_probability', 'statistics'), ('arc_length', 'geometry'), ('binomial_distribution', 'misc'), ('stationary_points', 'calculus'), ('expanding', 'algebra'), ('area_of_circle', 'geometry'), ('volume_cone_frustum', 'geometry'), ('equation_of_line_from_two_points', 'geometry'), ('area_of_circle_given_center_and_point', 'geometry'), ('factors', 'misc'), ('volume_hemisphere', 'geometry'), ('percentage_difference', 'basic_math'), ('percentage_error', 'basic_math'), ('greatest_common_divisor', 'basic_math'), ('product_of_scientific_notations', 'misc'), ('volume_pyramid', 'geometry'), ('surface_area_pyramid', 'geometry'), ('is_composite', 'basic_math'), ('complementary_and_supplementary_angle', 'geometry'), ('simplify_square_root', 'basic_math'), ('line_equation_from_2_points', 'algebra'), ('orthogonal_projection', 'algebra'), ('area_of_trapezoid', 'geometry'), ('tribonacci_series', 'computer_science'), ('nth_tribonacci_number', 'computer_science'), ('velocity_of_object', 'misc'), ('binary_addition', 'computer_science'), ('kinetic_energy', 'physics')] + [('addition', 'basic_math'), ('subtraction', 'basic_math'), ('multiplication', 'basic_math'), ('division', 'basic_math'), ('binary_complement_1s', 'computer_science'), ('modulo_division', 'computer_science'), ('square_root', 'basic_math'), ('power_rule_differentiation', 'calculus'), ('square', 'basic_math'), ('lcm', 'misc'), ('DELETED', 'DELETED'), ('basic_algebra', 'algebra'), ('log', 'algebra'), ('fraction_to_decimal', 'basic_math'), ('decimal_to_binary', 'computer_science'), ('binary_to_decimal', 'computer_science'), ('divide_fractions', 'basic_math'), ('multiply_int_to_22_matrix', 'algebra'), ('area_of_triangle', 'geometry'), ('valid_triangle', 'geometry'), ('midpoint_of_two_points', 'algebra'), ('factoring', 'algebra'), ('third_angle_of_triangle', 'geometry'), ('system_of_equations', 'algebra'), ('distance_two_points', 'algebra'), ('pythagorean_theorem', 'geometry'), ('linear_equations', 'algebra'), ('prime_factors', 'misc'), ('fraction_multiplication', 'basic_math'), ('angle_regular_polygon', 'geometry'), ('combinations', 'statistics'), ('factorial', 'basic_math'), ('surface_area_cube', 'geometry'), ('surface_area_cuboid', 'geometry'), ('surface_area_cylinder', 'geometry'), ('volume_cube', 'geometry'), ('volume_cuboid', 'geometry'), ('volume_cylinder', 'geometry'), ('surface_area_cone', 'geometry'), ('volume_cone', 'geometry'), ('common_factors', 'misc'), ('intersection_of_two_lines', 'algebra'), ('permutation', 'statistics'), ('vector_cross', 'algebra'), ('compare_fractions', 'basic_math'), ('simple_interest', 'algebra'), ('matrix_multiplication', 'algebra'), ('cube_root', 'basic_math'), ('power_rule_integration', 'calculus'), ('fourth_angle_of_quadrilateral', 'geometry'), ('quadratic_equation', 'algebra'), ('DELETED', 'DELETED'), ('dice_sum_probability', 'statistics'), ('exponentiation', 'basic_math'), ('confidence_interval', 'statistics'), ('surds_comparison', 'misc'), ('fibonacci_series', 'computer_science'), ('basic_trigonometry', 'geometry'), ('sum_of_polygon_angles', 'geometry'), ('data_summary', 'statistics'), ('surface_area_sphere', 'geometry'), ('volume_sphere', 'geometry'), ('nth_fibonacci_number', 'computer_science'), ('profit_loss_percent', 'misc'), ('binary_to_hex', 'computer_science'), ('multiply_complex_numbers', 'algebra'), ('geometric_progression', 'misc'), ('geometric_mean', 'misc'), ('harmonic_mean', 'misc'), ('euclidian_norm', 'misc'), ('angle_btw_vectors', 'geometry'), ('absolute_difference', 'basic_math'), ('vector_dot', 'algebra'), ('binary_2s_complement', 'computer_science'), ('invert_matrix', 'algebra'), ('sector_area', 'geometry'), ('mean_median', 'statistics'), ('int_matrix_22_determinant', 'algebra'), ('compound_interest', 'algebra'), ('decimal_to_hexadeci', 'computer_science'), ('percentage', 'basic_math'), ('celsius_to_fahrenheit', 'misc'), ('arithmetic_progression_term', 'misc'), ('arithmetic_progression_sum', 'misc'), ('decimal_to_octal', 'computer_science'), ('decimal_to_roman_numerals', 'misc'), ('degree_to_rad', 'geometry'), ('radian_to_deg', 'geometry'), ('trig_differentiation', 'calculus'), ('definite_integral', 'calculus'), ('is_prime', 'basic_math'), ('bcd_to_decimal', 'computer_science'), ('complex_to_polar', 'misc'), ('set_operation', 'misc'), ('base_conversion', 'misc'), ('curved_surface_area_cylinder', 'geometry'), ('perimeter_of_polygons', 'geometry'), ('power_of_powers', 'basic_math'), ('quotient_of_power_same_base', 'misc'), ('quotient_of_power_same_power', 'misc'), ('complex_quadratic', 'algebra'), ('is_leap_year', 'misc'), ('minutes_to_hours', 'misc'), ('decimal_to_bcd', 'computer_science'), ('circumference', 'geometry'), ('combine_like_terms', 'algebra'), ('signum_function', 'misc'), ('conditional_probability', 'statistics'), ('arc_length', 'geometry'), ('binomial_distribution', 'misc'), ('stationary_points', 'calculus'), ('expanding', 'algebra'), ('area_of_circle', 'geometry'), ('volume_cone_frustum', 'geometry'), ('equation_of_line_from_two_points', 'geometry'), ('area_of_circle_given_center_and_point', 'geometry'), ('factors', 'misc'), ('volume_hemisphere', 'geometry'), ('percentage_difference', 'basic_math'), ('percentage_error', 'basic_math'), ('greatest_common_divisor', 'basic_math'), ('product_of_scientific_notations', 'misc'), ('volume_pyramid', 'geometry'), ('surface_area_pyramid', 'geometry'), ('is_composite', 'basic_math'), ('complementary_and_supplementary_angle', 'geometry'), ('simplify_square_root', 'basic_math'), ('line_equation_from_2_points', 'algebra'), ('orthogonal_projection', 'algebra'), ('area_of_trapezoid', 'geometry'), ('tribonacci_series', 'computer_science'), ('nth_tribonacci_number', 'computer_science'), ('velocity_of_object', 'misc'), ('binary_addition', 'computer_science'), ('kinetic_energy', 'physics'), ('potential_dividers', 'physics')]
diff --git a/docs/mathgenerator/physics.html b/docs/mathgenerator/physics.html index 67b79b9..f57c212 100644 --- a/docs/mathgenerator/physics.html +++ b/docs/mathgenerator/physics.html @@ -55,6 +55,9 @@
  • kinetic_energy
  • +
  • + potential_dividers +
  • @@ -94,6 +97,30 @@ 16 problem = f"What is the kinetic energy of an object of mass ${mass} kg$ and velocity ${velocity} m/s$?" 17 solution = f'${kinetic_energy} J$' 18 return problem, solution +19 +20def potential_dividers(max_vin=50, max_resistance=500): +21 r"""Potential Divider question using Vout = (Vin * R2) / (R2 + R1) +22 +23 | Ex. Problem | Ex. Solution | +24 | --- | --- | +25 | In a Potential Divider, if resistors R1 and R2 have resistances of $100 Ω$ and $50 Ω$ respectively, and the cell has $12 V$ What is the output potential difference across R2? | $4 V$ | +26 """ +27 ''' +28 This is what a potential divider circuit looks like: +29 ------ +30 | R1 +31 Vi = |----o +32 | R2 Vout +33 |____|____o +34 ''' +35 vin = random.randint(0, max_vin) # Voltage input of cell +36 r1 = random.randint(0, max_resistance) # Resistance of R1 +37 r2 = random.randint(0, max_resistance) # Resistance of R2 +38 vout = round((vin * r2) / (r1 + r2),2) # Voltage output across R2 +39 +40 problem = f"In a Potential Divider, if resistors R1 and R2 have resistances of ${r1} Ω$ and ${r2} Ω$ respectively, and the cell has ${vin} V$ What is the output potential difference across R2?" +41 solution = f"${vout} V$" +42 return problem, solution @@ -146,6 +173,63 @@ + +
    + +
    + + def + potential_dividers(max_vin=50, max_resistance=500): + + + +
    + +
    21def potential_dividers(max_vin=50, max_resistance=500):
    +22   r"""Potential Divider question using Vout = (Vin * R2) / (R2 + R1)
    +23
    +24    | Ex. Problem | Ex. Solution |
    +25    | --- | --- |
    +26    | In a Potential Divider, if resistors R1 and R2 have resistances of $100 Ω$ and $50 Ω$ respectively, and the cell has $12 V$ What is the output potential difference across R2? | $4 V$ |
    +27    """
    +28   '''
    +29    This is what a potential divider circuit looks like:
    +30    ------
    +31    |    R1
    +32 Vi =    |----o
    +33    |    R2      Vout
    +34    |____|____o
    +35    '''
    +36   vin = random.randint(0, max_vin)          # Voltage input of cell
    +37   r1 = random.randint(0, max_resistance)    # Resistance of R1
    +38   r2 = random.randint(0, max_resistance)    # Resistance of R2
    +39   vout = round((vin * r2) / (r1 + r2),2)    # Voltage output across R2
    +40
    +41   problem = f"In a Potential Divider, if resistors R1 and R2 have resistances of ${r1} Ω$ and ${r2} Ω$ respectively, and the cell has ${vin} V$ What is the output potential difference across R2?"
    +42   solution = f"${vout} V$"
    +43   return problem, solution
    +
    + + +

    Potential Divider question using Vout = (Vin * R2) / (R2 + R1)

    + + + + + + + + + + + + + + +
    Ex. ProblemEx. Solution
    In a Potential Divider, if resistors R1 and R2 have resistances of $100 Ω$ and $50 Ω$ respectively, and the cell has $12 V$ What is the output potential difference across R2?$4 V$
    +
    + +