Volume Over a Triangle
A surface has height a * x * y + b * x**2 + c above the point (x, y). Return the volume under it over the triangle with corners (0, 0), (w, 0) and (w, s * w): all points with 0 <= x <= w and 0 <= y <= s * x.
Example 1
a 0.0
b 0.0
c 1.0
w 2.0
s 1.0
returns 2.0
A flat surface of height 1 over a triangle of area 2.
Example 2
a 0.0
b 0.0
c 3.0
w 4.0
s 0.5
returns 12.0
Height 3 over a triangle with base 4 and height 2.
Constraints
0.5 <= w <= 50.2 <= s <= 30 <= a, b, c <= 5
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More SciPy problems
- Area Under the PointsBeginner
- Chance of at MostBeginner
- City Block DistanceBeginner
- Percent at or BelowBeginner
- Standard ErrorBeginner
- Standard ScoresBeginner
- The ModeBeginner
- Which Way It LeansBeginner