Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Lyapunov Stability Analysis
00:00
5 left

Lyapunov Stability Analysis

HardPython

Problem

Write a Lyapunov stability analysis for a first order differential equation.

Implement a numerical certificate for the scalar system x' = f(x), where f is represented by polynomial coefficients in ascending order. Use V(x) = 0.5 * (x - x_eq)^2 and evaluate V_dot = (x - x_eq) * f(x) at evenly spaced points on both sides of the equilibrium.

Return "asymptotically_stable" if every sampled derivative is less than -tolerance, "stable" if all are at most tolerance but at least one is nonnegative within tolerance, and "unstable" if any exceeds the tolerance.

Function signature: def classify_equilibrium(coefficients, x_eq, radius, samples, tolerance):

Input values are numeric; output is one of the three specified strings.

Constraints

  • 1 <= len(coefficients) <= 100
  • -10^6 <= coefficients[i] <= 10^6
  • radius > 0
  • 1 <= samples <= 100000
  • 0 <= tolerance < 1
  • The supplied x_eq is an equilibrium of the polynomial, subject to the requested tolerance

Function Signature

def classify_equilibrium(coefficients, x_eq, radius, samples, tolerance):
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements are in the Question tab.

You need to log in / sign up to run or submit.
Code
Sign up free to run your codeLog inLn 2
Run your code to see test output here.