Area command in Matlab or Mathematica or Maple

  • Mathematica
  • Thread starter iiternal
  • Start date
  • Tags
    maple
  • #1
13
0

Main Question or Discussion Point

Hi,
I would like to know if there is a command in Matlab or Mathematica or Maple, which shows the area of a closed curve.
For example, find the area enclosed by a circle, x^2+y^2=1.
I wish I could use a command like "SOME_AREA_COMMAND[x^2+y^2=1]" and it can give me the answer Pi.

I know I can use integral, but sometimes it is difficult to find the joint points.

Thank you all. :-)
 

Answers and Replies

  • #2
Hepth
Gold Member
448
39
For Mathematica:


region = x^2 + y^2 < 1 && x > 0;
RegionPlot[region, {x, -2, 2}, {y, -2, 2}]
Integrate[If[region, 1, 0], {x, -1, 1}, {y, -1, 1}]


is for a half circle. so long as its bounded i believe this will work for all regions that you want without finding the limits of curves.


So long as you can write this as a boolean of a closed function (being inside or out) this should work.
 
  • #3
313
1
I agree with Hepth's reply, except that it's preferable to use Boole[] or Piecewise[] for algebra/symbolics and keep If[] for programming constructs. They former are better integrated into the Integrate function and run faster (about 10 times faster on my machine)

Integrate[Boole[region], {x, -1, 1}, {y, -1, 1}]

Integrate[Piecewise[{{1, region}}, 0], {x, -1, 1}, {y, -1, 1}]
 

Related Threads for: Area command in Matlab or Mathematica or Maple

  • Last Post
Replies
5
Views
6K
  • Last Post
Replies
11
Views
4K
  • Last Post
Replies
7
Views
2K
Replies
17
Views
45K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
18
Views
137K
Top