Python Encyclopedia for Academics
  • Course Outline
  • Artificial Intelligence
    • Data Science Foundation
      • Python Programming
        • Introduction and Basics
          • Variables
          • Print Function
          • Input From User
          • Data Types
          • Type Conversion
        • Operators
          • Arithmetic Operators
          • Relational Operators
          • Bitwise Operators
          • Logical Operators
          • Assignment Operators
          • Compound Operators
          • Membership Operators
          • Identity Operators
      • Numpy
        • Vectors, Matrix
        • Operations on Matrix
        • Mean, Variance, and Standard Deviation
        • Reshaping Arrays
        • Transpose and Determinant of Matrix
      • Pandas
        • Series and DataFrames
        • Slicing, Rows, and Columns
        • Operations on DataFrames
        • Different wayes to creat DataFrame
        • Read, Write Operations with CSV files
      • Matplotlib
        • Graph Basics
        • Format Strings in Plots
        • Label Parameters, Legend
        • Bar Chart, Pie Chart, Histogram, and Scatter Plot
  • Machine Learning Algorithms
    • Regression Analysis In ML
      • Regression Analysis in Machine Learning
      • Proof of Linear Regression Formulas
      • Simple Linear Regression Implementation
      • Multiple Linear Regression
      • Advertising Dataset Example
      • Bike Sharing Dataset
      • Wine Quality Dataset
      • Auto MPG Dataset
    • Classification Algorithms in ML
      • Proof of Logistic Regression
      • Simplified Mathematical Proof of SVM
      • Iris Dataset
  • Machine Learning Laboratory
    • Lab 1: Titanic Dataset
      • Predicting Survival on the Titanic with Machine Learning
    • Lab 2: Dow Jones Index Dataset
      • Dow Jones Index Predictions Using Machine Learning
    • Lab 3: Diabetes Dataset
      • Numpy
      • Pandas
      • Matplotlib
      • Simple Linear Regression
      • Simple Non-linear Regression
      • Performance Matrix
      • Preprocessing
      • Naive Bayes Classification
      • K-Nearest Neighbors (KNN) Classification
      • Decision Tree & Random Forest
      • SVM Classifier
      • Logistic Regression
      • Artificial Neural Network
      • K means Clustering
    • Lab 4: MAGIC Gamma Telescope Dataset
      • Classification in ML-MAGIC Gamma Telescope Dataset
    • Lab 5: Seoul Bike Sharing Demand Dataset
      • Regression in ML-Seoul Bike Sharing Demand Dataset
    • Lab 6: Medical Cost Personal Datasets
      • Predict Insurance Costs with Linear Regression in Python
    • Lab 6: Predict The S&P 500 Index With Machine Learning And Python
      • Predict The S&P 500 Index With Machine Learning And Python
  • Artificial Neural Networks
    • Biological Inspiration vs. Artificial Neurons
    • Review linear algebra and calculus essentials for ANNs
    • Activation Function
  • Mathematics
    • Pre-Calculus
      • Factorials
      • Roots of Polynomials
      • Complex Numbers
      • Polar Coordinates
      • Graph of a Function
    • Calculus 1
      • Limit of a Function
      • Derivative of Function
      • Critical Points
      • Indefinite Integrals
  • Calculus 2
    • 3D Coordinates and Vectors
    • Vectors and Vector Operations
    • Lines and Planes in Space (3D)
    • Partial Derivatives
    • Optimization Problems (Maxima/Minima) in Multivariable Functions
    • Gradient Vectors
  • Engineering Mathematics
    • Laplace Transform
  • Electrical & electronics Eng
    • Resistor
      • Series Resistors
      • Parallel Resistors
    • Nodal Analysis
      • Example 1
      • Example 2
    • Transient State
      • RC Circuit Equations in the s-Domain
      • RL Circuit Equations in the s-Domain
      • LC Circuit Equations in the s-Domain
      • Series RLC Circuit with DC Source
  • Computer Networking
    • Fundamental
      • IPv4 Addressing
      • Network Diagnostics
  • Cybersecurity
    • Classical Ciphers
      • Caesar Cipher
      • Affine Cipher
      • Atbash Cipher
      • Vigenère Cipher
      • Gronsfeld Cipher
      • Alberti Cipher
      • Hill Cipher
Powered by GitBook
On this page
  • Mathematical Background
  • Example 1:
  • Example 2:
  • Example 3:
  • Example 4:
  • Example 5:
  • Example 6:
  • Example 7:
  • Example 8:
  • Keywords
  1. Mathematics
  2. Calculus 1

Critical Points

Nerd Cafe

Mathematical Background

  • Critical points occur where the derivative of a function equals zero or is undefined.

  • These points help identify where the function might have local maxima, minima, or points of inflection.

Example 1:

f(x)=x2f(x)=x^{2}f(x)=x2
  • Derivative:

fˊ(x)=2xf\acute{}(x)=2xfˊ(x)=2x
  • Set derivative to zero:

2x=0⇒x=02x=0\Rightarrow x=02x=0⇒x=0
  • Critical Point:

x=0x=0x=0
  • Python Code:

from sympy import symbols, diff, solve

