diff --git a/docs/mathgenerator/_gen_list.html b/docs/mathgenerator/_gen_list.html index a74e4c1..829750c 100644 --- a/docs/mathgenerator/_gen_list.html +++ b/docs/mathgenerator/_gen_list.html @@ -215,7 +215,8 @@ 137 ("potential_dividers", "physics"), 138 ("resistivity", "physics"), 139 ("fringe_spacing", "physics"), -140] +140 ("lba_to_chs", "computer_science"), +141] @@ -224,7 +225,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'), ('resistivity', 'physics'), ('fringe_spacing', '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'), ('fringe_spacing', 'physics'), ('lba_to_chs', 'computer_science')]
diff --git a/docs/mathgenerator/computer_science.html b/docs/mathgenerator/computer_science.html index c325c29..6c1254a 100644 --- a/docs/mathgenerator/computer_science.html +++ b/docs/mathgenerator/computer_science.html @@ -97,6 +97,9 @@
  • tribonacci_series
  • +
  • + lba_to_chs +
  • @@ -406,6 +409,23 @@ 286 problem = "The Tribonacci Series of the first ${n}$ numbers is ?" 287 solution = ', '.join(map(str, tribSeries)) 288 return problem, f'${solution}$' +289 +290def lba_to_chs(max_lba=2880, sectors_per_track=18, number_of_heads=2): +291 r""" Calculating the Cylinder, Head and Sector numbers for a given LBA +292 | Ex. Problem | Ex. Solution | +293 | --- | --- | +294 | If the LBA of a block is $2243$ on a device with $18$ sectors per track and $2$ heads, what are the cylinder, head and sector numbers? | Cylinder: $62$, Head: $0$, Sector: $12$ | +295 """ +296 lba = random.randint(0, max_lba) +297 cylinder = math.floor(lba/(sectors_per_track*number_of_heads)); +298 t = cylinder*(sectors_per_track*number_of_heads); +299 t = lba-t; +300 head = math.floor(t/(sectors_per_track)); +301 sector = t - (head * lba) + 1; +302 +303 problem = f"If the LBA of a block is ${lba}$ on a disk with ${sectors_per_track}$ sectors per track and ${number_of_heads}$ heads, what are the cylinder, head and sector numbers?" +304 solution = f"Cylinder: ${cylinder}$, Head: ${head}$, Sector: ${sector}$" +305 return problem, solution @@ -1177,6 +1197,56 @@ + +
    + +
    + + def + lba_to_chs(max_lba=2880, sectors_per_track=18, number_of_heads=2): + + + +
    + +
    291def lba_to_chs(max_lba=2880, sectors_per_track=18, number_of_heads=2):
    +292    r""" Calculating the Cylinder, Head and Sector numbers for a given LBA
    +293    | Ex. Problem | Ex. Solution |
    +294    | --- | --- |
    +295    | If the LBA of a block is $2243$ on a device with $18$ sectors per track and $2$ heads, what are the cylinder, head and sector numbers? | Cylinder: $62$, Head: $0$, Sector: $12$ |
    +296    """
    +297    lba = random.randint(0, max_lba)
    +298    cylinder = math.floor(lba/(sectors_per_track*number_of_heads));
    +299    t = cylinder*(sectors_per_track*number_of_heads);
    +300    t = lba-t;
    +301    head = math.floor(t/(sectors_per_track));
    +302    sector = t - (head * lba) + 1;
    +303
    +304    problem = f"If the LBA of a block is ${lba}$ on a disk with ${sectors_per_track}$ sectors per track and ${number_of_heads}$ heads, what are the cylinder, head and sector numbers?"
    +305    solution = f"Cylinder: ${cylinder}$, Head: ${head}$, Sector: ${sector}$"
    +306    return problem, solution
    +
    + + +

    Calculating the Cylinder, Head and Sector numbers for a given LBA

    + + + + + + + + + + + + + + +
    Ex. ProblemEx. Solution
    If the LBA of a block is $2243$ on a device with $18$ sectors per track and $2$ heads, what are the cylinder, head and sector numbers?Cylinder: $62$, Head: $0$, Sector: $12$
    +
    + +