Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

applied maths

What are continuous and discrete variables?

Bilal Shahid

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Continuous variables

Continuous variables are variables that are not unique. They tend to represent accurate values to the nearest precisely measured decimal point.

Example

If we're trying to measure the temperatures in different cities, we would need the help of some metrological instrument.

Let's say that two cities, Lahore and Karachi, are taken into account and have temperatures respectively as; 34.4°C34.4 \degree C and 34.6°C34.6 \degree C. Hence, this is a continuous measurement. And can only be mapped by the probability density function (PDF) to find probabilities of some continuous variable.

Let's take a look at a continuous graph below:

The continuous graph

Discrete variables

Contrary to continuous variables, discrete variables are calculated and not so precise. They represent singular whole terms.

Example

In the example given in continuous variables, we can say that the number of cities whose temperatures were measured is a discrete variable.

Or it could be the number of students whose heights must be measured or the number of people standing in the queue.

We'll now illustrate the discrete graph for better understanding.

The discrete graph

Are continuous variables treated as discrete variables?

We may handle continuous variables as though they were discrete variables. Age is a prime example of this. If we know a person's birth time, we may calculate their age to the second or even millisecond. Age is a continuous variable in this sense. However, we aren't usually concerned with a person's actual age. Instead, we consider age a discrete variable and count it in years.

RELATED TAGS

applied maths

CONTRIBUTOR

Bilal Shahid
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring