From eafd624948bf08036ffcffee003b9e7eb55214b3 Mon Sep 17 00:00:00 2001 From: deadvey Date: Sun, 26 Oct 2025 13:03:03 +0000 Subject: [PATCH] Fixed docs a bit --- docs/mathgenerator/_gen_list.html | 5 +- docs/mathgenerator/physics.html | 76 +++++++++++++++++++++++++++++++ docs/search.js | 2 +- mathgenerator/physics.py | 2 +- 4 files changed, 81 insertions(+), 4 deletions(-) diff --git a/docs/mathgenerator/_gen_list.html b/docs/mathgenerator/_gen_list.html index 86f3b72..1a85f5e 100644 --- a/docs/mathgenerator/_gen_list.html +++ b/docs/mathgenerator/_gen_list.html @@ -213,7 +213,8 @@ 135 ("binary_addition", "computer_science"), 136 ("kinetic_energy", "physics"), 137 ("potential_dividers", "physics"), -138] +138 ("resistivity", "physics"), +139] @@ -222,7 +223,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'), ('potential_dividers', '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'), ('resistivity', 'physics')]
diff --git a/docs/mathgenerator/physics.html b/docs/mathgenerator/physics.html index f57c212..cc6e260 100644 --- a/docs/mathgenerator/physics.html +++ b/docs/mathgenerator/physics.html @@ -58,6 +58,9 @@
  • potential_dividers
  • +
  • + resistivity +
  • @@ -121,6 +124,26 @@ 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 +43 +44def resistivity(max_diameter_mm=5, max_length_cm=100, max_resistance=0.1): +45 r"""Calculate the Resistivity using the equation R = (pL)/A, where R = Resistance, L = length of wire, p = resistivity and A = cross sectional area of wire +46 +47 | Ex. Problem | Ex. Solution | +48 | --- | --- | +49 | A wire has resistance $30 mΩ$ when it is $83.64 cm$ long with a diameter of $4.67 mm$. Calculate the resistivity of the wire | $6.14e-07 Ωm$ | +50 """ +51 # This question requires a lot of unit conversions and calculating the area of a circle from diameter +52 diameter_mm = round(random.uniform(0, max_diameter_mm),2) # Random diameter in mm +53 cross_sectional_area = math.pi * (diameter_mm / 2000)**2 # Calculate the cross sectional area using pi r² +54 length_cm = round(random.uniform(0, max_length_cm),2) # Random wire length in cm +55 resistance = round(random.uniform(0, max_resistance),2) # Random reistance in ohms +56 +57 resistivity = (resistance * cross_sectional_area) / (length_cm / 100) +58 +59 problem = f"A wire has resistance ${resistance*1000} mΩ$ when it is ${length_cm} cm$ long with a diameter of ${diameter_mm} mm$. Calculate the resistivity of the wire" +60 solution = f"${resistivity:.2e} Ωm$" +61 +62 return problem, solution @@ -230,6 +253,59 @@ + +
    + +
    + + def + resistivity(max_diameter_mm=5, max_length_cm=100, max_resistance=0.1): + + + +
    + +
    45def resistivity(max_diameter_mm=5, max_length_cm=100, max_resistance=0.1):
    +46   r"""Calculate the Resistivity using the equation R = (pL)/A, where R = Resistance, L = length of wire, p = resistivity and A = cross sectional area of wire
    +47
    +48    | Ex. Problem | Ex. Solution |
    +49    | --- | --- |
    +50    | A wire has resistance $30 mΩ$ when it is $83.64 cm$ long with a diameter of $4.67 mm$. Calculate the resistivity of the wire | $6.14e-07 Ωm$ |
    +51    """
    +52   # This question requires a lot of unit conversions and calculating the area of a circle from diameter
    +53   diameter_mm = round(random.uniform(0, max_diameter_mm),2)   # Random diameter in mm
    +54   cross_sectional_area = math.pi * (diameter_mm / 2000)**2    # Calculate the cross sectional area using pi r²
    +55   length_cm = round(random.uniform(0, max_length_cm),2)       # Random wire length in cm
    +56   resistance = round(random.uniform(0, max_resistance),2)     # Random reistance in ohms
    +57
    +58   resistivity = (resistance * cross_sectional_area) / (length_cm / 100)
    +59
    +60   problem = f"A wire has resistance ${resistance*1000} mΩ$ when it is ${length_cm} cm$ long with a diameter of ${diameter_mm} mm$. Calculate the resistivity of the wire"
    +61   solution = f"${resistivity:.2e} Ωm$"
    +62
    +63   return problem, solution
    +
    + + +

    Calculate the Resistivity using the equation R = (pL)/A, where R = Resistance, L = length of wire, p = resistivity and A = cross sectional area of wire

    + + + + + + + + + + + + + + +
    Ex. ProblemEx. Solution
    A wire has resistance $30 mΩ$ when it is $83.64 cm$ long with a diameter of $4.67 mm$. Calculate the resistivity of the wire$6.14e-07 Ωm$
    +
    + +