Items tagged with area

Feed

i want to know the area under a diagram plotted by pdsolve, how can i do that? for example in below , what is the area under p1 diagram?


 

restart:k:=5;

5

(1)

EQ:=diff(u(x,t),t)=k*diff(u(x,t),x$2);

diff(u(x, t), t) = 5*(diff(diff(u(x, t), x), x))

(2)

ibc:=u(0,t)=0,u(1,t)=0, u(x,0) = x;

u(0, t) = 0, u(1, t) = 0, u(x, 0) = x

(3)

sol:=pdsolve({EQ},{ibc},numeric);

_m2021168030176

(4)

p1:=sol:-plot(u,x=0.5,t=0...10,style = line,color = "Blue",legend = "heat Plot",axes=boxed);

 

M:=op(1,op(1,p1));

M := Array(1..201, 1..2, {(1, 1) = .0, (1, 2) = .5, (2, 1) = 0.5e-1, (2, 2) = .2702110502740721, (3, 1) = .1, (3, 2) = -0.176887059080428e-1, (4, 1) = .15, (4, 2) = -0.6515347962762406e-2, (5, 1) = .2, (5, 2) = 0.74109221595503715e-2, (6, 1) = .25, (6, 2) = -0.6178984348254404e-2, (7, 1) = .3, (7, 2) = 0.49645329554988925e-2, (8, 1) = .35, (8, 2) = -0.3948699801548904e-2, (9, 1) = .4, (9, 2) = 0.31161325326115076e-2, (10, 1) = .45, (10, 2) = -0.24369292293079273e-2, (11, 1) = .5, (11, 2) = 0.18845070914387395e-2, (12, 1) = .55, (12, 2) = -0.14366378752131666e-2, (13, 1) = .6, (13, 2) = 0.10748767238662861e-2, (14, 1) = .65, (14, 2) = -0.7839388660633711e-3, (15, 1) = .7, (15, 2) = 0.5511660027174686e-3, (16, 1) = .75, (16, 2) = -0.3660810752890637e-3, (17, 1) = .8, (17, 2) = 0.22001797006812284e-3, (18, 1) = .85, (18, 2) = -0.10581369353881973e-3, (19, 1) = .9, (19, 2) = 0.1755251750102873e-4, (20, 1) = .95, (20, 2) = 0.4964665498398858e-4, (21, 1) = 1.0, (21, 2) = -0.9980698165105276e-4, (22, 1) = 1.05, (22, 2) = 0.1362404856962589e-3, (23, 1) = 1.1, (23, 2) = -0.16167000912668705e-3, (24, 1) = 1.15, (24, 2) = 0.17833050358069153e-3, (25, 1) = 1.2, (25, 2) = -0.18805314257842951e-3, (26, 1) = 1.25, (26, 2) = 0.19233515285281392e-3, (27, 1) = 1.3, (27, 2) = -0.19239777469550633e-3, (28, 1) = 1.35, (28, 2) = 0.18923435555607597e-3, (29, 1) = 1.4, (29, 2) = -0.18365024366673088e-3, (30, 1) = 1.45, (30, 2) = 0.17629586775928352e-3, (31, 1) = 1.5, (31, 2) = -0.16769415545232156e-3, (32, 1) = 1.55, (32, 2) = 0.15826324867687376e-3, (33, 1) = 1.6, (33, 2) = -0.1483353129733858e-3, (34, 1) = 1.65, (34, 2) = 0.1381721031382132e-3, (35, 1) = 1.7, (35, 2) = -0.12797783595325005e-3, (36, 1) = 1.75, (36, 2) = 0.11790982779578369e-3, (37, 1) = 1.8, (37, 2) = -0.10808727763435372e-3, (38, 1) = 1.85, (38, 2) = 0.9859851163881829e-4, (39, 1) = 1.9, (39, 2) = -0.8950695218043435e-4, (40, 1) = 1.95, (40, 2) = 0.8085602954949057e-4, (41, 1) = 2.0, (41, 2) = -0.7267321775920382e-4, (42, 1) = 2.05, (42, 2) = 0.6497334507523223e-4, (43, 1) = 2.1, (43, 2) = -0.5776130436199765e-4, (44, 1) = 2.15, (44, 2) = 0.5103426709812118e-4, (45, 1) = 2.2, (45, 2) = -0.4478348725852213e-4, (46, 1) = 2.25, (46, 2) = 0.3899576658643508e-4, (47, 1) = 2.3, (47, 2) = -0.336546405833609e-4, (48, 1) = 2.35, (48, 2) = 0.28741334410836633e-4, (49, 1) = 2.4, (49, 2) = -0.2423552947809686e-4, (50, 1) = 2.45, (50, 2) = 0.20115974495047912e-4, (51, 1) = 2.5, (51, 2) = -0.16360968960468515e-4, (52, 1) = 2.55, (52, 2) = 0.12948742231058999e-4, (53, 1) = 2.6, (53, 2) = -0.985774731176686e-5, (54, 1) = 2.65, (54, 2) = 0.706688518346671e-5, (55, 1) = 2.7, (55, 2) = -0.4555672725651303e-5, (56, 1) = 2.75, (56, 2) = 0.23043650036730538e-5, (57, 1) = 2.8, (57, 2) = -0.29404079279315267e-6, (58, 1) = 2.85, (58, 2) = -0.14933413612624144e-5, (59, 1) = 2.9, (59, 2) = 0.30749105483557417e-5, (60, 1) = 2.95, (60, 2) = -0.4466869448461453e-5, (61, 1) = 3.0, (61, 2) = 0.5684494809229467e-5, (62, 1) = 3.05, (62, 2) = -0.67421491593684444e-5, (63, 1) = 3.1, (63, 2) = 0.765330108066053e-5, (64, 1) = 3.15, (64, 2) = -0.8430551865031369e-5, (65, 1) = 3.2, (65, 2) = 0.9085666798487518e-5, (66, 1) = 3.25, (66, 2) = -0.9629609655930039e-5, (67, 1) = 3.3, (67, 2) = 0.10072579272402201e-4, (68, 1) = 3.35, (68, 2) = -0.1042404728762369e-4, (69, 1) = 3.4, (69, 2) = 0.1069279635035891e-4, (70, 1) = 3.45, (70, 2) = -0.10886958224421352e-4, (71, 1) = 3.5, (71, 2) = 0.11014051364892259e-4, (72, 1) = 3.55, (72, 2) = -0.11081017636391213e-4, (73, 1) = 3.6, (73, 2) = 0.11094257929051255e-4, (74, 1) = 3.65, (74, 2) = -0.11059666495657345e-4, (75, 1) = 3.7, (75, 2) = 0.109826638880031e-4, (76, 1) = 3.75, (76, 2) = -0.10868228414258878e-4, (77, 1) = 3.8, (77, 2) = 0.10720926073958364e-4, (78, 1) = 3.85, (78, 2) = -0.1054493895470911e-4, (79, 1) = 3.9, (79, 2) = 0.1034409209623252e-4, (80, 1) = 3.95, (80, 2) = -0.10121878843963985e-4, (81, 1) = 4.0, (81, 2) = 0.9881484727059153e-5, (82, 1) = 4.05, (82, 2) = -0.9625809905064345e-5, (83, 1) = 4.1, (83, 2) = 0.9357490234275213e-5, (84, 1) = 4.15, (84, 2) = -0.9078917009490728e-5, (85, 1) = 4.2, (85, 2) = 0.87922554398473e-5, (86, 1) = 4.25, (86, 2) = -0.8499461919063325e-5, (87, 1) = 4.3, (87, 2) = 0.8202300151001906e-5, (88, 1) = 4.35, (88, 2) = -0.7902356191213331e-5, (89, 1) = 4.4, (89, 2) = 0.7601052464222056e-5, (90, 1) = 4.45, (90, 2) = -0.72996608149495766e-5, (91, 1) = 4.5, (91, 2) = 0.699931465092186e-5, (92, 1) = 4.55, (92, 2) = -0.6701020229904285e-5, (93, 1) = 4.6, (93, 2) = 0.6405667145430395e-5, (94, 1) = 4.65, (94, 2) = -0.6114038060383664e-5, (95, 1) = 4.7, (95, 2) = 0.5826817736440689e-5, (96, 1) = 4.75, (96, 2) = -0.5544601404792595e-5, (97, 1) = 4.8, (97, 2) = 0.52679025211894145e-5, (98, 1) = 4.85, (98, 2) = -0.4997159946020307e-5, (99, 1) = 4.9, (99, 2) = 0.47327445878452e-5, (100, 1) = 4.95, (100, 2) = -0.4474965546586055e-5, (101, 1) = 5.0, (101, 2) = 0.4224075790442743e-5, (102, 1) = 5.05, (102, 2) = -0.3980277398539528e-5, (103, 1) = 5.1, (103, 2) = 0.3743726399348483e-5, (104, 1) = 5.15, (104, 2) = -0.35145372330544755e-5, (105, 1) = 5.2, (105, 2) = 0.3292786864253045e-5, (106, 1) = 5.25, (106, 2) = -0.3078518569671755e-5, (107, 1) = 5.3, (107, 2) = 0.28717454240173786e-5, (108, 1) = 5.35, (108, 2) = -0.2672453505531053e-5, (109, 1) = 5.4, (109, 2) = 0.2480604841418905e-5, (110, 1) = 5.45, (110, 2) = -0.22961401119743008e-5, (111, 1) = 5.5, (111, 2) = 0.21189811309571416e-5, (112, 1) = 5.55, (112, 2) = -0.19490331186010634e-5, (113, 1) = 5.6, (113, 2) = 0.17861867825155937e-5, (114, 1) = 5.65, (114, 2) = -0.16303202207033257e-5, (115, 1) = 5.7, (115, 2) = 0.14813006599365237e-5, (116, 1) = 5.75, (116, 2) = -0.13389860418240196e-5, (117, 1) = 5.8, (117, 2) = 0.12032264680435905e-5, (118, 1) = 5.85, (118, 2) = -0.10738655154134225e-5, (119, 1) = 5.9, (119, 2) = 0.9507414307327055e-6, (120, 1) = 5.95, (120, 2) = -0.8336882146176523e-6, (121, 1) = 6.0, (121, 2) = 0.7225366029120385e-6, (122, 1) = 6.05, (122, 2) = -0.6171149536407717e-6, (123, 1) = 6.1, (123, 2) = 0.5172500469062582e-6, (124, 1) = 6.15, (124, 2) = -0.422767804599377e-6, (125, 1) = 6.2, (125, 2) = 0.3334939363034557e-6, (126, 1) = 6.25, (126, 2) = -0.24925451730719557e-6, (127, 1) = 6.3, (127, 2) = 0.1698765042164462e-6, (128, 1) = 6.35, (128, 2) = -0.9518819325289293e-7, (129, 1) = 6.4, (129, 2) = 0.25019625957658297e-7, (130, 1) = 6.45, (130, 2) = 0.4079705332935711e-7, (131, 1) = 6.5, (131, 2) = -0.10242728416703212e-6, (132, 1) = 6.55, (132, 2) = 0.16003381713738053e-6, (133, 1) = 6.6, (133, 2) = -0.21377647792892648e-6, (134, 1) = 6.65, (134, 2) = 0.2638119651684455e-6, (135, 1) = 6.7, (135, 2) = -0.31029367903289395e-6, (136, 1) = 6.75, (136, 2) = 0.3533715778983202e-6, (137, 1) = 6.8, (137, 2) = -0.3931920604894687e-6, (138, 1) = 6.85, (138, 2) = 0.4298978711906126e-6, (139, 1) = 6.9, (139, 2) = -0.4636280263535863e-6, (140, 1) = 6.95, (140, 2) = 0.494517759612214e-6, (141, 1) = 7.0, (141, 2) = -0.5226984843620009e-6, (142, 1) = 7.05, (142, 2) = 0.5482977717131691e-6, (143, 1) = 7.1, (143, 2) = -0.5714393423533197e-6, (144, 1) = 7.15, (144, 2) = 0.5922430708876365e-6, (145, 1) = 7.2, (145, 2) = -0.610825001331253e-6, (146, 1) = 7.25, (146, 2) = 0.6272973725430698e-6, (147, 1) = 7.3, (147, 2) = -0.641768652482882e-6, (148, 1) = 7.35, (148, 2) = 0.6543435802710991e-6, (149, 1) = 7.4, (149, 2) = -0.6651232151103739e-6, (150, 1) = 7.45, (150, 2) = 0.6742049912106031e-6, (151, 1) = 7.5, (151, 2) = -0.6816827779311618e-6, (152, 1) = 7.55, (152, 2) = 0.6876469444194619e-6, (153, 1) = 7.6, (153, 2) = -0.6921844280904861e-6, (154, 1) = 7.65, (154, 2) = 0.6953788063481056e-6, (155, 1) = 7.7, (155, 2) = -0.6973103710014924e-6, (156, 1) = 7.75, (156, 2) = 0.6980562048815929e-6, (157, 1) = 7.8, (157, 2) = -0.6976902602061175e-6, (158, 1) = 7.85, (158, 2) = 0.6962834382846133e-6, (159, 1) = 7.9, (159, 2) = -0.6939036701932665e-6, (160, 1) = 7.95, (160, 2) = 0.690615998086224e-6, (161, 1) = 8.0, (161, 2) = -0.6864826568410622e-6, (162, 1) = 8.05, (162, 2) = 0.6815631557688252e-6, (163, 1) = 8.1, (163, 2) = -0.6759143601450263e-6, (164, 1) = 8.15, (164, 2) = 0.669590572344911e-6, (165, 1) = 8.2, (165, 2) = -0.6626436123890619e-6, (166, 1) = 8.25, (166, 2) = 0.6551228977290213e-6, (167, 1) = 8.3, (167, 2) = -0.647075522119317e-6, (168, 1) = 8.35, (168, 2) = 0.6385463334437125e-6, (169, 1) = 8.4, (169, 2) = -0.629578010378859e-6, (170, 1) = 8.45, (170, 2) = 0.6202111377936157e-6, (171, 1) = 8.5, (171, 2) = -0.6104842807971703e-6, (172, 1) = 8.55, (172, 2) = 0.6004340573606388e-6, (173, 1) = 8.6, (173, 2) = -0.5900952094508935e-6, (174, 1) = 8.65, (174, 2) = 0.5795006726227363e-6, (175, 1) = 8.7, (175, 2) = -0.5686816440282655e-6, (176, 1) = 8.75, (176, 2) = 0.5576676488088356e-6, (177, 1) = 8.8, (177, 2) = -0.5464866048451384e-6, (178, 1) = 8.85, (178, 2) = 0.5351648858455677e-6, (179, 1) = 8.9, (179, 2) = -0.5237273827621483e-6, (180, 1) = 8.95, (180, 2) = 0.5121975635274654e-6, (181, 1) = 9.0, (181, 2) = -0.5005975311119593e-6, (182, 1) = 9.05, (182, 2) = 0.488948079906314e-6, (183, 1) = 9.1, (183, 2) = -0.4772687504359755e-6, (184, 1) = 9.15, (184, 2) = 0.46557788242095225e-6, (185, 1) = 9.2, (185, 2) = -0.45389266619653036e-6, (186, 1) = 9.25, (186, 2) = 0.4422291925122823e-6, (187, 1) = 9.3, (187, 2) = -0.43060250073186364e-6, (188, 1) = 9.35, (188, 2) = 0.4190266254556287e-6, (189, 1) = 9.4, (189, 2) = -0.4075146415927183e-6, (190, 1) = 9.45, (190, 2) = 0.39607870790862633e-6, (191, 1) = 9.5, (191, 2) = -0.38473010907775763e-6, (192, 1) = 9.55, (192, 2) = 0.37347929627010353e-6, (193, 1) = 9.6, (193, 2) = -0.362335926303425e-6, (194, 1) = 9.65, (194, 2) = 0.35130889939221703e-6, (195, 1) = 9.7, (195, 2) = -0.34040639552618525e-6, (196, 1) = 9.75, (196, 2) = 0.3296359095107469e-6, (197, 1) = 9.8, (197, 2) = -0.3190042847032402e-6, (198, 1) = 9.85, (198, 2) = 0.30851774547799635e-6, (199, 1) = 9.9, (199, 2) = -0.29818192845446557e-6, (200, 1) = 9.95, (200, 2) = 0.2880019125209349e-6, (201, 1) = 10.0, (201, 2) = -0.2779822476886622e-6}, datatype = float[8], order = C_order)

