Teach Any Computer Science Class
We have put together a full GCSE Computer Science curriculum that will give you all the teaching materials you need to teach any topic.
Whether you're a brand new Computer Science teacher, or you've been teaching ICT for years, our resources will save you hours and hours of lesson preparation every single week.View the Lessons →
Variables and constants are two commonly used mathematical concepts. A variable is a value that is changing or have the ability to change. A constant is a value which remains unchanged.
These concepts have stemmed out into other fields than mathematics like physics and computer science.
In the mathematical framework, a variable is a quantity which has a dynamic or a variable magnitude. In algebra, it is represented by an English or a Greek letter. It is general rule to call this symbolic letter the variable.
Uses of Variables
- Variables are used in equations, functions, geometry and identities.
- Variables are used to represent unknowns in equations.
- Variables are used to represent a rule between two unknown quantities.
- Variables are used to assume different states or events in the considered set of events in probability and statistics.
In mathematics, it is usual to highlight the acceptable values for the variable, which is called the range. These restrictions are conceived from the general properties of the equation or by definition.
Categorization of Variables
- Independent variable – the variable’s changes are not based on other factors. In statistics, it is referred to as explanatory variable.
- Dependent variable – the variable’s changes are based on some other variable(s). In statistics, it is referred to as response variable.
The term variable is used in the field of computing too, especially in programming. It points out to a lump memory in the program where varying values can be saved.
In programming, a variable is a value that can vary, depending on circumstances or on information sent to the program. Usually, a program contains commands that tell the computer what to do and data that the program utilizes while running. The data contains constants or fixed values that are permanent as well as variable values. Variable values are usually initialized to 0 or some default value because the actual values will be supplied by a program’s user. Usually, both constants and variables are defined as certain data types. Each data type recommends and restricts the form of the data. Data types such as an integer represented as a decimal number, or a string of text characters, usually limited in length are samples of these.
In object-oriented programming, each object has the data variables of the class it is an example of. The object’s methods are designed to handle the actual values that are supplied to the object when the object is being used.
In mathematics, a constant is a quantity that does not vary its value. Constants, like variables, are also symbolized by an English or a Greek letter. Usually it signifies a real number which has special functionalities in the background of the problem or the scenario it is used.
It can also be used to represent decimals or irrational numbers of interest, or very large numbers, which are not easily manipulated in a mathematical expression, in its numerical.
Constants are usually used to signify numbers with physical implication. In natural sciences like physics and chemistry, you will come across constants, which are specific letters assigned to represent values of quantities in nature or a mathematical theory. The Universal constant of Gravitation often symbolized by G and Plank’s constant symbolized by h are examples of both the usages.
Difference between Variables and Constants
- Variables are quantities with changing magnitude, hence can assume different values based on the application. Constants are quantities with permanent values and used to signify numbers with significance.
- Both constants and variables are denoted algebraically by English or Greek letters.
- Constants are used to characterize quantities in nature which are permanent, and the variables are used to denote unknowns.