开发者

equivalent function but different values O.o

I have 2 function, but for the same input a=5 und b=6 different values -.- why?

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%开发者_如何学JAVA29%285%286^2%29-%286^2%296%29%29+%3D

f2:

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

my haskell code:

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

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


Your functions aren't equivalent. Expand each out, and for example the a**6 terms are different.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