等效函数但不同的值O.o

时间:2011-05-05 04:17:13

标签: function haskell binomial-coefficients

我有2个功能,但对于相同的输入a = 5和b = 6个不同的值-.-为什么?

F1:

wolframalpha.com/input/?i=%28%285^3%2B6^3%29%285^3-6^3%29%29^3%2B3%28%285%286^2%29%2B%285^2%296%29%285%286^2%29-%286^2%296%29%29+%3D

F2:

wolframalpha.com/input/?i=%285^2-6^2%29^3

我的haskell代码:

f :: Double -> Double -> Double
f a b = (((a**3)+(b**3))*((a**3)-(b**3)))+3*((a*(b**2) + (a**2)*a)*(a*(b**2) - (a**2)*a))

h :: Double -> Double -> Double
h a b = ((a+b)*(a-b))**3

的F - > wolframalpha.com/input/?i=%28%28a^3%2Bb^3%29%28a^3-b^3%29%29^3%2B3%28%28a%28b^2%29%2B%28a^2%29b%29%28a%28b^2%29-%28a^2%29b%29%29

ħ - > wolframalpha.com/input/?i=%28a^2-b^2%29^3

1 个答案:

答案 0 :(得分:4)

您的功能不相同。展开每个,例如a**6条款不同。