Sometimes I want to ask mathematica to plot or calculate something without given a certain value for it ..
For example I may want to ask mathematica to integrate $\int{a x} \mathrm{d}x$! How to tell him that $a$ is a constant?
Sometimes I want to ask mathematica to plot or calculate something without given a certain value for it ..
For example I may want to ask mathematica to integrate $\int{a x} \mathrm{d}x$! How to tell him that $a$ is a constant?
If you don't specify any information about $a$, Mathematica automatically treats it as a constant, this is the default behaviour. For example, if you input "Integrate[$a$ $x$,$x$]", the output will be $a x^2/2$ as expected. Do not forget that in Mathematica, multiplication is a space, so you need to put a space between $a$ and $x$ for the command I gave to work (otherwise it will treat $ax$ as a single variable).
The previous answers provide enough context I believe. It is sometimes also useful to give mathematica information about the type of constants (if it's a real or imaginary number for example). This can be done using the option Assumptions. E.g. Integrate[Exp[a x],{x,0,Infinity},Assumptions->{a<0}]
Shortest through an example:
Dt[a x^2 + b, x, Constants -> {a}]
lets mathematica know that a is a constant here.
The define operator:
a:=7
D[a*t,t]
Precision[a]
b:=7.0
D[b*t,t]
Precision[b]
Out[9]= 7
Out[10]= \[Infinity]
Out[12]= 7.
Out[13]= MachinePrecision
Note that the decimal makes the number a literal while just the number is "infinitely" (symbolically) precise.