Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:41:03+00:00 2026-06-12T09:41:03+00:00

I am new to C. I am trying to use optim function from C.

  • 0

I am new to C.

I am trying to use optim function from C. According to “Writing R Extension” Section 5.8, the Nelder Mead method requires 16 arguments:

void nmmin(int n, double *xin, double *x, double *Fmin, optimfn fn,
           int *fail, double abstol, double intol, void *ex,
           double alpha, double beta, double gamma, int trace,
           int *fncount, int maxit);

In my understanding, unlike R which accepts default values in arguments of functions, C requires users of the function to provide all the arguments.
Although I read optim hep page, I still have troubles understanding the meaning of some of these arguments i.e.:

  • fail
  • intol
  • ex
  • fncount

I highly appreciate if anyone can direct me where the descriptions of all the arguments are.

p.s.

The followings are the arguments that I figure out what they are:

  • n: the number of parameters,
  • xin: the initial value of the parameter
  • x: storage for the final parameters on exit, with fi
  • Fmin: the final value of the objective function
  • fn: the objective function
  • abstol: absolute tolerance
  • maxit: the maximum number of iterations
  • trace: Non-negative integer. If positive, tracing information on the progress of the optimization is produced.

The followings are some arguments specific for the Nelder Mead method:

  • alpha: R optim function uses = 1

  • beta: R optim function uses = 0.5

  • gamma: R optim function uses = 2
    (I found these default values by reading the optim function codes)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:41:04+00:00Added an answer on June 12, 2026 at 9:41 am

    fail – receives true if the function failed

    intol – user-initialized conversion tolerance

    ex – data to pass to the optimization function (fn)

    alpha – reflection factor

    beta – contraction and reduction factor

    gamma – extension factor

    fncount – receives the number of times the optimization function was called in the iteration loop

    You can see how these parameters are used here:

    http://fossies.org/dox/R-2.15.1/optim_8c_source.html#l00674

    For instance, intol is used like so:

    convtol = intol * (fabs(f) + intol);
    if (trace) Rprintf("  Scaled convergence tolerance is %g\n", convtol);
    

    There are some more details about the Nelder-Mead algorithm here, with Pascal code:

    http://books.google.com/books?id=M9hTn3UAheQC&pg=PA173

    (Compact Numerical Methods for Computers: Linear Algebra and Function Minimisation by John C. Nash)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use the new Html helper extension Serialize() from the furthure assembly..
I'm trying to use mechanize to grab prices for New York's metro-north railroad from
Trying to use the new get_search_form() function on WordPress, I noticed I can't remove
I'm trying to use the new Java 7 Files.createSymbolicLink() method within Play! Framework, and
I'm still new and trying to create a list for use in a function
I am trying to use the new Kendo UI grid from asp.net mvc 3.
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I am trying to use new Google Cloud Messaging system but I have some
I am trying to use the new Eventmanager of the Zend Framework 2. I
Trying to use this code to connect the AD PrincipalContext context = new PrincipalContext(ContextType.Domain,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.