Shouldn't these two results be the same? Why are they not?
integrate(\(x) {x * min(-x+10, 10)},lower = 0, upper = 10)$value
> [1] 1.085709
integrate(\(x) {x * (-x+10)},lower = 0, upper = 10)$value
> [1] 166.6667
Keep in mind that from x values 0 to 10 we should never expect to get a value of y = -x + 10 that is higher than 10, so the min(-x+10, 10) will always return (-x+10) as long as we are between 0 and 10. So the two integrals should be identical.
Why are they not?