#13772: find_fit doesn't work when function with substituted initial_guess
parameters and independent variable from data contains fractional power of
a negative number
-------------------------+--------------------------------------------------
   Reporter:  infroma    |             Owner:  jason, jkantor                   
                            
       Type:  defect     |            Status:  new                              
                            
   Priority:  major      |         Milestone:  sage-5.6                         
                            
  Component:  numerical  |          Keywords:  
find_fit,initial_guess,wrong,fractional power,negative number
Work issues:             |   Report Upstream:  N/A                              
                            
  Reviewers:             |           Authors:                                   
                            
  Merged in:             |      Dependencies:                                   
                            
   Stopgaps:             |  
-------------------------+--------------------------------------------------
 Sometimes user's initial_guess can lead to fractional power of a negative
 number on some substituted independent variable from "data"
 variable.[[BR]][[BR]]It happend to me, when I wanted calculate diode's
 parameters. I know approximate diode parameters and I pass them as
 initial_guess, but get error. Of course, I can try to select other values
 until ending of errors, but it isn't cool.[[BR]][[BR]]Simple code to
 illustrate:

 {{{
 #!python
 def f(x, q):
     return sqrt(x - q)

 var('q')
 a = [[5, 2], [10, 3], [17, 4], [26, 5]] # it's y = sqrt(x - 1)
 M = Matrix(a)
 five = 4.9999999 # Calculated normally, solution ~= 1
 #five = 4.99999999 # Fails
 find_fit(M, f, parameters = [q], variables = [x], initial_guess = [five])

 # this works correctly with the same initial guesses, when it fails, it
 returns initial guess as a result
 model(x) = sqrt(x - q)
 find_fit(M, model, initial_guess = [5])
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13772>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to