How to integrate in Mathematica SIMPLY

In summary, the user is trying to perform a simple definite integral in Mathematica but is encountering difficulties with the assumptions of the variables. They have tried using the Assuming function and the system variable $Assumptions, but are still struggling. They also received a safety tip about not using capital letters in variable names to avoid conflicts with predefined names in Mathematica.
  • #1
refind
51
0
Every time I try to do a simple definite integral simbolically such as:
Integrate[R/P - c1/(T^2), {P,P1,P2}]
it takes about 2 minutes then gives a long conditional expression. Basically it assumes that P1 and P2 are general numbers with complex parts and negative and such.

HOW do I tell mathematica that these are just simple real numbers >0? I looked around at using assumptions but after 2 months I still cannot figure it out and it's VERY frustrating.

Thanks
 
Physics news on Phys.org
  • #2
Perhaps you can use this example as a guide for next time.

In[1]:= Assuming[{R,P,c1,T,P1,P2}∈Reals&& P1≥0&&P2>P1,
Integrate[R/P-c1/(T^2),{P,P1,P2}]
]

Out[1]=(c1*(P1 - P2))/T^2 + R*Log[P2/P1]

which uses Assuming for temporary assumptions, just up to the closing ]

Or you can use this for more permanent assumptions

In[2]:= $Assumptions={{R,P,c1,T,P1,P2}∈Reals,P1≥0,P2>P1};

In[3]:= Integrate[R/P-c1/(T^2),{P,P1,P2}]
Out[3]= (c1*(P1 - P2))/T^2 + R*Log[P2/P1]

$Assumptions is a system variable, but you can change the value, display what the current value is, etc. Just don't forget that you have set it to something and later be confused why something isn't working.

Safety tip: Be careful when naming variables with capital letters. There are lots of predefined names that start with capital letters and if you accidentally name something B or C orD or E or I or M or N or O or V you will discover whole new levels of frustration that you have not yet imagined exist.
 
  • #3
Thank you very much Bill.
 

Related to How to integrate in Mathematica SIMPLY

1. How do I integrate a simple polynomial function in Mathematica?

Integrating a polynomial function in Mathematica is simple and can be done using the Integrate function. For example, to integrate the polynomial x^2 + 3x + 2, you can use the command Integrate[x^2 + 3x + 2, x]. This will give you the result 1/3 x^3 + 3/2 x^2 + 2x + C, where C is a constant of integration.

2. Can I integrate trigonometric functions in Mathematica?

Yes, you can integrate trigonometric functions in Mathematica using the same Integrate function. For example, to integrate sin(x), you can use Integrate[Sin[x], x]. The result will be -Cos[x] + C, where C is a constant of integration.

3. How can I integrate a function with multiple variables?

To integrate a function with multiple variables, you can use the Integrate function with the variables separated by a comma. For example, to integrate x^2 + y^2 with respect to both x and y, you can use Integrate[x^2 + y^2, x, y]. The result will be 1/3 x^3 y + 1/3 y^3 x + C, where C is a constant of integration.

4. Is there a way to integrate numerical data in Mathematica?

Yes, you can use the NIntegrate function in Mathematica to integrate numerical data. This function uses numerical methods to approximate the integral, and you can specify the range of integration and the desired precision. For example, to integrate the function x^2 from 0 to 5 with a precision of 0.01, you can use NIntegrate[x^2, {x, 0, 5}, PrecisionGoal -> 0.01].

5. How can I plot the result of an integration in Mathematica?

You can plot the result of an integration in Mathematica using the Plot function. For example, to plot the result of integrating x^2 from 0 to 5, you can use Plot[Integrate[x^2, {x, 0, y}], {y, 0, 5}]. This will give you a graph of the integral as a function of y.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Programming and Computer Science
Replies
1
Views
652
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
Replies
7
Views
834
Back
Top