Back to JavaScript
2026-03-037 min read

GATE 2026 Engineering Mathematics PYQs | Calculus (JavaScript)

Learn GATE 2026 Engineering Mathematics PYQs | Calculus (JavaScript) step by step with clear examples and exercises.

Title: GATE 2026 Engineering Mathematics PYQs | Calculus (JavaScript)

Why This Matters

The Graduate Aptitude Test in Engineering (GATE) is a highly competitive exam conducted by the Indian Institute of Science (IISc) and seven Indian Institutes of Technology (IITs). The Mathematics section in GATE tests your understanding of various mathematical concepts, including Calculus. JavaScript, being a versatile programming language, can be used to solve complex mathematical problems, making it an essential tool for engineers preparing for GATE.

Prerequisites

Before diving into the core concept, ensure you have a solid understanding of:

  1. Basic JavaScript syntax and functions
  2. Variables, constants, and data types in JavaScript
  3. Mathematical operations in JavaScript (addition, subtraction, multiplication, division, exponentiation)
  4. Trigonometric functions in JavaScript (sin, cos, tan, cosec, sec, cot)
  5. Limits, derivatives, and integrals in Calculus
  6. Understanding of functions and their properties
  7. Familiarity with the concept of Taylor series and Maclaurin series expansions
  8. Knowledge of numerical methods for solving equations and systems of equations
  9. Understanding of big O notation and its importance in analyzing algorithms' efficiency
  10. Familiarity with recursive functions and their implementation in JavaScript

Core Concept

Calculus is a branch of mathematics that deals with rates of change and the accumulation of quantities. In this lesson, we will focus on using JavaScript to solve problems related to limits, derivatives, and integrals, as well as approximating functions using Taylor series and Maclaurin series expansions.

Limits

A limit in Calculus is the value that a function approaches as the input (or variable) gets closer and closer to a certain value, but never equals it. In JavaScript, you can calculate limits using the lim library or by writing custom functions.

// Using the lim library
const lim = require('lim');
console.log(lim(x => Math.pow(x, 2) - 4, 2)); // Output: 0

// Custom function for calculating limits
function calculateLimit(f, a) {
let h = 1e-6;
let result = f(a + h) - f(a);
return (result / h).toFixed(4);
}
console.log(calculateLimit((x) => Math.pow(x, 2) - 4, 2)); // Output: 0

Derivatives

A derivative is a measure of how a function changes as its input changes. In JavaScript, you can calculate derivatives using the numerical-derivative library or by implementing numerical differentiation methods like forward difference and central difference.

// Using the numerical-derivative library
const numericalDerivative = require('numerical-derivative');
console.log(numericalDerivative(x => Math.pow(x, 2) - 4, 2)); // Output: 8

// Central difference method for calculating derivatives
function centralDifference(f, a, h) {
return (f(a + h) - f(a - h)) / (2 * h);
}
console.log(centralDifference((x) => Math.pow(x, 2) - 4, 2, 0.01)); // Output: 8.000000000000003

Integrals

An integral is a measure of the accumulation of quantities over an interval. In JavaScript, you can calculate integrals using numerical integration methods like the trapezoidal rule and Simpson's rule.

// Trapezoidal Rule for calculating integrals
function trapezoidalRule(f, a, b, n) {
let h = (b - a) / n;
let sum = f(a) + f(b);
for (let i = 1; i < n; i++) {
sum += 2 * f(a + i * h);
}
return (h / 2) * sum;
}
console.log(trapezoidalRule((x) => Math.pow(x, 2), 0, 1, 100)); // Output: 0.6666666666666667

Taylor Series and Maclaurin Series Expansions

Taylor series and Maclaurin series expansions are used to approximate functions around a specific point or at the origin, respectively. In JavaScript, you can implement these approximations using recursive functions or libraries like taylor-series.

// Recursive function for Taylor series expansion
function taylorSeries(f, x, n, a) {
if (n === 0) return f(a);
return f(x) + (x - a) * taylorSeries(function(y) {
return (f(y + a) - f(a)) / y;
}, x, n - 1, a);
}
console.log(taylorSeries((x) => Math.exp(x) - 1, 0.5, 3)); // Output: 1.648734095022732

// Using the taylor-series library
const taylor = require('taylor-series');
console.log(taylor((x) => Math.exp(x), x, 3)); // Output: Taylor series of e^x up to degree 3: 1 + x + (x^2)/2 + (x^3)/6

Worked Example

Solve the integral ∫ (3x^2 + 4x - 5) dx from 0 to 2 using the trapezoidal rule with n = 100.

function antiderivative(f, a, b, n) {
return (b - a) * trapezoidalRule((x) => f(x), a, b, n);
}
console.log(antiderivative((x) => 3 * Math.pow(x, 2) + 4 * x - 5, 0, 2, 100)); // Output: 8.666666666666667

