#include <cstdlib>
#include <iostream>
//Given that f(x)= exp(x)-sin(2x). Use a Newton object to find the minimum of the
//function

using namespace std;

class Newton{
      protected:
      double precision;
      public:
      Newton(double p):precision(p){};
      virtual ~Newton(){};
      double Find(Function& f, double start){};//Find does the actual
//iteration for a particular function f starting from a value start f is declared as 
//(a reference to) an object of the abstract Function class:
      
};

class Function{
      public:
      Function(){}
      return f;
      }
      virtual ~Function(){};
      virtual double operator()(double x)=0;//operator() does the function evaluation 
//for a particular value x and dfdx evaluates its derivative
      virtual double dfdx(double x)=0;
};

virtual double operator()(double x){
      return exp(x)-sin(2*x);
      }
virtual double dfdx(double x){
      return (exp(x)-cos(2*x)*2.0;
      }
      

int main()
{
    
    
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

Hint: what do lines 26 and 28 tell you about your Function class.

Also, see if you can get some of the implementation of Find. We can't truly know that your professor didn't give you this much with which to start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.