Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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|improve this question

4 Answers 4

up vote 7 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|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|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|improve this answer

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.

share|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

 
discard

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.