Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
up vote 9 down vote accepted

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).

share|cite|improve this answer

Shortest through an example:

Dt[a x^2 + b, x, Constants -> {a}]

lets mathematica know that a is a constant here.

share|cite|improve this answer

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}]

share|cite|improve this answer

The define operator:

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.

share|cite|improve this answer
I don't want to give mathematica a value for $a$ .. Just to tell it that it is a constant – Osama Gamal Jun 27 '11 at 21:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.