(5)

 

 

 

 


 

Download heat_equation_(2).mw

Hi, I know the commands for when both curves/functions are y=....., but not when one of them is y=... and the other is a straight line going through the x-axis. I would like to be able to find the points of intersection in decimals, to plot them together such that I can see the points of intersection and finally I need to find he area enclosed between the two. Would appreciate your help.

Hello :)

When points of triangle, A, B, C (R^2) are given, how to find area of triangle; equation and radius of circle which passes traingle(A,B,C) and height(AH).

or where can i find information about how to do this?

thank you so much:)

Hello! with the datapoints below I've calulated the results "manually" 
I'm looking for a way to make Maple tell me the intersection of these datapoints with the x-axis and also, the area under it from e.g. 0 to 5.125, which i've also had to calculate by hand... I know I can use int comand to do this, but I think there is a lot wrong with the syntax, so after hours of failure I hope someone can show me the right commands..

 

Thanks, 
krismalo
 

 

 

t1 := Matrix(14, 2, {(1, 1) = 0, (1, 2) = 0, (2, 1) = 0, (2, 2) = 4170, (3, 1) = 1, (3, 2) = 3966, (4, 1) = 1, (4, 2) = 3466, (5, 1) = 3, (5, 2) = 3058, (6, 1) = 3, (6, 2) = 3058, (7, 1) = 4, (7, 2) = 1854, (8, 1) = 4, (8, 2) = 1354, (9, 1) = 7, (9, 2) = -2258, (10, 1) = 7, (10, 2) = -2758, (11, 1) = 8, (11, 2) = -3962, (12, 1) = 8, (12, 2) = -3962, (13, 1) = 10, (13, 2) = -4370, (14, 1) = 10, (14, 2) = 0})plot(t1); =  

 

 

