Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to integrate in Mathematica SIMPLY

  1. Mar 18, 2013 #1
    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.

  2. jcsd
  3. Mar 18, 2013 #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,

    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.
  4. Mar 18, 2013 #3
    Thank you very much Bill.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook