MHB Extrapolation and interpolation in line search optimization

AI Thread Summary
The equations discussed relate to cubic and quadratic interpolation used in line search optimization within MATLAB's fmincg function. The user seeks the origin of these specific equations, noting they are not found in standard numerical optimization literature, including a referenced book by Peter Glynn and Stephen M. Robinson. It is suggested that these equations may originate from Andrew Ng's Coursera Machine Learning course. The code implements a conditional check to determine whether to use a quadratic or cubic fit based on the function values. Ultimately, the recommendation is to focus on the code's functionality rather than its theoretical origins, while acknowledging the potential for errors in the implementation.
mathu2057
Messages
1
Reaction score
0
hi
can you tell me these equations:

A = 6*(f2-f3)/z3+3*(d2+d3); % cubic fit
B = 3*(f3-f2)-z3*(d3+2*d2);
z2 = (sqrt(B*B-A*d2*z3*z3)-B)/A; % numerical error
in MATLAB fmincg.m
https://github.com/emersonmoretto/mlclass-ex3/blob/master/fmincg.m
come from where??
it is either cubic interpolation or cubic interpolation...i look for
these equation in many website and books numerical optimization but
i do not find these equation even the book numerical optimization
for Peter Glynn Stephen M. Robinson p:57.(in the attachment copy of the page).it is not same in matlab
please help me from where these equation come from?
 

Attachments

  • eqq.jpg
    eqq.jpg
    53.7 KB · Views: 135
Mathematics news on Phys.org
From the MATLAB site I found some mention that they came from Coursera Machine Learning course taught by Andrew Ng.

https://www.mathworks.com/matlabcen...rization-used-to-classify-hand-written-digits

https://scicomp.stackexchange.com/questions/25876/understanding-matlabs-fmincg-optimization-function

In the code there is a test f2>f1 if true then a quadratic fit is done and if false then a cubit fit is done.

Matlab:
  if f2 > f1
    z2 = z3 - (0.5*d3*z3*z3)/(d3*z3+f2-f3);                 % quadratic fit
  else
    A = 6*(f2-f3)/z3+3*(d2+d3);                                 % cubic fit
    B = 3*(f3-f2)-z3*(d3+2*d2);
    z2 = (sqrt(B*B-A*d2*z3*z3)-B)/A;       % numerical error possible - ok!
  end

so I think you will just have to go with the code and not worry about where it comes from. The code should be sufficient for you to decide why they are needed. Of course, there is always the distinct possibility that the code is wrong but again you will have to test and decide if that's the case.
 
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...
Fermat's Last Theorem has long been one of the most famous mathematical problems, and is now one of the most famous theorems. It simply states that the equation $$ a^n+b^n=c^n $$ has no solutions with positive integers if ##n>2.## It was named after Pierre de Fermat (1607-1665). The problem itself stems from the book Arithmetica by Diophantus of Alexandria. It gained popularity because Fermat noted in his copy "Cubum autem in duos cubos, aut quadratoquadratum in duos quadratoquadratos, et...

Similar threads

Back
Top