The intersection of this plot with the x-axis should be ≈ 5.125 and the area from 0 to 5.125 (or from 5.125 to 10) should be ≈ 13810

 

 

 

 

NULL


 

Download primes_area_question.mw

Hello, i am doing some schmidt-analysis on a stirling engine, but my question is rather simple. I have the measured presure P at a given time T as a 229x2 matrix, i also have a function, V__total(T), for the total volume of the engine at a given time T. 

I then go on to create a pointplot PV, which is rougly the shape of a potato. I now want to find the area enclosed by this point plot, is there any way? 

I do something like:

> DATA:=ImportMatrix(filepath,skiplines=1); %import data from .txt file, skip header line. 

>P:=DeleteColumn(DATA,1); %Isolate presure column

>T:=DeleteColumn(DATA,2); %Isolate time coliumn

>V:=V__total~(T); %Generate volume vector as a function of time T

>pointplot(<P|V>,connect=true);

Is there any wat to finde the area enclosed by the curve/ Int(P,V)

Dears,

I would like to draw a spectrum of plots. For example sin(mx) when m ∈ [1,2] and x ∈ [0,2] that is a spectrum of sinous plots. Obviously, if I write

plot(sin(m*x), m = 1 .. 2, x = 0 .. 2)

I will receive the error

Warning, expecting only range variable m in expression sin(m*x) to be plotted but found name x

