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

  • Home
  • SEARCH
  • 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 8704401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:05:50+00:00 2026-06-13T03:05:50+00:00

The documentation for approxfun states that it is often more useful than approx .

  • 0

The documentation for approxfun states that it is “often more useful than approx“. I’m struggling to get my head around approxfun. When would approxfun be more useful than approx (and when would approx be more useful)?

  • 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-13T03:05:51+00:00Added an answer on June 13, 2026 at 3:05 am

    approx returns the value of the approximated function at (either) specified points or at a given number of points. approxfun returns a function which can then be evaluated at some specific points. If you need the approximation at points that you know at the time of making the approximation, approx will do that for you. If you need a function (in the mathematical sense) which will return the value of the approximation for some argument given later, approxfun is what you need.

    Here are some examples.

    dat <- data.frame(x=1:10, y=(1:10)^2)
    

    The output from approx and approxfun using this data

    > approx(dat$x, dat$y)
    $x
     [1]  1.000000  1.183673  1.367347  1.551020  1.734694  1.918367  2.102041
     [8]  2.285714  2.469388  2.653061  2.836735  3.020408  3.204082  3.387755
    [15]  3.571429  3.755102  3.938776  4.122449  4.306122  4.489796  4.673469
    [22]  4.857143  5.040816  5.224490  5.408163  5.591837  5.775510  5.959184
    [29]  6.142857  6.326531  6.510204  6.693878  6.877551  7.061224  7.244898
    [36]  7.428571  7.612245  7.795918  7.979592  8.163265  8.346939  8.530612
    [43]  8.714286  8.897959  9.081633  9.265306  9.448980  9.632653  9.816327
    [50] 10.000000
    
    $y
     [1]   1.000000   1.551020   2.102041   2.653061   3.204082   3.755102
     [7]   4.510204   5.428571   6.346939   7.265306   8.183673   9.142857
    [13]  10.428571  11.714286  13.000000  14.285714  15.571429  17.102041
    [19]  18.755102  20.408163  22.061224  23.714286  25.448980  27.469388
    [25]  29.489796  31.510204  33.530612  35.551020  37.857143  40.244898
    [31]  42.632653  45.020408  47.408163  49.918367  52.673469  55.428571
    [37]  58.183673  60.938776  63.693878  66.775510  69.897959  73.020408
    [43]  76.142857  79.265306  82.551020  86.040816  89.530612  93.020408
    [49]  96.510204 100.000000
    
    > approxfun(dat$x, dat$y)
    function (v) 
    .C(C_R_approxfun, as.double(x), as.double(y), as.integer(n), 
        xout = as.double(v), as.integer(length(v)), as.integer(method), 
        as.double(yleft), as.double(yright), as.double(f), NAOK = TRUE, 
        PACKAGE = "stats")$xout
    <bytecode: 0x05244854>
    <environment: 0x030632fc>
    

    More examples of usage:

    a <- approx(dat$x, dat$y)
    af <- approxfun(dat$x, dat$y)
    
    plot(dat)
    points(a, pch=2)
    

    enter image description here

    plot(dat)
    curve(af, add=TRUE)
    

    enter image description here

    or another example where a function is needed:

    > uniroot(function(x) {af(x)-4}, interval=c(1,10))
    $root
    [1] 1.999994
    
    $f.root
    [1] -1.736297e-05
    
    $iter
    [1] 24
    
    $estim.prec
    [1] 6.103516e-05
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The documentation for the method getItemPosition in Android's PagerAdapter class states that it is:
Documentation states that You must use /EHa when using _set_se_translator.. My question is: should
The documentation for the keyword is states that: The is operator only considers reference
Documentation states that 'handleResponseEnd' is called when the response has been completely received. http://twistedmatrix.com/documents/11.0.0/api/twisted.web.http.HTTPClient.html#handleResponseEnd
Documentation states that interface delegation is available for Win32 only. Currently I can't test
The documentation for the round() function states that you pass it a number, and
Documentation states that if an Intent can be processed by multiple applications the user
Documentation on synchronizedList states that, It is imperative that the user manually synchronize on
Android documentation for GCM here states that key-pair values in the data parameter, they
Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc

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.