Wikipedia:Reference desk/Archives/Mathematics/2016 December 14
Mathematics desk | ||
---|---|---|
< December 13 | << Nov | December | Jan >> | December 15 > |
Welcome to the Wikipedia Mathematics Reference Desk Archives |
---|
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
December 14
[edit]Non-linear midpoint percentage?
[edit]In a 3D rendered scene, the manual for Cinema4D says "In an average scene a Threshold (color) value of 10% will affect about 40% of the pixels - a value of 5% will affect about 90% of the pixels." How would I calculate how many pixels are affected at 7% (about half-way between 5% and 10%) threshold? I'm thinking its like a proportion, but it's not linear (if linear is the correct word. geometric?). Would a simple average give me the correct answer? --Navstar (talk) 19:17, 14 December 2016 (UTC)
- Is it obvious how many percent of the pixels are affected by a Threshold (color) value of 0% and 100% ? Bo Jacoby (talk) 22:00, 14 December 2016 (UTC).
- I would guess that a 0% threshold affects 100% of the pixels. So, we could then run a curve through those 3 points to interpolate a 7% threshold. StuRat (talk) 01:01, 15 December 2016 (UTC)
- Yes, a 0% threshold affects 100% of the pixels. (And I'm assuming 100% threshold affect 0% pixels) What do you call that curve and what's the math process called? Regression analysis? --Navstar (talk) 02:24, 15 December 2016 (UTC)
- The nonlinear transformation f(x) = ln(1001x−1−1) maps the interval 0<x<100 unto the real axis −∞<f(x)<∞. Let x be the threshold percentage and let y be the percentage of number of pixels affected. Assume the relationship f(y) = A + B f(x) for some constants A and B. Solve the equations f(40) = A + B f(10) and f(90) = A + B f(5) for A and B. Compute f−1(A + B f(7)) = 72. This J-code does the calculation
f=. 13 : '^.<:100%y' f^:_1+/(1,f 7)*(f 40 90)%.1,.f 10 5 72.1339
- Interpolation as suggested above may give you an idea but of course you cannot really know. The values given by the manual are average, so one could expect they have computed an average intensity histogram from which they took the values (I could not find a WP article on the subject, which is sad). There is absolutely no guarantee that the histogram is roughly linear between the two points, especially since the "affected %" values differ by a lot. TigraanClick here to contact me 09:27, 15 December 2016 (UTC)
Answering the questions:
- is linear the correct word? Yes!
- about half-way between 5% and 10%? For x=7.5% nonlinear interpolation gives y=67% and linear interpolation gives y=65%. For x=7% nonlinear interpolation gives y=72% and linear interpolation gives y=70%.
- "Would a simple average give me the correct answer?". The four points (0,100), (5,90), (10,40), and (100,0) do not lie on a straight line, so linear interpolation is manifestly incorrect. The four points (f(0),f(100))=(∞,−∞), (f(5),f(90)), (f(10),f(40)), and (f(100),f(0))=(−∞,∞) do lie on a straight line, so linear interpolation of the transformed points is not manifestly incorrect. Of course you cannot really know, but it is the best I can do from the data.
- What do you call that curve? I don't know.
- what's the math process called? nonlinear interpolation.
- Regression analysis? No.
Bo Jacoby (talk) 13:43, 16 December 2016 (UTC).
- You're one smart cookie! Thank you very much for all the information! 🙇 I was hoping for a formula to type into Wolfram|Alpha, but you went way beyond that! --Navstar (talk) 19:54, 16 December 2016 (UTC)
- Thanks! Bo Jacoby (talk) 20:03, 16 December 2016 (UTC).
- You're one smart cookie! Thank you very much for all the information! 🙇 I was hoping for a formula to type into Wolfram|Alpha, but you went way beyond that! --Navstar (talk) 19:54, 16 December 2016 (UTC)
By the way, you do not actually need to compute A and B. Just eliminate A and B from the three linear equations
- 0 = A + B f(10) − f(40) = A + B f(5) − f(90) = A + B f(7) − C
and solve the nonlinear equation f(y) = C. The resulting closed formula
- y = 100/(1+ef(90)+(f(90)−f(40))(f(7)−f(5))/(f(5)−f(10)))
or
- y = 100/(1+eln(27/2)ln(133/93)/ln(19/9)/9)
should be acceptable to Wolfram Alpha.
100%1+9%~(27%2)^(19%9)^.133%93 72.1339