I expect that there exist an alternative plot command in Maple, able to do that. I checked some members of Plots family that their name conducted me to check them. Moreover, I searched the web: but the most common retrieved results are related to drawing the area between two plots or under one plot.

A real example of what I am looking for is (not exaclty but something like) the below picure

A plot of Gaussian plots

Could you please let me know the alternative plot command, satisfying my requirement?

I related two Text Area Components by using the codes "Do(%text_beta_radian=evalf(%text_beta_degress/180*Pi))".

I wanna know what codes can refresh the display of the text area component with name%text_beta_radian

after I change the input value of that%text_beta_degress?

Hi to all

I had solve a set of ODEs using rkf45 method and I had plot it's Diagram now I need to have area under my diagram.what should I do? what is code?

 

Hi,

I have a small problem. I want to findout area under a curve. I got the plot from solving a partial differential equation. I want to find out area under the curve with out using interpolation. Are there any methods to find this.

 

here i enclose the method i have done.

Es := 0.117108e12:
Ef := 0.78125e11:
l := 0.150e-6:
s := 0.500000e-3:
f := 0.5898334197e-6:
o := 0.9e-5:
d := 0.10e-17:
cb := 0.1e7/(19.9):
c := l*f/(d*cb):

PDE := diff(u(x, t), t)-(diff(u(x, t), x, x)) = 0:
            
