Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#1 2017-04-08 20:46:12

chen.aavaz
Member
Registered: 2016-05-05
Posts: 37

Local fruit store

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

#2 2017-04-08 21:40:51

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#3 2017-04-08 23:51:01

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#4 2017-04-08 23:52:21

chen.aavaz
Member
Registered: 2016-05-05
Posts: 37

Re: Local fruit store

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

#5 2017-04-08 23:55:21

chen.aavaz
Member
Registered: 2016-05-05
Posts: 37

Re: Local fruit store

Dear bobbym,
If this is programming code, sorry but I am not familiar with it smile



bobbym wrote:

Hi phrontister;

Offline

#6 2017-04-09 00:22:47

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#7 2017-04-09 00:23:42

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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.

chen.aavaz wrote:

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

#8 2017-04-09 00:27:26

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

bobbym wrote:

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!! smile


"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

#9 2017-04-09 00:32:04

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#10 2017-04-09 00:37:21

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

up

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

#11 2017-04-09 00:40:00

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#12 2017-04-09 00:48:42

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#13 2017-04-09 00:49:57

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#14 2017-04-09 01:00:39

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#15 2017-04-09 01:06:42

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#16 2017-04-09 01:26:08

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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! smile


"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

#17 2017-04-09 01:31:11

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#18 2017-04-09 01:31:31

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#19 2017-04-09 01:38:48

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#20 2017-04-09 01:40:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

#21 2017-04-09 01:48:54

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#22 2017-04-09 01:50:42

phrontister
Real Member
From: The Land of Tomorrow
Registered: 2009-07-12
Posts: 4,882

Re: Local fruit store

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

#23 2017-04-09 01:53:09

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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.

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!


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

#24 2017-04-09 04:55:03

chen.aavaz
Member
Registered: 2016-05-05
Posts: 37

Re: Local fruit store

Great solution!
bobbym, silly question, where did the first and third equation derive from?

bobbym wrote:

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

#25 2017-04-09 10:16:46

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: Local fruit store

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

Board footer

Powered by FluxBB