Wednesday 15 August 2012

algorithm - Matrix of math operations -


I tried to ask this question in the past but I was not clear in my question. Then try it again and hope that it should be clear around this time. I have a matrix of 3 * 3:

  a * b + c * d + e   

I have to find all the possible combinations of mathematical logic After work:

a * b , a + c , a * c , a + D , b * c, b * c , b * e , c + d , c + d , c * e , c + e and d + e since I selected multiplication Is there no need to take the operation b * a or d + c apart from this Because those sequences are a * b and C + D which are already mentioned above. Some of you will ask why the b * c and c + d are presented twice because the reason goes to c Is d through two different + signals and this also applies to b and c because They reach each other through two different signals. To develop this argument, I have to go through this matrix and all three of the four and five operands You will find the scene.

Did anybody find logic to find the algorithms using all the combinations of math using logic?

I hope this time it is clear about my question. I would appreciate your help to solve this puzzle. Thanks a lot.

I assume that your only operator will be * and + because you have not mentioned otherwise. If you have this assumption not correct then I need to tell ASAP (and this is a part of asking).

Show the matrix in the form of graph, in the form of a symbol of the meridian and between the operand {a, b, c, d, e} and operator { * _ 1, * _2, + _1, + _2} .

Next, on each top, search for all the strange before the depth - which does not go to the top twice (standard DFS).

This will give you a list of all possible assumptions of mathematical expression.

Finally, you have to reduce the "redundant" expressions (which means that for any other expression in the same > comitically similar 1 ) An order applies to all the expressions we are going to do, for each expression, we will first produce an equivalent expression while listing all the multiplication functions, and then for each operator, its operation in alphabetical order Will list. Therefore, for example e + d * b + a - & gt; b * d + a + e and e + b * a * d -> a * b * d + e . The exploitation of the associate and the computability of + and * , it is valid. It's not that hard, use a parse tree. Once we have this order, it is easy to remove the duplicate.

1 : This is not a real word; It is now.

No comments:

Post a Comment