stepthom / math-fun

Just testing out some fun with mathematics.
2 stars 2 forks source link

FindMin/Max hangs with particular function #50

Closed stepthom closed 10 years ago

stepthom commented 10 years ago

I found that the system hangs with the following MathFunction:

- 50x^5 + 4x^4 + 12x^3

I compiled and ran the latest master branch and it hung while outputting the details of that function:

[dev@mogli:/dataware/math-fun] $ java -jar dist/math-fun.jar -i -d -x
   ...
  <function>
    <output>
      f(x) = 15x^7 - 41x^6 
    </output>
    <derivative>
      f(x) = 105x^6 - 246x^5 
    </derivative>
    <integral>
      f(x) = 15/8x^8 - 41/7x^7 
    </integral>
    <min>(-Infinity, -Infinity)</min>
    <max>(Infinity, Infinity)</max>
    <y-intercept>0.000000</y-intercept>
    <x-intercept>2.733333</x-intercept>
  </function>
  <function>
    <output>
      f(x) =  - 50x^5 + 4x^4 + 12x^3 
    </output>
    <derivative>
      f(x) =  - 250x^4 + 16x^3 + 36x^2 
    </derivative>
    <integral>
      f(x) =  - 25/3x^6 + 4/5x^5 + 3x^4 
    </integral>

It also seems to hang on the following MathFunctions:

(I'm finding these by running the system over and over again with a large N and seeing where it hangs.)

Please add test cases for these and see if you find and fix the problem.

jgus commented 10 years ago

Ah, the power of buddy-testing. I'll take care of it.