with(plots):
with(plottools):
ys := -0.4245333333e-1:
IBC1 := {u(x, 0) = 0, (D[1](u))(0, t) = 0, (D[1](u))(1, t) = c}:
S1 := pdsolve(PDE, IBC1, numeric, time = t, timestep = 0.1e-2);

p2 := S1:-plot(t = .2525);

p3 := getdata(p2);

p3[3]:
co:=CurveFitting[PolynomialInterpolation](p3[3], x):
Area := int(co, x = x[1] .. x[2]):

So this is the procedure i used to find out, but can there be any other procedure to findout area directly from hte solution of PDE.

Thanks.



 

Not sure exactly how i could achieve this but:

how do i determine the value of k for which the graphs p(x) = x^2+2x+3 and q(x) = k+5x-7x^2 enclose an area of exactly 36?

I have to do it in maple and using i guess area under the curve.

Thanks

Hi,

I'm pretty new into MAPLE andI'm trying to get into it.

I have these four equations:


eq1:=1.6*10^(-7)*R*sin(t)-4.4*10^(-14)*R^2*cos(t)*sin(t)-1.6*10^(-14)*R^2*cos(t)^2+4.2*10^(-14)*R^2-1.3+2.1*10^(-9)*R*cos(t)=0; eq2 :=8.3*10^(-8)*R*sin(t)-1.2*10^(-13)*R^2*cos(t)*sin(t)-2.9*10^(-44)*R^2*cos(t)^2+7.1*10^(-14)*R^2-1.3+8.3*10^(-8)*R*cos(t)=0; eq3 :=8.3*10^(-8)*R*sin(t)-1.2*10^(-13)*R^2*cos(t)*sin(t)-2.2*10^(-44)*R^2*cos(t)^2+7.1*10^(-14)*R^2-1.3+8.3*10^(-8)*R*cos(t)=0; eq4 :=2.1*10^(-9)*R*sin(t)-4.4*10^(-14)*R^2*cos(t)*sin(t)+1.6*10^(-14)*R^2*cos(t)^2+2.6*10^(-14)*R^2-1.3+1.6*10^(-7)*R*cos(t)=0;
 

