Monday 18 April 2016

combinatorics - How many different results?


$a,b,c,d,e,f,g,h,i$ are real numbers and you would like to calculate the equation below by adding as many paranteses as you want:




a-b^c-d/e+f/g^h*i



What is the maximum amount of different results you can get by adding parantheses?


Note: Programming result is acceptable since you share the code and all possible different equations in terms of the letters rather than some garbage real number values.



Answer



I might be wrong, but doen't this relate closely to



Catalan-numbers?




Just look at



the second comment on OEIS:
Number of ways to insert n pairs of parentheses in a word of n+1 letters. E.g., for n=2 there are 2 ways: ((ab)c) or (a(bc)); for n=3 there are 5 ways: ((ab)(cd)), (((ab)c)d), ((a(bc))d), (a((bc)d)), (a(b(cd))).



So the final answer is



$C_9=1430$



There is an important detail left to be shown:




Does every different grouping actually lead to different results?
There are three things to consider here:

1) As there is only one addition and one multiplication, different groupings will give different results if the numbers are well chosen. Otherwise (x+y)+z=x+(y+z) or (xy)z=x(yz) would apply: different parenthesisation would lead to the same result no matter how we choose the numbers.

2) It is also necessary there are no subtractions after the addition and no divisions after the multiplication. Otherwise x+(y-z)=(x+y)-z or x*(y/z)=(x*y)/z would apply, causing different parenthesizations leading to the same results.

3) We also have to take care of every interpretation being valid: that is no zeros in the denominators of the fractions, and at the exponentiations no negative bases with non-integer exponents. Although I don't go into all the details, I'm convinced this can be granted easily.



No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...