How to integrate in Mathematica SIMPLY

  • Context: Mathematica 
  • Thread starter Thread starter refind
  • Start date Start date
  • Tags Tags
    Integrate Mathematica
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 2K views
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.