find error total amount total 31049 35% =2572.3 - math

find error total amount total 31049 35% =2572.3
amount % total
--------------------------------
5990 12% =718.8
4999 10% =499.9
5060 6% =303.6
15000 7% =1050
--------------------------------
total 31049 35% =2572.3
--------------------------------
but = 31049 35% =10867.15

Well basically you cant add percentages as you did as you are taking portions of something, but some of them are bigger than the others.
A simple way of seeing it is applying the same logic but using 100% if you add 4 times 100% it would be 4 times the original value!
Another way to see percentages is to view them add fractions like 50% is X/2 or 33% is X/3 this way you can remember that the only way to add fractions is to have a common multiple of them (commonly the minimum common multiple) after finding it then you can add fractions.

Related

flex-box: How do I create a column with two rows - If the content of both doesn't fit I want the upper row to take a maximum of 60%

I'd like to create a 1 column, 2 row layout with the following rules :
If the contents of the Upper and Lower row fits within the container I want to show the entirety of both
If the contents exceeds that of the container, then I want the Upper row to take up 60% of the total height of the container, giving the Lower row the rest.
This is my attempt : https://playcode.io/959652/ - As you can see the Upper row is currently taking up whatever height it deems necessary leaving very little space for the lower row
edit: Since it wasn't clear from the original post: I'd like for the Upper row to take up more than 60% of the height in the event that the Lower row requires less than 40% and the upper row requires more than 60%

nesting multiple things in css-calc with multiple units

I've been trying to do a complicated calculation in CSS to get rid of media queries on a page, and not require too many of them. The second part of the code below with the long decimal number is me trying to use a set number to calculate the percentage of something (a padding). That number almost perfectly represents the percentage needed per pixel of a view-port, so if I had a massive view-port it could still calculate the percentage or even an extremely small one. But since this number needs to be a percent and I can't just put a percent sign at the end. I needed to get it into a percent via pixels. Meaning calculate how many pixels the browser would calculate if it was a percent. I figured out to take the actual 100 percent width of the page and divide it by 100 to get 1% of the page in pixels. I then multiply that by the number we got for the percentage of the page in the second part of the calculation, giving me the actual pixel width as if it were a percent, and as if the browser had calculated this itself. This is the calc operation I used, that is not working properly:
padding-left: calc((100% / 100) * (0.013641975308642 * 100vw));
It's not working and when we look with chrome dev tools, it tells me the object is invalid. What am I doing wrong?

How to adjust two correlated values

I'm trying to understand the magnitude of change a certain event had on the performance of a button.
I have a data frame like so: Date, Image Renders, and Image Clicks.
I calculate a year over year percent of renders and clicks to understand the annual growth. I know that renders and clicks are correlated because render is the previous step to a click. I track these two values on a daily level and my final table looks like the following:
Day, render, click
1, -10%, 3%
2, 3%, 7%
3, -2%, 5%
...
How do I find the % growth of click per day if the render was adjusted to 0. One day I tried was find the correlation between render and click, and scale each day. Render to click correlation is 50%; therefore, on day 1 if you increase render by 10% the click percent will end up being 8% because
10% * .5 + 3% = 8%
I have a feeling there is a better way to do this so I'm asking for help. I do my calculation in R so would be helpful if someone knew how to do this in R. Thank you!
You need to run a model, in which you then plug your values of render to get the predicted click
m <- lm(click ~ render)
summary(m)
coef(m) # gets the coefs so you can plug values in

Math Behind a Loading Bar That Fills As Value for Percentage Decreases(Any Language)

IO've realized the question was poorly written and decided to rewrite it:
I'm making a bar is supposed to be synced to a timer so that as it gets closer to 0, the bar will fill more until when it hits 0, the bar is at 100%
So instead of filling more as the value for the percentage grows, I'm wanting the value to be smaller and the bar fill more.
The math is fairly simple. For example say you want to represent the progress bar at 75% or just 75. We will represent percentage as a number from 0 to 100. The math is:
(percentage / 100) * totalWidthOfProgressBar
So if we want 75% of the bar full and the width of the progress bar was 100 units wide then then the math would be:
(75 / 100) * 100 = 75 units
If the progress bar's width was 200 units then the math would be:
(75 / 100) * 200 = 150 units
And 150 would be 75% of 200
This is one way but I am sure there are more ways to calculate this. Some progressBar objects have functions that will automatically calculate this for you. Take a look at the documentation of the progress bar you are using. Good luck and happy coding.

pitch shifting video rate math in cents

Sorry for my poor math/music knowledge..
Assumed whe want to play a video file at 50% and at 75 % speed how much cent do I have to shift in both situation to keep the same pitch and what would be the formula?
Thanks in advance!!
reducing the frequency by 50% means the sound is one octave lower
one octave is 12 halve-tones
1 halve tone is 100 cents
so if you play it at 50% you need to pitch it up by 1200 cent

Resources