Bug SS-2271
1 vote

[Nonlinear Solvers] Wrong solution with FindRoot()

Created by Martin Kraska on 6/20/2015 7:26 PM Last Updated by Martin Kraska on 6/4/2023 9:25 PM
%
 (hrs)
Logged: 0   (hrs)

 Description

In the following example, FindRoot gives a wrong solution (e.g. F.BC=F is in conflict with the first equation).

SMath Studio: SMath Studio Desktop 0.97.5346.24640, x64
OS: Microsoft Windows NT 6.1.7601 Service Pack 1 (Microsoft Windows 7 Professional , x64)
Screen: 1920x1080 px, 96x96 dpi
Localization: separator=<semicolon>; decimal symbol=<comma>; system decimal symbol=<comma>; language=GER
Frameworks: CLR 2.0.50727.5485

    installed versions:
    v2.0.50727    2.0.50727.5420 SP2
    v3.0    3.0.30729.5420 SP2
    v3.5    3.5.30729.5420 SP1
    v4    
        Client    4.0.30319
        Full    4.0.30319
    v4.0  

    Martin Kraska (Sunday, June 4, 2023 9:25 PM) #

Dependence on alphabetical ordering is still present. Recommendation: either fix it or throw an error message if the variable names aren't in correct order. 

    oxel007 (Thursday, October 6, 2016 8:27 PM) #

Good to know that it is in the works! Looking forward to it release in extension manager

    Davide (Thursday, September 29, 2016 5:04 PM) #

Hello Alex,

Yes I think that actually the best solution to improve the plugin and fix several annoying issues is to use boolean equal just to drive the assignment of the initial guess. Assignments to the canvas can be made explicitely like in the screenshot below, leaving to the user the choice of naming and less "dark sides".

The NIGHTLY BUILD folder in the SVN already contains the refactored code (there are still some things to improve and all the log/summary part is not yet made)

    oxel007 (Wednesday, September 28, 2016 9:38 PM) #

Hello Davide, did you decide to keep the automatic assignment of the solved value to the unknown?

 

Here http://en.smath.info/forum/yaf_postsm34622_Unable-to-assign-to-variable-in-SS-0-98-5981-when-using-FindRoot-Function.aspx#post34622 

you mentioned that you will remove it, to enable solution of several equations for the save variable without using the Clear() command.

http://en.smath.info/forum/yaf_postsm34496_Unable-to-assign-to-variable-in-SS-0-98-5981-when-using-FindRoot-Function.aspx#post34496

 

    Davide (Wednesday, May 25, 2016 5:51 PM) #

This is because user-side assignments are not sorted alphabetically.

Internally the results are x[1]=0,5774 x[2]=1 x[3]=-1,11547; since the second assignment is F.BC=x[2] and F.AC=x[3], they results swapped;



I'm reworking the core of the plugin, and looking at the new matrix assignment feature of SS 0.98 I think I'll change the behavior of the boolean equal on the initial guess. Currently I've tested successfully the approach that uses the boolean equal to teach the plugin which unknowns are involved in the solution; this helps even to enable nested solvers, use of differentiation/integration in the functions, and free order of assignment for the user.