Function archimedes

Source
pub fn archimedes<T>(q_1: &T, q_2: &T, q_3: &T) -> T
where T: Copy + Add<Output = T> + Sub<Output = T> + Mul<Output = T> + From<i32>,
Expand description

The function archimedes calculates the area of a triangle using Archimedes’ formula with the lengths of the three sides provided as Fraction<i64> values.

Arguments:

  • q_1: Represents the length of the first side of the triangle.
  • q_2: The parameters q_1, q_2, and q_3 represent the lengths of the sides of a triangle. In the context of Archimedes’ formula for the area of a triangle, q_1, q_2, and q_3
  • q_3: The parameter q_3 represents the length of the third side of the triangle.

Returns:

The function archimedes returns the area of a triangle computed using Archimedes’ formula, given the lengths of the 3 sides.

Example:

use num_rational::Rational32;
use rat_trig_rs::trigonom::archimedes;
let q_1 = Rational32::new(1, 2);
let q_2 = Rational32::new(1, 4);
let q_3 = Rational32::new(1, 6);
let quadrea = archimedes(&q_1, &q_2, &q_3);
assert_eq!(quadrea, Rational32::new(23, 144));