$34.99
Inputs:
1. (double) Length of the base of the triangle
2. (double) Length of the height of the triangle
Outputs:
1. (double) Area of the triangle
Topics: (multiplication), (division)
Function Description:
Given the sides of two triangles, find the area of the triangle using the formula:
Area = 21(Base)(Height)
Then round your answer to 2 decimal places using the round() function.
Example:
base = 3 height = 5 area = myFirstFunc(base,height)
area → 7.50
Hints:
○ Type help round in the command window if you need more specifics on round()
illuminatiFlux
Inputs:
1. (double ) Distance from the wires to the center
Outputs:
1. (double ) The magnetic field strength at the center of the triangle
Topics: ( multiplication ), (division )
Function Description:
You have three wires each carrying a current in such a way that they form an equilateral triangle. The strength of the magnetic field, B (your output), at distance r (your input) from your three wires is given by:
3μ0I
B =
2πr
Where μ0 = 4π • 10−7 and I = 3 . Calculate the magnetic field strength at the center of the triangle. Finally, round your answer to 2 decimal places.
Example:
dist = 5; magStr = illuminatiFlux(dist);
magStr → 3.60e-7
Notes:
● Type pi into the command window and see what it gives you! ● All inputs will be positive integers.
pythag
Inputs:
1. (double ) The length of one leg of your right triangle
2. (double) The length of the triangle's hypotenuse
Outputs:
1. (double ) The length of the missing leg of your triangle
Function Description:
You are given a right triangle with the length of one of the legs and the length of the hypotenuse. Using the pythagorean theorem: a2 + b2 = c2
Solve to find the length of the missing leg of your triangle. Round your final answer to three decimal points.
Example: a = 8; c = 25;
b = pythag(a,c); b → 23.685
Notes:
● All inputs will be positive integers.
● The hypotenuse (2nd input) will always have a greater value than the leg (1st input).
Hints:
Inputs:
1. (double) Side length a of a triangle
2. (double) Side length b of a triangle
3. (double) Side length c of a triangle
Outputs:
1. (double) Half of the triangle's perimeter
2. (double) Area of the triangle
Function Description:
You are given three side lengths of a triangle (a,b,c). Using Heron's Formula:
s = a + 2b + c
Area = √s(s − a)(s − b)(s − c)
For your first output, return s (half of the perimeter). For your second output, return the area of the triangle rounded to 2 decimal places.
Example:
sideA = 5; sideB = 5; sideC = 5;
[s, area] = heronsFormula(sideA, sideB sideC);
s → 7.5 area → 10.83
Notes:
● Do not round the first output (half of the perimeter)
● Do round the second output (the area)
cosineCalculator
Inputs:
1. (double ) Length of side a of triangle
2. (double ) Length of side b of triangle
3. (double ) Length of side c of triangle
Outputs:
1. (double ) Value of the angle, in degrees, that is opposite to side C
Function Description:
In trigonometry, the law of cosines relates the lengths of the sides of a triangle to the cosine of one of its angles. The formula is given by: c2 = a2 + b2 − 2ab cos(θ)
where variables a , b , and c represent the side lengths of a triangle, and θ represents the angle opposite side C. Determine the value of the angle across from c . Round your output to two decimal places.
Example: a = 25; b = 28; c = 27; angle = cosineCalculator(a,b,c) angle → 60.94
Notes:
● You must rearrange the given equation to solve for the angle in terms of side lengths. ● Ensure your output is in degrees
Hints: