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 954155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:10:02+00:00 2026-05-16T00:10:02+00:00

Is this method broken in R? I am using it to find roots of

  • 0

Is this method broken in R? I am using it to find roots of the following function:
f(x) = 2.5*exp(-0.5*(2*0.045 – x)) + 2.5*exp(-0.045) + 2.5*exp(-1.5*x) – 100

It is giving an answer of -38.4762403 which is not even close (f(x) = 2.903809e+25 for x=-38.4762403). The answer should be around 0.01-0.1. This function should converge..

Even for a simple function like f(x) = exp(-x) * x, it gives answer as 8.89210984 for which f(x) = 0.001222392 and I set tolerance to 10^-12..

Also, is there a non graphical version of newton method? I looked at nleqslv but have no idea how to use it..

Thanks for your help.

  • 1 1 Answer
  • 2 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-05-16T00:10:03+00:00Added an answer on May 16, 2026 at 12:10 am

    R has a number of root finders, such as uniroot and polyroot. For more complicated problems you can use optimisation functions such as optim, optimize or nlminb. Here is an example of solving this problem with uniroot.

    ## define the function
    f <- function(x){                                                                                                                                            
      2.5*exp(-0.5*(2*0.045 - x)) + 2.5*exp(-0.045) + 2.5*exp(-1.5*x) - 100                                                                                      
    }                                                                                                                                                            
    
    ## plot the function 
    y <- seq(-20,20,0.1) 
    plot(y,f(y),ylim = c(-100,100),xlim=c(-20,20))
    
    ## find the roots
    uniroot(f,c(-5,0))
    uniroot(f,c(0,10))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to rewrite my profile controller wich is broken at this point. Im using
So, I'm trying to find an answer to why this problem is happening; I've
Update: Turns out that this is a duplicate of: JSLint: Using a function before
This is similar to Invoking a method using reflection on a singleton object but
So, to start, I have seen posts like this: How to find which condition
Following Problem: I need something like an empty scope. Which means that this scope
This method right below reverses a doubly linked list with n elements. I dont
This method works as expected - it creates a JTree with a root node
This method that draws my tiles seems to be quite slow, Im not sure
This method is working totally right in matlab. but, when I compiled it in

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.