Mathematica How to integrate in Mathematica SIMPLY

AI Thread Summary
To perform symbolic integration in Mathematica with specific assumptions about variables, users can utilize the Assuming function or set global assumptions using the $Assumptions variable. By specifying that the variables are real numbers and defining conditions such as P1 ≥ 0 and P2 > P1, the integration process becomes more efficient and yields simpler results. For temporary assumptions, the Assuming function can be used directly in the Integrate command. For more permanent assumptions, setting $Assumptions allows for consistent application across multiple calculations. Caution is advised when naming variables, as using capital letters may conflict with predefined names in Mathematica, leading to potential confusion and errors.
refind
Messages
50
Reaction score
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
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.
 
Thank you very much Bill.
 

Similar threads

Replies
1
Views
1K
Replies
2
Views
1K
Replies
1
Views
2K
Replies
1
Views
2K
Replies
12
Views
2K
Replies
1
Views
5K
Back
Top