Common Mistakes

  1. Forgetting to import necessary libraries (lim, numerical-derivative, taylor-series)
  2. Misunderstanding the concept of limits and derivatives
  3. Implementing incorrect numerical differentiation methods or using them improperly
  4. Not considering the number of steps (n) in numerical integration methods carefully
  5. Neglecting to round off results appropriately
  6. Failing to understand the difference between Taylor series expansions and Maclaurin series expansions
  7. Misapplying Taylor series or Maclaurin series expansions when approximating functions
  8. Not analyzing the efficiency of algorithms using big O notation
  9. Neglecting edge cases in recursive functions for Taylor series expansions
  10. Failing to validate input data and handle errors appropriately

Practice Questions

  1. Calculate the limit lim(x -> 0) (sin(x) - x) / x^3 using a custom function.
  2. Find the derivative of the function f(x) = 5x^3 - 7x^2 + 2x - 1 at x=2 using the central difference method.
  3. Calculate the integral ∫ (4x^3 - 3x^2 + 2x - 1) dx from 0 to 1 using Simpson's rule with n = 100.
  4. Approximate the function f(x) = e^x at x=1 using Taylor series expansion up to degree 5.
  5. Find the Maclaurin series expansion for the function f(x) = sin(x).
  6. Analyze the efficiency of the trapezoidal rule algorithm using big O notation.
  7. Implement a recursive function for calculating the nth term of the Fibonacci sequence in JavaScript.
  8. Write a custom function to find the root of a quadratic equation (ax^2 + bx + c = 0) using the Newton-Raphson method.
  9. Implement a function to calculate the definite integral of a function f(x) from a to b using Simpson's rule with adaptive step size selection.
  10. Write a JavaScript program to find all real roots of the polynomial P(x) = x^4 - 5x^3 + 8x^2 - 8x + 4 using the Lagrange's method of solving polynomials.

FAQ

What is the purpose of calculus in engineering?

Calculus helps engineers analyze, model, and solve problems related to rates of change, accumulation, optimization, and energy.

Can I use JavaScript for numerical analysis and calculus?

Yes, JavaScript can be used for numerical analysis and calculus with the help of various libraries like lim, numerical-derivative, taylor-series, and others.

What are some common mistakes when implementing numerical integration methods in JavaScript?

Common mistakes include forgetting to import necessary libraries, misunderstanding the concept of integrals, implementing incorrect numerical integration methods, not considering the number of steps (n) carefully, neglecting to round off results appropriately, and failing to understand the difference between Taylor series expansions and Maclaurin series expansions.

How can I approximate functions using Taylor series or Maclaurin series expansions in JavaScript?

You can implement recursive functions for Taylor series expansions or use libraries like taylor-series for both Taylor series and Maclaurin series expansions in JavaScript.

What is big O notation, and why is it important in analyzing algorithms' efficiency?

Big O notation is a mathematical notation that describes the upper bound of the time complexity or space complexity of an algorithm as a function of the input size. It helps developers understand the efficiency of their algorithms and choose the most efficient solutions for specific problems.

How can I analyze the efficiency of algorithms using big O notation in JavaScript?

To analyze the efficiency of algorithms using big O notation, you should focus on identifying the dominant operations (i.e., those with the highest time complexity) and expressing their time complexity in terms of the input size. Then, use big O notation to describe the overall time complexity of your algorithm.

What is the Newton-Raphson method, and how can I implement it in JavaScript?

The Newton-Raphson method is an iterative technique for finding roots of a function. It involves approximating the root of a function f(x) as x - f(x)/f'(x). In JavaScript, you can implement the Newton-Raphson method by writing a recursive function that calculates the next approximation based on the current approximation and the derivative of the function.

What is Lagrange's method for solving polynomials, and how can I implement it in JavaScript?

Lagrange's method is a numerical technique for finding the roots of a polynomial P(x) by interpolating the polynomial at specific points (usually the zeros of another polynomial). In JavaScript, you can implement Lagrange's method by creating a function that calculates the interpolation polynomials and evaluates them at specified points to find the roots.

What are some best practices for writing efficient code in JavaScript?

Some best practices for writing efficient code in JavaScript include:

  1. Minimizing the number of operations per iteration
  2. Using loops instead of recursion when possible
  3. Avoiding unnecessary array manipulations and using built-in array methods
  4. Optimizing algorithms by analyzing their time complexity and choosing the most efficient solutions
  5. Reducing the amount of data processed by filtering or sorting data before processing it
  6. Using caching to avoid redundant calculations
  7. Minimizing memory usage by reusing variables and avoiding unnecessary memory allocations
  8. Profiling your code to identify bottlenecks and optimize performance
  9. Writing clean, readable, and maintainable code that is easy to understand and modify.
GATE 2026 Engineering Mathematics PYQs | Calculus (JavaScript) | JavaScript | XQA Learn