Hi Maple friends.

If I have y=-x^2+9 and y=x+3, how can I find the area that is bounded by the functions? 

Easy enough to calculate by hand, but I need to use Maple to check my answers. Most preferably I'd like to use the Maple context menu to get the result, but any solution will be appreciated.

Thanks in advance.

Hi Maple friends.

As per usual, I am unable to find the solution in Maple Help. Can someone please advice me on how to shade an area under a curve, preferably using the context menu, since that is what I prefer to use at this stage.

Thanks in advance.

Calculate the area of an image limited by ruler
x=y ; x=2y ; x+y=a ; x+3y=a

Given a figure in the plane bounded by the non-selfintersecting piecewise smooth curve. Each segment in the border defined by the list in the following format (variable names  in expressions can be arbitrary):

1) If this segment is given by an explicit equation, then  [f(x), x=x1..x2)]

2) If it is given in polar coordinates, then  [f(phi), phi=phi1..phi2, polar] , phi is polar angle

3) If the segment is given parametrically, then  [[f(t), g(t)], t=t1..t2]

4) If several consecutive segments or entire border is a broken line, then it is sufficient to set vertices the broken line [ [x1,y1], [x2,y2], .., [xn,yn]]

 

The first procedure symbolically finds perimeter of the figure. Global variable  Q  saves the lengths of all segments.

