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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:54:28+00:00 2026-06-05T18:54:28+00:00

I have defined the following two functions test <- function(t) { return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )

  • 0

I have defined the following two functions

test <- function(t) {   
   return( (0.5*eta^2/theta)*(1-exp(-2*theta*t)) )   
}

test2 <- function(s,t=s) {   
   return( (0.5*eta^2/theta)*exp(-theta*(s+t))*(exp(2*theta*min(s,t)) - 1) )   
}

and put

> theta=1.2  
> eta=1.8  
> mu=0.2

Now the test-function is defined so that test(t)=test2(t,t). The problem is that the following is returned

> test2(500)   
[1] NaN    
> test(500)    
[1] 1.35

What is wrong here? Thanks in advance.

  • 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-05T18:54:31+00:00Added an answer on June 5, 2026 at 6:54 pm

    @tomaskrehlik correctly identified the underflow/overflow problem in the original exponential calculation. To avoid the problem, you can rewrite it as:

    test3 <- function(s,t=s) {
       return((0.5*eta^2/theta)*exp(-theta*(s+t)+2*theta*min(s,t)) -
          exp(-theta*(s+t)))
    

    In the meantime I am being a little bit baffled about what’s going on with that funny return [expression that evaluates to NaN] code in the other answer … ??

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

Sidebar

Related Questions

I have the following two functions defined in my .bash_functions (which gets sourced into
can anyone explain the following to me. I have two JavaScript functions defined in
I have two entities, defined as following public class Corporation { public int Id{get;set;}
in header file I have defined the following function #ifndef OS_H #define OS_H #include
Suppose I have a file insert.c in which two functions are defined: 1.insert_after 2.insert_before
I have defined two dimensional array using following definition typedef std::vector<std::vector<short> > table_t; Can
Say I have the following code: function One() {} One.prototype.x = undefined; function Two()
I have defined following in a ResourceDictionary: <DockPanel x:Key=errorDisplay LastChildFill=False> <Border Background=Red DockPanel.Dock=Top> <TextBlock
In my .htaccess file I have defined following rule, RewriteRule t/([^.]+)/$ /videos/tag.php?tag=$1 [QSA] The
I have defined the following Interface [ServiceContract] public interface IHealthProducts { [OperationContract()] ResponseClass OrderSelfSignedHealthCertificate();

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.