My Math Forum  

Go Back   My Math Forum > College Math Forum > Calculus

Calculus Calculus Math Forum


Reply
 
LinkBack Thread Tools Display Modes
March 27th, 2018, 11:40 AM   #1
Newbie
 
Joined: Oct 2013

Posts: 20
Thanks: 0

QUick converging mimimization without derivatives?

We have three points: $\displaystyle x_0, x+h$ and $\displaystyle x-h$. We interpolate parabola using Stirling formula. Next, x:=parabola extreme. We can much decrease h and have next 3 points:$\displaystyle x_0, x+h$ and $\displaystyle x-h$.
One problem: fast decreasing accuracy because of zero in denominator.

Code:
        static double f(double x)
        {
            return (x - 1) * (x - 2) * (x - 3);
        }

        static void minparab(double x0,double h)
        {
            double kappa = 13.6;
            double xe = 1.4226497308103742355;//exact value for f(x)
            for (int i = 0; i < 10; i++)
            {
                double y0 = f(x0);
                double yp = f(x0 + h);
                double ym = f(x0 - h);
                double x = x0 + h * (0.25 * yp- 0.25 * ym) / (y0 - 0.5 *ym - 0.5 *yp);
                double hmin = Math.Abs(x - x0);
                if (hmin > h)
                    h = hmin;
                double h2 = h * h / kappa;
                Console.WriteLine("{0}", x-xe);
                x0 = x;
                h = h2;
            }
        }

        static void test()
        {
            minparab(1.5, 0.1);
        }
Borneq is offline  
 
Reply

  My Math Forum > College Math Forum > Calculus

Tags
converging, derivatives, mimimization, quick



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converging sequences John Travolski Calculus 2 October 6th, 2016 09:26 AM
converging series ineedhelpnow Calculus 25 July 26th, 2014 10:02 PM
Converging Sequence bobcantor1983 Calculus 1 October 2nd, 2013 01:48 PM
Cauchy v converging mathemadness Real Analysis 2 April 21st, 2010 10:41 AM
Converging sums milin Complex Analysis 8 October 19th, 2007 04:39 PM





Copyright © 2019 My Math Forum. All rights reserved.