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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:26:21+00:00 2026-05-25T14:26:21+00:00

When I numerically solving a ode with the following code, warnings named evfrf prompted.

  • 0

When I numerically solving a ode with the following code, warnings named “evfrf” prompted.

I am wondering how to force variables of differential equations to be Real numbers

NDSolve[{y''[t] + .1 y'[t] + Sin[y[t]] == 0, y'[0] == 1, 
y[0] == 0}, y, {t, 0, 20}, 
Method -> {"EventLocator", "Event" -> y[t], 
"EventCondition" -> y'[t] > 0, 
"EventAction" :> Print[t, ", ", y[t], ", ", y'[t]]}]

warning message:

NDSolve::evfrf: 
The event function did not evaluate to a real number somewhere 
between t =  1.5798366385128957` and t = 1.6426647495929725`,
preventing FindRoot from finding the root accurately. >>  

Thanks 🙂

  • 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-05-25T14:26:22+00:00Added an answer on May 25, 2026 at 2:26 pm

    I don’t think this is an issue of the answer genuinely being a complex number at those points.
    The following does not give an error.

    sol = NDSolve[{y''[t] + .1 y'[t] + Sin[y[t]] == 0, y'[0] == 1, 
     y[0] == 0}, y, {t, 0, 20}]
    
    Plot[y[t] /. sol, {t, 0, 20}]
    

    enter image description here

    The issue is the attempt to find the zero in y'[t] and limitations in the implied root-finding process. I tried increasing the WorkingPrecision and the MaxSteps but it didn’t remove the error.

    sol = NDSolve[{y''[t] + .10`64 y'[t] + Sin[y[t]] == 0, y'[0] == 1, 
    y[0] == 0}, y, {t, 0, 20}, 
      Method -> {"EventLocator", "Event" -> y[t], 
     "EventCondition" -> y'[t] >= 0, 
     "EventAction" :> Print[t, ", ", y[t], ", ", y'[t]]},  
       MaxSteps -> 10^9, MaxStepSize -> 0.0001, WorkingPrecision -> 32]
    

    Unless you really care about the eighth or subsequent decimal place, I would suggest not worrying about this error.

    Those more expert than me in numerical analysis might disagree, but I work in a field where we usually don’t have any faith in the accuracy of any data past the first decimal place of a percentage change (third decimal place of a level).

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

Sidebar

Related Questions

I am trying to solve numerically a set of partial differential equations in three
when i solve numerically a system of two differential equations: s1:=diff(n[Di](t), t)=...; s2:=diff(n[T](t), t)=...;
Here is the MATLAB / FreeMat code I got to solve an ODE numerically
I'm trying to use Taylor series to develop a numerically sound algorithm for solving
I was wondering if anyone knew of a numpy/scipy based python package to numerically
So I have close to 300 variables (just right now), and I have numerically
I am trying to numerically integrate an arbitrary (known when I code) function in
the following bit of SQL pulls through the month a marriage took place numerically,
I have two equations I'm solving on each recursive round: X = A -
I have a Mathematica code where I have to evaluate numerically thousands of integrals

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.