symja_android_library icon indicating copy to clipboard operation
symja_android_library copied to clipboard

Solve emits too many errors

Open HannesWell opened this issue 3 years ago • 1 comments

Describe the bug

When solving equations often too many or unnecessary error messages are printed, even when the equation(-set) was finally solved successfully.

To Reproduce and expected behavior

>> Solve({8.0E-9==x0/x1,x0==x1^4.0},{x0,x1}) 
Error: 
  Power: Infinite expression 1/0 encountered. 
  Infinity: Indeterminate expression 0*ComplexInfinity encountered.
{{x0−>29.77443,x1−>2.33594},{x0−>-14.88721−25.78541⋅ⅈ,x1−>-1.16797−2.02298⋅ⅈ},{x0−>-14.88721+25.78541⋅ⅈ,x1−>-1.16797+2.02298⋅ⅈ}}

In this case I would expect to get just the solution without an error message, since the solution was computed successfully. As we have already discussed the different attempts to find a solution should probably done in 'quite'-mode?

>> Solve({Sin(x0)==5.0},{x0})
Error: Using inverse functions may omit some solutions.
{{x0−>1.5708−2.29243⋅ⅈ}}

I think the message about potentially omitted solutions is at most a warning and maybe should only be displayed in verbose mode (does something like that exist in symja?), by default it should be maybe an INFO Level message.

>> Solve({x0^2.0*Sin(x1)==5.0,x1^3.0*Cos(x0)==5.0},{x0,x1})
Error: 
  FindRoot: interval does not bracket a root: f(NaN) = NaN, f(NaN) = NaN. 
  Solve: This system cannot be solved with the methods available to Solve
Solve({x02.0⋅Sin(x1)==5.0,x13.0⋅Cos(x0)==5.0},{x0,x1})

Although the given set of equations cannot be solved, I think the error message FindRoot: interval does not bracket a root: f(NaN) = NaN, f(NaN) = NaN. should not be emitted. This has likely the same cause as the first example.

Java

  • Version: Java 11
  • OS: all

HannesWell avatar Jan 26 '22 10:01 HannesWell

The FindRoot warnings for the last case are suppressed thanks to your last commit. But in the first case the warnings are still printed to the console.

HannesWell avatar Jan 28 '22 16:01 HannesWell