Isosceles Right Triangle

Author

Eric W. Weisstein
July 23, 2014

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Polygons/IsoscelesRightTriangle.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/IsoscelesRightTriangle.html.

©2014 Wolfram Research, Inc. except for portions noted otherwise

Definitions

ineq=y≥0&&a≥x+y&&x≥0;

implreg=ImplicitRegion[ineq,{x,y}];

reg=Triangle[{{0,0},{0,a},{a,0}}];

assum=a>0;

t=reg;

Figure

PlaneGeometry.m

r=right/.{a->1};
v=Vertices[r];
pts={v[[1]],C,v[[2]],A,v[[3]],B};

Show[Graphics[{r,
{VertexArc[#,.17],EqualAngleTicks[#,1,.17,.05,0]}&/@NestList[RotateRight,RotateLeft[v],1],
PerpSquare[Rest[Sides[r]],.1,4],
PointLabels[r,pts,.03,-.05]
},AspectRatio->Automatic]
]

Height

SSSTriangle[1,1,(Sqrt[2])]

With[{s=.07},Graphics[{
FaceForm[LightYellow],EdgeForm[Darker@Yellow],SSSTriangle[1,1,(Sqrt[2])],
{Darker@Yellow,Line[{(1/(Sqrt[2])),(1/(Sqrt[2]))}+RotationMatrix[-3π/4].#&/@{{s,0},{s,s},{0,s}}]}
}]]

Equations

Inequality

right=Triangle[{{0,0},{a,0},{0,a}}];

FullSimplify[Inequalities[right,{x,y}],a>0]

ineq[x_,y_]:=y≥0&&a≥x+y&&x≥0

RegionPlot[ineq[x,y]/.a->1,{x,0,1},{y,0,1}]

Plots

Diagram

Show[LaminaData["FilledIsoscelesRightTriangle","Diagram"],Axes->False]

DiscretizeRegion

Block[{a=1},Show[DiscretizeRegion[reg],ImageSize->Small]]

RegionPlot

Block[{a=1},RegionPlot[ineq,{x,0,a},{y,0,a},AspectRatio->Automatic,ImageSize->Small,Frame->False]]

Properties

Area

Area

Assuming[assum,Simplify@Area[reg]]

Integrate

Assuming[a>0,Area[ineq[x,y],{x,y}]]//FullSimplify//Timing

RegionMeasure

Assuming[assum,Simplify@RegionMeasure[reg]]

TriangleArea

TriangleArea[right]

Centroid

Integrate

Assuming[a>0,Centroid[ineq[x,y],{x,y}]]//FullSimplify//Timing

RegionCentroid

Assuming[assum,Simplify@RegionCentroid[reg]]

Circumcircle

FullSimplify[Circumcircle[t],𝒶>0]/.𝒶->a

Circumradius

FullSimplify[PowerExpand[Circumradius[right]]]

r=right/.a->1;
v=Vertices[r];
c=Circumcenter[r];
bluepts={c,O};

Show[Graphics[{
r,
PerpSquare[Rest[Sides[r]],.05,4],
{VertexArc[#,.1],EqualAngleTicks[#,1,.1,.04,0]}&/@NestList[RotateRight,RotateLeft[v],1],
{
Blue,
PointLabels[r,bluepts,.03,.05],
Circumcircle[r],
Line[{Coordinates@c,Vertices[r][[1]]}]
},
PointLabels[r,pts,.03,-.05]
},AspectRatio->Automatic]
]

SideLengths

abc=Simplify[SideLengths[Evaluate[t]],𝒶>0]

Hypotenuse

PowerExpand[SideLengths[right]]

Incircle

FullSimplify[Incircle[t],𝒶>0]/.𝒶->a

Inradius

r=right/.{a->1};
i=Incenter[r];
v=Vertices[r];

pts={v[[1]],C,v[[2]],A,v[[3]],B};
bluepts={i,"\!\(\*
StyleBox[\"I\",\nFontSlant->\"Italic\"]\)"};
Show[Graphics[{
r,
PerpSquare[Rest[Sides[r]],.05,4],
{VertexArc[#,.1],EqualAngleTicksAboutBisectors[#,1,.1,.03,0]}&/@NestList[RotateRight,RotateLeft[v],1],
{Thickness[.01],Incircle[r]},
{
Red,
PerpSquare[#,.05,2]&/@Transpose[{PedalLines[r,i],Sides[r]}],Dashing[{.02,.02}],
PedalLines[r,i]
},
{
Blue,
PointLabels[r,bluepts,.03,.05],Line[{#[[1]],Coordinates@i,#[[2]]}]&/@Partition[Vertices[r],2,1,1]
},
PointLabels[r,pts,.03,-.05]
},AspectRatio->Automatic]
]

i=FullSimplify[PowerExpand[Inradius[right]]]

Collect[%,a]

Together[%]

InertiaTensor

Assuming[a>0,AreaInertiaTensor[ineq[x,y],{x,y}]]//FullSimplify//Timing

RadiiOfGyration

Assuming[a>0,FullSimplify[RadiiOfGyration[ineq[x,y],{x,y}]]]//Timing

GeneralizedDiameter

ineqs=FullSimplify[And@@ineq@@@{{x1,y1},{x2,y2}},a>0]/.a->1

Maximize[{(x1-x2)^2+(y1-y2)^2,ineqs},{x1,x2,y1,y2},Reals]//Timing

Line Picking

Region

<<Graphics`InequalityGraphics`

InequalityPlot[0<x<1&&0<y<1-x,{x},{y}]

Animation

p=Partition[{#1,1-#2}&@@@(Sort/@Table[Random[],{50},{2}]),2];
lines=Reverse[NestList[Most,Transpose[{Table[Hue[Random[]],{Length[p]}],Line/@p}],Length[p]-1]];

movie=Show[Graphics[{
Line[{{0,1},{0,0},{1,0},{0,1}}],
Thickness[.02],
#}],AspectRatio->Automatic]&/@lines;

GraphicsGrid[Partition[Take[movie,12],4],ImageSize->500]

movie=Show[Graphics[{
Line[{{0,1},{0,0},{1,0},{0,1}}],
Thickness[.02],
#}],AspectRatio->Automatic]&/@lines;

<<Utilities`GIF`;

Export[gifs<>"EquilateralTriangleLinePicking.gif",movie]//Timing

MonteCarlo

Slower

p=Select[Table[Random[],{5000},{2}],Less@@#&];

Faster

p=Sort/@Table[Random[],{10^7},{2}];//Timing

Show[Graphics[{
Point/@Take[p,100]
},AspectRatio->Automatic]
]

dist=Sqrt[#.#]&/@Subtract@@@Partition[p,2];//Timing

Partition[Through[{Mean,StandardDeviationOfMean,Variance,StandardDeviationOfVariance}[dist]],2]//Timing

<<Graphics`Graphics`

BarChart[Length/@Split[Ceiling[600Sort[dist]]],Ticks->None,BarEdges->None,BarSpacing->-.2,PlotRange->{{0,800},All},AxesLabel->TraditionalForm/@{l,P[l]}]

CAD

<<Graphics`InequalityGraphics`

ineq[{x_,y_}]:=Inequalities[Triangle[{{0,0},{1,0},{0,1}}],{x,y}]

InequalityPlot[ineq[{x,y}],{x},{y}]

Exact

FullSimplify[(1/30) (32-26 (Sqrt[2])+(4+(Sqrt[2])) ArcSinh[1])+(Sqrt[2])-1]

N[(1/30) (2+4 (Sqrt[2])+(4+(Sqrt[2])) ArcSinh[1]),10]

N[Sqrt[2]-1,10]

N[(1/30) (2+4 (Sqrt[2])+(4+(Sqrt[2])) ArcSinh[1])-((Sqrt[2])-1),20]

Normalization

Integrate[1,{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2}]

Numeric

4NIntegrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Method->QuasiMonteCarlo]

4NIntegrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,x1,1},{y2,x2,1},Method->QuasiMonteCarlo]

Multiple Integrals All at Once Using Assumptions

Correct Value

Integrate[1,{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2}]

N[(1/30) (2+4 (Sqrt[2])+(4+(Sqrt[2])) ArcSinh[1]),10]

v4.2

Most[l_]:=Drop[l,-1]

FullSimplify[i=4IntegrateWithAssumptions2[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True]]//Timing

N[%]

i=Integrate[(1/6) ((Sqrt[(((-1+x1))^2)+(((x1-x2))^2)])-2 x1 (Sqrt[(((-1+x1))^2)+(((x1-x2))^2)])-(x1^2) (Sqrt[(((-1+x1))^2)+(((x1-x2))^2)])+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])-2 (x1^2) (Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+(2+(Sqrt[2])) ((((((x1-x2))^2)))^(3/2))+4 x1 (Sqrt[(((-1+x1))^2)+(((x1-x2))^2)]) x2-2 (Sqrt[(((x1-x2))^2)+(((-1+x2))^2)]) x2+4 x1 (Sqrt[(((x1-x2))^2)+(((-1+x2))^2)]) x2-2 (Sqrt[(((-1+x1))^2)+(((x1-x2))^2)]) (x2^2)-(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)]) (x2^2)-3 (-1+x1) (((x1-x2))^2) Log[1-x1+(Sqrt[(((-1+x1))^2)+(((x1-x2))^2)])]-3 (x1^2) Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]+6 x1 x2 Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]+3 (x1^2) x2 Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]-3 (x2^2) Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]-6 x1 (x2^2) Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]+3 (x2^3) Log[-1+(Sqrt[(((x1-x2))^2)+(((-1+x2))^2)])+x2]+3 (x1^3) Log[-x1+(Sqrt[2]) (Sqrt[(((x1-x2))^2)])+x2]-9 (x1^2) x2 Log[-x1+(Sqrt[2]) (Sqrt[(((x1-x2))^2)])+x2]+9 x1 (x2^2) Log[-x1+(Sqrt[2]) (Sqrt[(((x1-x2))^2)])+x2]-3 (x2^3) Log[-x1+(Sqrt[2]) (Sqrt[(((x1-x2))^2)])+x2]),x2];

Simplify[Limit[i,x2->1,Direction->1]-Limit[i,x2->0,Direction->-1],0<x1<1]

NIntegrate[%,{x1,0,1}]

v5.0 IntegrateWithAssumptions

FullSimplify[i=4IntegrateWithAssumptions[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True]]//Timing

N[%]

v5.0 IntegrateWithAssumptions2

FullSimplify[i=4IntegrateWithAssumptions2[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True]]//Timing

v5.0 again

(i=4IntegrateWithAssumptions2[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True])//Timing

v5.1 GenerateConditions->Automatic

(i=4Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2}])//Timing

...ran overnight....

v5.1 GenerateConditions->True

(i=4Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},GenerateConditions->True])//Timing

v5.1 IntegrateWithAssumptions

(i=4IntegrateWithAssumptions2[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True])//Timing

v6 GenerateConditions->Automatic

(i=4Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2}])//Timing

...crashed/ran out of memory?...

v6 GenerateConditions->True

(i=4Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},GenerateConditions->True])//Timing

v6 IntegrateWithAssumptions

(i=4IntegrateWithAssumptions[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True])//Timing

v6 WithAssumptions2

(i=4IntegrateWithAssumptions2[(Sqrt[(x1-x2)^2+(y1-y2)^2]),{x1,0,1},{x2,0,1},{y1,0,1-x1},{y2,0,1-x2},Debug->True])//Timing

Broken Up by Hand v5.0

First Integral

int1=Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),y1]//FullSimplify

i1=FullSimplify[(int1/.y1->1-x1)-(int1/.y1->0),0<x1<1&&0<x2<1&&0<y2<1-x2]

4NIntegrate[i1,{x1,0,1},{x2,0,1},{y2,0,1-x2},Method->MonteCarlo,MaxPoints->10^6,PrecisionGoal->3,AccuracyGoal->Infinity]//Timing

Second Integral

int2=FullSimplify[Integrate[i1,y2],0<x1<1&&0<x2<1]

i2=FullSimplify[(int2/.y2->1-x2)-(int2/.y2->0),0<x1<1&&0<x2<1]

4NIntegrate[i2,{x1,0,1},{x2,0,1},Method->MonteCarlo,MaxPoints->10^6,PrecisionGoal->3,AccuracyGoal->Infinity]//Timing

Third Integral

Indefinite returns unevaluated

Timing[int3=Simplify[Integrate[i2,x1],0<x2<1]]

So do definite

Timing[i3=Integrate[i2,{x1,0,1},Assumptions->0<x2<1]]

4NIntegrate[i3,{x2,0,1}]//Timing

...off by -i π...

Timing[i3s=Simplify[i3+I Pi/4,0<x2<1]]

4NIntegrate[i3s,{x2,0,1}]//Timing

Fourth Integral

Timing[i4=Integrate[i3s,{x2,0,1}]]

4N[i4]

Timing[i4=Integrate[i3s,{x2,0,1}]]

4N[i4]

FullSimplify[i4]

<<Utilities`Simplify`

FullSimplify[LogExpand[(1/57600)(960+1920 (Sqrt[2])-6720 I π+(480+360 (Sqrt[2])) ArcSinh[1]-(Sqrt[2]) Log[1152921504606846976]-720 Log[3-2 (Sqrt[2])]+120 (Sqrt[2]) Log[2+(Sqrt[2])])]]

Simplifying the Result

i42=TrigToExp[i4]/.a_ Log[b_]:>log[b^a]//.log[x_]+log[y_]:>log[x y]/.log[x_]:>Log[FullSimplify[x]]

4N[i42]

4N[(1/60)+(1/(15 (Sqrt[2])))+Log[(2^(1/(120 (Sqrt[2])))) (((1+(Sqrt[2])))^((1/30)+(1/(80 (Sqrt[2]))))) (((2+(Sqrt[2])))^(-(1/(60 (Sqrt[2]))))) (((3+2 (Sqrt[2])))^(-(1/(96 (Sqrt[2]))))) (((99+70 (Sqrt[2])))^(1/(144 (Sqrt[2]))))]]

4N[(1/60)+(1/(15 (Sqrt[2])))+(1/30)Log[1+(Sqrt[2])]+Log[(2^(1/(120 (Sqrt[2])))) (((1+(Sqrt[2])))^(1/(80 (Sqrt[2])))) (((2+(Sqrt[2])))^(-(1/(60 (Sqrt[2]))))) (((3+2 (Sqrt[2])))^(-(1/(96 (Sqrt[2]))))) (((99+70 (Sqrt[2])))^(1/(144 (Sqrt[2]))))]]

4N[(1/60)+(1/(15 (Sqrt[2])))+(1/30)Log[1+(Sqrt[2])]+(1/(Sqrt[2]))Log[(2^(1/(120 ))) (((1+(Sqrt[2])))^(1/(80 ))) (((2+(Sqrt[2])))^(-(1/(60 )))) (((3+2 (Sqrt[2])))^(-(1/(96 )))) (((99+70 (Sqrt[2])))^(1/(144 )))]]

4N[(1/60)+(1/(15 (Sqrt[2])))+(1/30)Log[1+(Sqrt[2])]+(1/(Sqrt[2]))Log[(2^(1/(120 ))) (((1+(Sqrt[2])))^(1/(80 ))) (((2+(Sqrt[2])))^(-(1/(60 )))) ((((1+Sqrt[2])^2))^(-(1/(96 )))) ((((1+Sqrt[2])^6))^(1/(144 )))]]

FullSimplify[Log[Expand[(2^(1/(120 ))) (((1+(Sqrt[2])))^(1/(80 ))) (((2+(Sqrt[2])))^(-(1/(60 )))) ((((1+Sqrt[2])^2))^(-(1/(96 )))) ((((1+Sqrt[2])^6))^(1/(144 )))]]]

4N[(1/60)+(1/(15 (Sqrt[2])))+(1/30)Log[1+(Sqrt[2])]+(1/(Sqrt[2]))(1/120) (4 ArcSinh[1]-Log[3+2 (Sqrt[2])])]

Simplify[Expand[4FullSimplify[(1/60)+(1/(15 (Sqrt[2])))+(1/30)Log[1+(Sqrt[2])]+(1/(Sqrt[2]))(1/120) (4 ArcSinh[1]-2Log[1+(Sqrt[2])])]]]

N[%]

Timing[i4=Integrate[i3s,{x2,0,1}]]

4N[i4]

FullSimplify[i4]

Broken Up by Hand v6

First Integral

(int1=Integrate[(Sqrt[(x1-x2)^2+(y1-y2)^2]),y1]//FullSimplify)//Timing

i1=FullSimplify[(int1/.y1->1-x1)-(int1/.y1->0),0<x1<1&&0<x2<1&&0<y2<1-x2]

4NIntegrate[i1,{x1,0,1},{x2,0,1},{y2,0,1-x2},Method->MonteCarlo,MaxPoints->10^6,PrecisionGoal->3,AccuracyGoal->Infinity]//Timing

Second Integral

(int2=FullSimplify[Integrate[i1,y2],0<x1<1&&0<x2<1])//Timing

(i2=FullSimplify[(int2/.y2->1-x2)-(int2/.y2->0),0<x1<1&&0<x2<1])//Timing

4NIntegrate[i2,{x1,0,1},{x2,0,1},Method->MonteCarlo,MaxPoints->10^6,PrecisionGoal->3,AccuracyGoal->Infinity]//Timing

Third Integral

Indefinite returns unevaluated

(int3=Simplify[Integrate[i2,x1],0<x2<1])//Timing

So do definite

(i3=Integrate[i2,{x1,0,1},Assumptions->0<x2<1])//Timing

4NIntegrate[i3,{x2,0,1}]//Timing

...off by -i π...

(i3=Integrate[i2,{x1,0,1},Assumptions->0<x2<1,GenerateConditions->True])//Timing

4NIntegrate[i3,{x2,0,1}]//Timing

Timing[i3s=Simplify[i3+I Pi/4,0<x2<1]]

4NIntegrate[i3s,{x2,0,1}]//Timing

Fourth Integral

Timing[i4=Integrate[i3s,{x2,0,1}]]

4N[i4]

Distribution

Integrate[DiracDelta[d^2-((x1-x2)^2+(y1-y2)^2)],{y1,0,1-x1}]