x = symbols('x')
f = x**2
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
  • Output:

Critical Points: [0]

Example 2:

f(x)=x3−3xf(x)=x^{3}-3xf(x)=x3−3x
  • Derivative:

fˊ(x)=3x2−3f\acute{}(x)=3x^{2}-3fˊ(x)=3x2−3
  • Solve:

3x2−3=0⇒x=±13x^{2}-3=0\Rightarrow x=\pm 13x2−3=0⇒x=±1
  • Python Code:

from sympy import symbols, diff, solve

x = symbols('x')
f = x**3 - 3*x
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
  • Output:

Critical Points: [-1, 1]

Example 3:

f(x)=1xf(x)=\frac{1}{x}f(x)=x1​
  • Derivative:

fˊ(x)=−1x2f\acute{}(x)=-\frac{1}{x^{2}}fˊ(x)=−x21​

This is never zero, but undefined at x=0.

  • Python Code:

from sympy import symbols, diff, solve

x = symbols('x')
f = 1/x
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points (zero derivative):", critical_points)
# Check undefined
print("Derivative undefined at x=0?", f_prime.subs(x, 0) if x != 0 else "Undefined")
  • Output:

Critical Points (zero derivative): []
Derivative undefined at x=0? zoo

Example 4:

f(x)=x4−4x2f(x)=x^{4}-4x^{2}f(x)=x4−4x2
  • Derivative:

fˊ(x)=4x3−8x=4x(x2−2)⇒x=0,x=±2f\acute{}(x)=4x^{3}-8x=4x\left( x^{2}-2 \right)\Rightarrow x=0,x=\pm \sqrt{2}fˊ(x)=4x3−8x=4x(x2−2)⇒x=0,x=±2​
  • Python Code:

from sympy import symbols, diff, solve

x = symbols('x')
f = x**4 - 4*x**2
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
  • Output:

Critical Points: [0, -sqrt(2), sqrt(2)]

Example 5:

f(x)=xf(x)=\sqrt{x}f(x)=x​
  • Derivative:

fˊ(x)=12xf\acute{}(x)=\frac{1}{2\sqrt{x}}fˊ(x)=2x​1​
  • Python Code:

from sympy import symbols, diff, solve, sqrt

x = symbols('x')
f = sqrt(x)
f_prime = diff(f, x)
# Solve f'(x) = 0
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
# Note undefined at x=0
print("Derivative undefined at x=0?", f_prime.subs(x, 0))
  • Output:

Critical Points: []
Derivative undefined at x=0? zoo

Example 6:

f(x)=x.exf(x)=x.e^{x}f(x)=x.ex
  • Derivative:

fˊ(x)=ex+x.ex=ex(1+x)⇒(1+x)=0⇒x=−1f\acute{}(x)=e^{x}+x.e^{x}=e^{x}\left( 1+x \right)\Rightarrow \left( 1+x \right)=0\Rightarrow x=-1fˊ(x)=ex+x.ex=ex(1+x)⇒(1+x)=0⇒x=−1
  • Python Code:

from sympy import symbols, diff, solve, exp

x = symbols('x')
f = x * exp(x)
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
  • Output:

Critical Points: [-1]

Example 7:

f(x)=ln(x)f(x)=ln\left( x \right)f(x)=ln(x)
  • Derivative:

fˊ(x)=1x⇒never  zero, undefined  at  x=0f\acute{}(x)=\frac{1}{x}\Rightarrow never \: zero, \: undefined \: \: at \: \: x=0fˊ(x)=x1​⇒never zero,undefinedatx=0
  • Python Code:

from sympy import symbols, diff, solve, ln

x = symbols('x')
f = ln(x)
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points:", critical_points)
  • Output:

Critical Points: []

Example 8:

f(x)=sin(x)f(x)=sin\left( x \right)f(x)=sin(x)
  • Derivative:

fˊ(x)=cos(x)⇒cos(x)=0⇒x=π2+nπf\acute{}(x)=cos\left( x \right)\Rightarrow cos\left( x \right)=0\Rightarrow x=\frac{\pi}{2}+n\pifˊ(x)=cos(x)⇒cos(x)=0⇒x=2π​+nπ
  • Python Code:

from sympy import symbols, sin, pi, diff, solve, solveset, Interval

x = symbols('x')
f = sin(x)
f_prime = diff(f, x)
critical_points = solve(f_prime, x)
print("Critical Points (symbolic):", critical_points)  # May return [pi/2 + n*pi] if general solution used

# For specific interval:
print("Critical Points in [0, 2π]:", solveset(f_prime, x, domain=Interval(0, 2*pi)))
  • Output:

Critical Points (symbolic): [pi/2, 3*pi/2]
Critical Points in [0, 2π]: {pi/2, 3*pi/2}

Keywords

critical points, calculus, derivatives, local maxima, local minima, inflection points, turning points, first derivative, second derivative, optimization, increasing function, decreasing function, concavity, stationary points, curve sketching, derivative test, extrema, function analysis, symbolic computation, Python SymPy, nerd cafe

PreviousDerivative of FunctionNextIndefinite Integrals

Last updated 2 months ago