Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Need To Find The Average Percentage Based On Other Variables

Author
Message
Flyin Mushroom
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location: Arkansas
Posted: 21st Aug 2007 10:21
This is more of a math question


FOR AN EXAMPLE:

I have 1 cup of apple juice that is 50% apple juice.
I want to add 2 more cups of apple juice to the 1 cup, but it is 75% apple juice.
What is the average percent of apple juice when I add it to the 1 cup

a=1 cup
(a's percentage) a1=50%
b=3 cups
(b's percentage) b1=75%

IF a=b then you would add a1 + b1 then divide by 2 (62.5%)
if a1=b1 then the percent of apple juice would be the same
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 21st Aug 2007 17:21 Edited at: 22nd Aug 2007 02:24
(a(a1) + b(b1)) /(a+b) = 68.75%

Is that what you mean?
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 21st Aug 2007 19:25
Your question doesn't make sense as you wrote it.

Quote: "I have 1 cup of apple juice that is 50% apple juice."


You mean the cup is half full? Or it's full, but only 50% is apple juice?

Quote: "I want to add 2 more cups of apple juice to the 1 cup"


How can you add 2 more cups of liquid to a cup which is apparently already 50% full?

Guessing that you mean that the juices are of varying concentrations it sounds fairly straight forward:

(50+75+75)/3 = 66.6%

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Aug 2007 19:36
yep, TDK is right again

Your signature has been erased by a mod because it was rubbish.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 22nd Aug 2007 02:23 Edited at: 22nd Aug 2007 02:39
But he said 1 cup of 50% and 3 cups of 75%. Shouldn't it be

(50+75+75+75)/4 = 68.75%

NOTE: I forgot a set of parenthesis in the equation in my first post

Edit: I see now. He said two in the sentence but below it said b = 3. So my reply was the same as TDK's.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Aug 2007 02:27
No it's (50+75+75) = 200/3 = 66.666r (how do you show recursion?)
3 cups

Since it is along the same sort of lines I was wondering how you would go about mixing colours in DBC.
Any ideas?

Your signature has been erased by a mod because it was rubbish.
Flyin Mushroom
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location: Arkansas
Posted: 22nd Aug 2007 02:32
lol...half full, half empty. Thats what I was looking for that 66.6% formula. I also, got help from some other websites, whats the deal with that 68.75%, thats the first formula i seen like that, but i mainly got the total equaling 66.67% from others. Either one would work for me, I just wanted to be around what it would be. P.S. my problem had nothing to do with apple juice, thats just something I thought would use the same formula, I appreciate all the replies for help on that. In person, I was offering anyone I asked on the street, if they knew the answer a choice of one of about 20 different types of multi-shot aerial fireworks ranging from 12 to 50 dollars, but of course nobody I asked knew the answer. I knew it was pretty easy, but my mind wasnt into problem solving.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 22nd Aug 2007 02:39 Edited at: 22nd Aug 2007 02:40
But he said b = 3 below the sentence where he mentioned that he wanted to add two cups of 75%. So he contradicted himself and I thought he wanted 3 cups of 75% apple juice added to a cup of 50% apple juice.

(50+75+75+75)/4 = 68.75% using 3 cups and
(50+75+75)/3 = 66.6% using 2 cups

Quote: "Since it is along the same sort of lines I was wondering how you would go about mixing colours in DBC.
Any ideas?"


I've never really thought about that. Wouldn't you just average out the values for each color that makes up the colors you are mixing.

like Blue(0,0,255) + Red(255,0,0) = Purple(128,0,128)

Edit: Oops, I feel like an idiot: 1 + 3 = 3
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Aug 2007 03:13 Edited at: 22nd Aug 2007 03:36
Quote: "I've never really thought about that. Wouldn't you just average out the values for each color that makes up the colors you are mixing.
like Blue(0,0,255) + Red(255,0,0) = Purple(128,0,128)"


nope that wouldn't work because of the way the RGB command converts to a colour value, I onlt recently worked out how it does it. To code it would be like this


I think I have the multiplication right?

[edit]
Yep that's always satisfying when you get it right first time lol

[edit]
Ooops it wasn't right it is now though. Is this faster than RGB command?

here's a program to show it better


hmmm.. I think i was 511 out, that's interesting. Two greens and a blue? Aaaah yes, the extra blue (1) is to make green 255 and blue 0, and so you need an extra green(255) to end that cycle and another for red to be 255 and green 0

here's a function for you guys


I think to blend colours you use rgbr rgbg and rgbb... or my variables

Your signature has been erased by a mod because it was rubbish.
luke810
18
Years of Service
User Offline
Joined: 4th Sep 2006
Location: United States
Posted: 22nd Aug 2007 03:51
Quote: "Is this faster than RGB command?"


Isn't that exactly what the RGB command does? They're probably run at about the same speed.


Couldnt you do this:



I've tried a few combinations and they seem to work right. I'm sure the answer would be easy to find on google.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Aug 2007 18:55 Edited at: 22nd Aug 2007 18:57
Quote: "Since it is along the same sort of lines I was wondering how you would go about mixing colours in DBC.
Any ideas?"


(Sorry Flyin Mushroom for highjacking your thread! )

It's called Alpha Blending!

luke810 pretty much nailed it, but only for a 50% blend ratio (which is the average of two color components). I hadn't thought about it doing it the way luke approached it, but with the DBC commands, it's not too hard to make a color Alpha Blend routine:

Use up and down arrows to control the blending of red and blue.



Enjoy your day.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Aug 2007 19:10 Edited at: 22nd Aug 2007 19:22
I made a little more of a presentation out of the code and it looks awesome
Thanks Latch.


I didn't think of mixing colours in the same way as alpha blending, duh

[edit]
I understand now, thanks
Not as complicated as I thought it was.

@Flying Mushroom
Your question is easy to work out if you think of adding a cup of 100% apple juice to another 100% apple juice.
200% /2 = 100% apple juice (my favourite )
a common mistake is to think that this would be 200% apple juice, which is just crazy

Your signature has been erased by a mod because it was rubbish.
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Aug 2007 19:16
Nice Job Obese! That's a much better presentation of what's happening.

Enjoy your day.
Flyin Mushroom
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location: Arkansas
Posted: 23rd Aug 2007 11:58
For The Ones that did them Color Value CODE SNIPPET's Above:

When the colors were mixing together, my eyes seemed to play a visual illusion on me, the part of the red & blue box changing colors in that Code Snipet you did, appeared that the colors were getting alittle brighter with an outline of the changing
box still there until you re-focused your eyes.

I WONDER if thats how some of them Japanese Cartoons used to be, Alot of visual images arranged a specific way repeatedly in cycles may give some people seizures, nausea, spasms, and
convulsions. The effect seems like the concept called lateral inhibition. Here is a CODE SNIPET of a grid.


It is an example of how contrast affects color perception. The area at the corners of black boxes APPEAR GRAY. This is because in the retina when some light-receiving cells are activated others around them shut down.
You will notice that where the white lines intersect, there is black on four sides, where the lines alone are surrounded by black on only two sides. When you look at the intersections, the cells in the retina are surrounded on four sides by other cells that are also receiving light. They are therefore more inhibited than the cells focused on the lines. It is their inhibition that causes the DARK spots to appear.

To someone in the hills, they'll be like "Them there eyeballs have a memory, I tell you what, its like they there and there
they aint. Must be like my ole brain, just a trace of intelligence."

a mix of images such as color perception illusions, along with angled, line, and direction perception illusions might of opened doors for the art of persuassion for MK Ultra type seekers out there in past years. Oh thats probably just a stereotype, theres alot more factors out there that can cause Suggestive hypnosis. Do what

Dont Bogard The Nachos Beavis

Login to post a reply

Server time is: 2025-05-30 13:55:59
Your offset time is: 2025-05-30 13:55:59