Perimeter := proc (L) #  L is the list of all segments of the border

local i, var, var1, var2, e, e1, e2, P;

global Q;

for i to nops(L) do if type(L[i], listlist(algebraic)) then P[i] := seq(simplify(sqrt((L[i, j, 1]-L[i, j+1, 1])^2+(L[i, j, 2]-L[i, j+1, 2])^2)), j = 1 .. nops(L[i])-1) else

var := lhs(L[i, 2]); var1 := min(lhs(rhs(L[i, 2])), rhs(rhs(L[i, 2]))); var2 := max(lhs(rhs(L[i, 2])), rhs(rhs(L[i, 2])));

if type(L[i, 1], algebraic) then e := L[i, 1]; if nops(L[i]) = 3 then P[i] := simplify(int(sqrt(e^2+(diff(e, var))^2), var = var1 .. var2)) else

P[i] := simplify(int(sqrt(1+(diff(e, var))^2), var = var1 .. var2)) end if else

e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := abs(simplify(int(sqrt((diff(e1, var))^2+(diff(e2, var))^2), var = var1 .. var2))) end if end if end do;

Q := [seq(P[i], i = 1 .. nops(L))];

add(Q[i], i = 1 .. nops(Q));

end proc:

 

The second procedure symbolically finds the area of the figure. For correct work of the procedure, all the segments in the list L  of border must pass sequentially in clockwise or counter-clockwise direction.

Area := proc (L)

local i, var, e, e1, e2, P;

for i to nops(L) do

if type(L[i], listlist(algebraic)) then P[i] := (1/2)*add(L[i, j, 1]*L[i, j+1, 2]-L[i, j, 2]*L[i, j+1, 1], j = 1 .. nops(L[i])-1) else

var := lhs(L[i, 2]);

if type(L[i, 1], algebraic) then e := L[i, 1];

if nops(L[i]) = 3 then P[i] := (1/2)*(int(e^2, L[i, 2])) else

P[i] := (1/2)*simplify(int(var*(diff(e, var))-e, L[i, 2])) end if else

e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := (1/2)*simplify(int(e1*(diff(e2, var))-e2*(diff(e1, var)), L[i, 2])) end if end if

end do;

abs(add(P[i], i = 1 .. nops(L)));

end proc:

 

The third procedure shows this figure. To paint the interior of the boundary polyline approximation is used. Required parameters: L - a list of all segments of the border and C - the color of the interior of the figure in the format color = color of the figure. Optional parameters: N - the number of parts for the approximation of each segment (default N = 100) and Boundary is defined by a list for special design of the figure's border (the default border is drawed by a thin black line). The border of the figure can be drawn separately without filling the interior by the global variable Border.

