0

How variables used in mathematics and computer programming are similar?

Comparison between variables in mathematics and variables used in programming (eg. Python).

28th Mar 2019, 1:15 PM
Abhisekh Upadhaya
Abhisekh Upadhaya - avatar
4 ответов
+ 3
In mathematics, variable are unknown thill equation was not finally. After that, variable got a value. In programming, variables are stores memory stack for any values. Of course, variables in programming languages may contains logic operators, strings, values (float point, integers...)...
28th Mar 2019, 2:42 PM
Aleksandar Nedeljkovic
Aleksandar Nedeljkovic - avatar
+ 2
I'm not really getting what exactly you want to know... Variables in programming are similar to maths in the way that they are placeholders for values with which you can calculate. a = 5 b = 10 print(a + b) #Output: 15 print(a < b) #Output: True Besides this very obvious thing, what do you want to know?
28th Mar 2019, 1:46 PM
HonFu
HonFu - avatar
+ 2
Not really. In mathematics, a variable, say, 'x' represents an abstract notion of any number, where as, in programming, 'x' refers to a concrete number somewhere in memory. Also, variables can be set, and modified, because in programming one thing happens after another; there is a concept of time, while in mathematics, there is no concept of time. x = x + 1 makes perfect sense in programming.
28th Mar 2019, 2:09 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
Vlad Serbu, if you look at the parameters of a function, the degree of similarity goes up again. def f(x): return x*x # or whatever So x can be filled with any value, and f will do the evaluation for what comes in. X becomes an 'abstract' placeholder for whatever f needs for an argument.
28th Mar 2019, 2:16 PM
HonFu
HonFu - avatar