You are not logged in.
A guy bought one banana, one apple and one peach from the local fruit market and paid 1 dollar for all three.
1 peach costs more than 2 bananas, 3 bananas cost more than 4 apples and 3 apples cost more than 1 peach. Can you find the value of each fruit?
Offline
Hi chen.aavaz;
I found an answer, which seems to be the only one for whole cents.
Did it by trial and error in Excel after setting up the relationships.
Is this just any old puzzle (in which case I can post the answer), or homework (for which you'd need a solution method and workings)?
Sorry, but I don't know how you'd go about it 'properly'. Someone else might, though.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi phrontister;
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Dear Phrontister,
No this is not homework but a proper mathematical solution would be appreciated.
Here are some ideas to share:
If b=banana, a=apple and p=peach, obviously
b+a+p=100 and all 3 are integers (because there don't exist any coins with values <1 cent).
Also:
p>2b
3b>4a
3a>p
Since p>2b and b>=1, then p must be >=3.
If 3a>p, then a>1, so a>=2.
3b>4a so 3b>8 so b>=3. Then again (see above) p >=7
Since p<3a and p>=7, then a>=3.
3b>4a so 3b>12 so b>4 so b>=5
and so on.
I don't know though how to express all these in a mathematical way.
Offline
Dear bobbym,
If this is programming code, sorry but I am not familiar with it
Hi phrontister;
Offline
Hi chen.aavaz;
You could possible try to enter it "solve this system b + a + p= 100, p> 2 b, 3 b > 4 a, 3 a > p in integers" at the wise and all powerful oracle at Wolfram Alpha. If you do, let me know what happens.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Hi Bobby;
That works perfectly...thanks! I've never used Reduce before...hope I can remember to use it if the opportunity arises again.
Hi chen.aavaz;
bobbym's code is Mathematica, which we both have. He knows it very well, and I know some.
I don't know though how to express all these in a mathematical way.
Same here. I started on this puzzle in much the same way as what you've shown, but couldn't progress from there to a mathematical solution.
That's when I turned to T&E in Excel for the solution, and for confirmation that it was unique.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
You could possible try to enter it at the wise and all powerful oracle at Wolfram Alpha. If you do, let me know what happens.
No solution, but scads of nutritional info!!
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi;
Try it like this:
solve this system b + a + p= 100, p> 2 b, 3 b > 4 a, 3 a > p in integers
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
So, it doesn't understand its own creator's mathematical language, but it knows what you want if you address it in English!
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi;
I am getting of course from the original question but what you say is essentially true and it drives me crazy.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Yes, I've always wondered why the programmers stopped when they'd succeeded in getting W|A to understand poorly expressed input, and didn't go on to enable it to process M language like your first code.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Geniuses and madmen are sometimes indistinguishable.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
I thought they were synonyms, but you've now thrown some doubt on that.
Do you have any idea about how to solve this mathematically?
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
I do not separate trial and error from "doing it mathematically." I like to get answers in seconds, mathematicians do not seem to mind the fact that they sometimes have to wait for centuries for 100 page proofs to appear. Witness the story of Andrew Wiles...
I am looking at an idea now.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
My Excel T&E only took a few seconds longer than a few seconds, which I was quite pleased about.
Even at my age I don't have centuries to wait for your 100-page proof to appear - and besides, I have to go to bed soon - but I'll hang around here for a bit longer in case you can get your idea to work.
All the best with it!
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Witness the story of Andrew Wiles...
Wow! What persistence!! I just read the Wikipedia article.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
I assure you, it will not be 100 pages. I like 2 or 3 line programs and if I must look at a proof, it should be 2 or 3 lines also.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
I need to know the length of each line before I can get a proper appreciation of whether you like short or long programs and proofs.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
The rule back in my time was only what your eyes could see in one look. In other words maybe a paragraph size.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Thinnish paragraph size in programs is best for me for comprehension and encouragement to read beyond the first few lines...
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Sorry...I should go now. Big day coming up for me tomorrow.
Catch you later.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." - Ted Nelson
Offline
Hi phrontister;
Okay, thanks for coming in. See you later.
Hi chen.aavazi;
Calling x = apples and y = bananas, we can reduce the system down to:
A)
100 - x > 3 y
3 y > 4 x
4 x > 100 - y
We can now graphically solve for the answer, I used Geogebra.
The answer lies in the small darker triangle and must be an integer for (x,y). That reduces down the possibilities to just a few, as a matter of fact there is just one integer coordinate in there.
We can go a bit further with a trick that is used in numerical work which I invented?!
The three inequalities in A) can be changed to equations with the addition of what I call a slack variable... This is a term used in linear optimization but I give it an added meaning.
If 100 - x > 3 y we only have to add something to the RHS to pick up the slack. I add e ( slack variable) which balances the inequality and gives us the equality of 100 - x = 3 y + e. We do that with all 3 inequalities and hope for the best.
100 - x = 3 y + e
3 y = 4 x + e
4 x = 100 - y + e
this can be solved by ordinary means
x = 19.0476, y = 26.1905, e = 2.38095
Remembering that x = apples and y equals bananas we can guess and try the closest integers and get apples = 19 and bananas = 26. We test to see that we are right and we are done!
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline
Great solution!
bobbym, silly question, where did the first and third equation derive from?
Hi phrontister;
Okay, thanks for coming in. See you later.
Hi chen.aavazi;
Calling x = apples and y = bananas, we can reduce the system down to:
A)
100 - x > 3 y
3 y > 4 x
4 x > 100 - y
We can now graphically solve for the answer, I used Geogebra.
http://i.imgur.com/4A8ZlQC.png
The answer lies in the small darker triangle and must be an integer for (x,y). That reduces down the possibilities to just a few, as a matter of fact there is just one integer coordinate in there.
We can go a bit further with a trick that is used in numerical work which I invented?!
The three inequalities in A) can be changed to equations with the addition of what I call a slack variable... This is a term used in linear optimization but I give it an added meaning.
If 100 - x > 3 y we only have to add something to the RHS to pick up the slack. I add e ( slack variable) which balances the inequality and gives us the equality of 100 - x = 3 y + e. We do that with all 3 inequalities and hope for the best.
100 - x = 3 y + e
3 y = 4 x + e
4 x = 100 - y + e
this can be solved by ordinary means
x = 19.0476, y = 26.1905, e = 2.38095
Remembering that x = apples and y equals bananas we can guess and try the closest integers and get apples = 19 and bananas = 26. We test to see that we are right and we are done!
Offline
Hi chen.aavaz;
bobbym, silly question, where did the first and third equation derive from?
Remember the first constraint given?
banana + apple + peach = 100
You solve for the peach first and get peach = 100 - banana - apple, then you substitute that into the inequalities. Okay?
Great solution!
Uh oh! Great solutions are almost always wrong. I checked it again and it has a chance of being right because there is nothing great about it. It is a back engineering job since I already had the answer just a bit later than phrontister.
In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.
Offline