How to integrate in Mathematica SIMPLY

  • Context: Mathematica 
  • Thread starter Thread starter refind
  • Start date Start date
  • Tags Tags
    Integrate Mathematica
Click For Summary
SUMMARY

This discussion focuses on integrating definite integrals in Mathematica using assumptions to simplify results. Users can utilize the Assuming function to specify that variables such as P1 and P2 are real numbers greater than zero, which significantly reduces computation time and complexity. The discussion highlights two methods: temporary assumptions with Assuming and permanent assumptions using the system variable $Assumptions. Both methods yield the same simplified integral result.

PREREQUISITES
  • Familiarity with Mathematica syntax and functions
  • Understanding of definite integrals and symbolic computation
  • Knowledge of real number properties in mathematical contexts
  • Basic programming skills for variable management in Mathematica
NEXT STEPS
  • Explore the Assuming function in Mathematica for various applications
  • Learn about the $Assumptions system variable and its implications
  • Investigate best practices for naming variables in Mathematica to avoid conflicts
  • Review advanced integration techniques in Mathematica for complex functions
USEFUL FOR

Mathematica users, mathematicians, and engineers looking to optimize symbolic integration processes and manage variable assumptions effectively.

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 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 1 ·
Replies
1
Views
5K