Re: calculating the area of a circle with bc



On 03/28/2010 01:51 PM, Tony Arnold wrote:
Rei,

Rei Shinozuka wrote:

The area is proportional to the square of the diameter or radius.

Data form www.dominos.com:

Domino's 10" pizza is $7.00
Domino's 14" pizza is $11.99.

The 10" price/diameter is 70 "cents per inch."
The 14" price/diameter is 85 "cents per inch."

implying that the 10" is a better buy.

But price/area shows:

The 10" price/area is 8.6 cents per square inch.
The 14" price/area is 7.7 cents per square inch.

The 14" pizza is 10% cheaper than the 10" pizza.

For a pure comparisons, you are correct: coefficients like pi are not
needed to compare. But you need to square the linear size of the pizza.

I stand corrected again. And I thought I was good at maths!

Regards,
Tony.


On 03/28/2010 03:24 PM, Tony Arnold wrote:

Jozsef,

Since the area of a pizza is directly proportional to its diameter, you
only really need to calculate the price/diameter to find out the best
value for money!

Regards,
Tony.

Jozsef Vadkan wrote:


input like:

sh count.sh 0.45 2200
...

explanations:
0.45 => diameter [in meter]

2200 => e.g. xy money

$(echo "scale=100; 2^($1/2) * $(echo "scale=100; 4*a(1)" | bc -l)" | bc
-l) => area of the circle

xy money => some nations currency


i'm dividing the area of the circle because i want to get the "xy
money/square meter"


#!/bin/bash

echo "$2/$(echo "scale=100; 2^($1/2) * $(echo "scale=100; 4*a(1)" | bc
-l)" | bc -l)" | bc -l


is there a shorter/better way?


it would be a pizza price calculator. [:D]

45 cm pizza = 2200 xy money
30 cm pizza = 1260 xy money
22 cm pizza = 960 xy money

i just want to count that, what will i have to choose to get the best
price for "xy money/square meter" pizza.

don't laugh. [:D]








The area of a circle comes from pi r squared = pi (d/2) squared. How you do this with bc is not known to me but the formula is above and I can prove it.

73 Karl




--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: calculating the area of a circle with bc
    ... Domino's 14" pizza is $11.99. ... The 10" price/area is 8.6 cents per square inch. ... value for money! ...
    (Ubuntu)
  • Re: calculating the area of a circle with bc
    ... The area is proportional to the square of the diameter or radius. ... Domino's 14" pizza is $11.99. ... The 10" price/area is 8.6 cents per square inch. ... value for money! ...
    (Ubuntu)
  • Re: calculating the area of a circle with bc
    ... Domino's 14" pizza is $11.99. ... The 10" price/area is 8.6 cents per square inch. ... For a pure comparisons, you are correct: ...
    (Ubuntu)
  • Re: 35 Things NOT to do When Ordering Delivery
    ... by J. Money on Friday, January 21, 2011 ... dorm rooms themselves, so they would have to change all of the rooms' ... it took more than 30 minutes for the pizza because the driver tried to ...
    (rec.sport.pro-wrestling)
  • Re: What Did You Watch? 2011-06-26 (Sunday)
    ... And why would anyone pay them all that money to get nothing in return? ... bills because it would cost more to sue than the award would be. ... Delivery boy stumbles as he is walking up to a house to deliver their pizza. ...
    (rec.arts.tv)