Picture := proc (L, C, N::posint := 100, Boundary::list := [linestyle = 1])

local i, var, var1, var2, e, e1, e2, P, Q, h;

global Border;

for i to nops(L) do

if type(L[i], listlist(algebraic)) then P[i] := op(L[i]) else

var := lhs(L[i, 2]); var1 := lhs(rhs(L[i, 2])); var2 := rhs(rhs(L[i, 2])); h := (var2-var1)/N;

if type(L[i, 1], algebraic) then e := L[i, 1];

if nops(L[i]) = 3 then P[i] := seq(subs(var = var1+h*i, [e*cos(var), e*sin(var)]), i = 0 .. N) else

P[i] := seq([var1+h*i, subs(var = var1+h*i, e)], i = 0 .. N) end if else

e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := seq(subs(var = var1+h*i, [e1, e2]), i = 0 .. N) end if end if

end do;

Q := [seq(P[i], i = 1 .. nops(L))];

Border := plottools[curve]([op(Q), Q[1]], op(Boundary));

[plottools[polygon](Q, C), Border];

end proc:

 

Examples of works:

Example 1.

L := [[sqrt(-x), x = -1 .. 0], [2*cos(t), t = -(1/2)*Pi .. (1/4)*Pi, polar], [[1, 1], [1/2, 0], [0, 3/2]], [[-1+cos(t), 3/2+(1/2)*sin(t)], t = 0 .. -(1/2)*Pi]];

Perimeter(L); Q; evalf(`%%`); evalf(`%%`); Area(L); 

plots[display](Picture(L, color = grey, [color = "DarkGreen", thickness = 4]), scaling = constrained);

plots[display](Border, scaling = constrained);

Example 2.

The easiest way to use this  procedures for polygons.

 L := [[[3, -1], [-2, 2], [5, 6], [2, 3/2], [3, -1]]];

Perimeter(L), Q;

Area(L);

plots[display](Picture(L, color = pink, [color = red, thickness = 3]));

 

 

Example 3 (more complicated )

3 circles on the plane C1, C2 and C3 defined by the parametric equations  of their borders. We want to find the perimeter, area, and paint the figure  C3 minus (C1 union C2) . For details see attached file. 

C1 := {x = -sqrt(7)+4*cos(t), y = 4*sin(t)};

C2 := {x = 3*cos(s), y = 3+3*sin(s)};

C3 := {x = 4+5*cos(u), y = 5*sin(u)};

L := [[[-sqrt(7)+4*cos(t), 4*sin(t)], t = -arccos((1/4)*(7+4*sqrt(7))/(sqrt(7)+4)) .. -arctan((3*(-23+sqrt(7)*sqrt(55)))/(23*sqrt(7)+9*sqrt(55)))], [[3*cos(s), 3+3*sin(s)], s = -arctan((1/3)*(9+sqrt(7)*sqrt(55))/(-sqrt(7)+sqrt(55))) .. arctan((1/3)*(-9+4*sqrt(91))/(4+sqrt(91)))], [[4+5*cos(u), 5*sin(u)], u = arctan((3*(41+4*sqrt(91)))/(-164+9*sqrt(91)))+Pi .. arctan(3/4)-Pi]];

Perimeter(L), Q; evalf(%);

Area(L); evalf(%)

 A := plot([[rhs(C1[1]), rhs(C1[2]), t = 0 .. 2*Pi], [rhs(C2[1]), rhs(C2[2]), s = 0 .. 2*Pi], [rhs(C3[1]), rhs(C3[2]), u = 0 .. 2*Pi]], color = black);

B := Picture(L, color = green, [color = black, thickness = 4]);

plots[display](A, B, scaling = constrained);

More examples and all codes see in attached file

Plane_figure.mw

1 2 Page 1 of 2