@@ -717,6 +717,41 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
717717< div >
718718< h5 style ="font-size:160%;margin:7px; "> Area of a regular polygon</ h5 >
719719< br >
720+ < br >
721+ < div >
722+ < label style ="margin:12px; " for ="side-number "> Number of Sides:</ label >
723+ < input id ="side-number " type ="number " value ="3 " step ="1 " />
724+ < br >
725+ < label style ="margin:12px; " for ="side-length "> Length of Sides:</ label >
726+ < input id ="side-length " type ="number " value ="1 " step ="any " />
727+
728+ < script >
729+ function polygonArea ( number , length ) {
730+ const angle = 3.2 / number ;
731+ const tan = Trig . queryTan ( angle ) ) ;
732+
733+ return ( number / 4 ) * ( length ** 2 ) / tan ;
734+ }
735+
736+ function updatePolygonArea ( ) {
737+ const number = parseFloat ( document . getElementById ( 'side-number' ) . value ) ;
738+ const length = parseFloat ( document . getElementById ( 'side-length' ) . value ) ;
739+
740+ if ( isNaN ( number ) || isNaN ( length ) ) {
741+ document . getElementById ( 'polygon-area' ) . innerText = '' ;
742+ return ;
743+ }
744+
745+ document . getElementById ( 'polygon-area' ) . innerText =
746+ `Area: ${ polygonArea ( number , length ) . toFixed ( 5 ) } square units` ;
747+ }
748+
749+ document . getElementById ( 'side-number' ) . addEventListener ( 'input' , updatePolygonArea ) ;
750+ document . getElementById ( 'side-length' ) . addEventListener ( 'input' , updatePolygonArea ) ;
751+ </ script >
752+ < p style ="margin:12px; " id ="polygon-area "> </ p >
753+ </ div >
754+ < br >
720755< div class ="imgbox ">
721756 < img class ="center-fit " src ="pentagon.png " alt ="Pentagon " id ="pentagon ">
722757 </ div >
@@ -800,7 +835,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
800835< br >
801836< br >
802837< div >
803- < label style ="margin:12px; " for ="circle-radius-a "> Circle Radius:</ label >
838+ < label style ="margin:12px; " for ="circle-radius-a "> Radius:</ label >
804839< input id ="circle-radius-a " type ="number " value ="1 " step ="any " />
805840
806841< script >
@@ -816,7 +851,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
816851 }
817852
818853 document . getElementById ( 'circle-area' ) . innerText =
819- `Area: ${ circleArea ( radius ) . toFixed ( 5 ) } units² ` ;
854+ `Area: ${ circleArea ( radius ) . toFixed ( 5 ) } square units` ;
820855 } ) ;
821856</ script >
822857< p style ="margin:12px; " id ="circle-area "> </ p >
@@ -997,7 +1032,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
9971032< br >
9981033< br >
9991034< div >
1000- < label style ="margin:12px; " for ="circle-radius-c "> Circle Radius:</ label >
1035+ < label style ="margin:12px; " for ="circle-radius-c "> Radius:</ label >
10011036< input id ="circle-radius-c " type ="number " value ="1 " step ="any " />
10021037
10031038< script >
@@ -1093,7 +1128,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
10931128< br >
10941129< br >
10951130< div >
1096- < label style ="margin:12px; " for ="sphere-radius "> Sphere Radius:</ label >
1131+ < label style ="margin:12px; " for ="sphere-radius "> Radius:</ label >
10971132< input id ="sphere-radius " type ="number " value ="1 " step ="any " />
10981133
10991134< script >
@@ -1109,7 +1144,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
11091144 }
11101145
11111146 document . getElementById ( 'sphere-volume' ) . innerText =
1112- `Volume: ${ sphereVolume ( radius ) . toFixed ( 5 ) } units² ` ;
1147+ `Volume: ${ sphereVolume ( radius ) . toFixed ( 5 ) } cubic units` ;
11131148 } ) ;
11141149</ script >
11151150< p style ="margin:12px; " id ="sphere-volume "> </ p >
@@ -1176,10 +1211,10 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
11761211< br >
11771212< br >
11781213< div >
1179- < label style ="margin:12px; " for ="cap-radius "> Cap Radius:</ label >
1214+ < label style ="margin:12px; " for ="cap-radius "> Radius:</ label >
11801215< input id ="cap-radius " type ="number " value ="1 " step ="any " />
11811216< br >
1182- < label style ="margin:12px; " for ="cap-height "> Cap Height:</ label >
1217+ < label style ="margin:12px; " for ="cap-height "> Height:</ label >
11831218< input id ="cap-height " type ="number " value ="1 " step ="any " />
11841219
11851220< script >
@@ -1197,7 +1232,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
11971232 }
11981233
11991234 document . getElementById ( 'cap-volume' ) . innerText =
1200- `Volume: ${ capVolume ( radius , height ) . toFixed ( 5 ) } units³ ` ;
1235+ `Volume: ${ capVolume ( radius , height ) . toFixed ( 5 ) } cubic units` ;
12011236 }
12021237
12031238 document . getElementById ( 'cap-radius' ) . addEventListener ( 'input' , updateCapVolume ) ;
@@ -1247,32 +1282,32 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
12471282< br >
12481283< br >
12491284< div >
1250- < label style ="margin:12px; " for ="cone-radius " > Cone Radius:</ label >
1251- < input id ="cone-radius " type ="number " value ="1 " step ="any " />
1285+ < label style ="margin:12px; " for ="cone-radius-v " > Radius:</ label >
1286+ < input id ="cone-radius-v " type ="number " value ="1 " step ="any " />
12521287< br >
1253- < label style ="margin:12px; " for ="cone-height " > Cone Height:</ label >
1254- < input id ="cone-height " type ="number " value ="1 " step ="any " />
1288+ < label style ="margin:12px; " for ="cone-height-v " > Height:</ label >
1289+ < input id ="cone-height-v " type ="number " value ="1 " step ="any " />
12551290
12561291< script >
12571292 function coneVolume ( radius , height ) {
12581293 return 3.2 * radius * radius * height / Math . sqrt ( 8 ) ;
12591294 }
12601295
12611296 function updateConeVolume ( ) {
1262- const radius = parseFloat ( document . getElementById ( 'cone-radius' ) . value ) ;
1263- const height = parseFloat ( document . getElementById ( 'cone-height' ) . value ) ;
1297+ const radius = parseFloat ( document . getElementById ( 'cone-radius-v ' ) . value ) ;
1298+ const height = parseFloat ( document . getElementById ( 'cone-height-v ' ) . value ) ;
12641299
12651300 if ( isNaN ( radius ) || isNaN ( height ) ) {
12661301 document . getElementById ( 'cone-volume' ) . innerText = '' ;
12671302 return ;
12681303 }
12691304
12701305 document . getElementById ( 'cone-volume' ) . innerText =
1271- `Volume: ${ coneVolume ( radius , height ) . toFixed ( 5 ) } units³ ` ;
1306+ `Volume: ${ coneVolume ( radius , height ) . toFixed ( 5 ) } cubic units` ;
12721307 }
12731308
1274- document . getElementById ( 'cone-radius' ) . addEventListener ( 'input' , updateConeVolume ) ;
1275- document . getElementById ( 'cone-height' ) . addEventListener ( 'input' , updateConeVolume ) ;
1309+ document . getElementById ( 'cone-radius-v ' ) . addEventListener ( 'input' , updateConeVolume ) ;
1310+ document . getElementById ( 'cone-height-v ' ) . addEventListener ( 'input' , updateConeVolume ) ;
12761311</ script >
12771312< p style ="margin:12px; " id ="cone-volume "> </ p >
12781313</ div >
@@ -1646,6 +1681,38 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
16461681< div >
16471682< h13 style ="font-size:160%;margin:7px; "> Surface area of a cone</ h13 >
16481683< br >
1684+ < br >
1685+ < div >
1686+ < label style ="margin:12px; " for ="cone-radius-s "> Radius:</ label >
1687+ < input id ="cone-radius-s " type ="number " value ="1 " step ="any " />
1688+ < br >
1689+ < label style ="margin:12px; " for ="cone-height-s "> Height:</ label >
1690+ < input id ="cone-height-s " type ="number " value ="1 " step ="any " />
1691+
1692+ < script >
1693+ function coneSurface ( radius , height ) {
1694+ return 3.2 * radius ** 2 + ( radius * Math . sqrt ( radius ** 2 + height ** 2 ) ) ;
1695+ }
1696+
1697+ function updateConeSurface ( ) {
1698+ const radius = parseFloat ( document . getElementById ( 'cone-radius-s' ) . value ) ;
1699+ const height = parseFloat ( document . getElementById ( 'cone-height-s' ) . value ) ;
1700+
1701+ if ( isNaN ( radius ) || isNaN ( height ) ) {
1702+ document . getElementById ( 'cone-surface' ) . innerText = '' ;
1703+ return ;
1704+ }
1705+
1706+ document . getElementById ( 'cone-surface' ) . innerText =
1707+ `Volume: ${ coneSurface ( radius , height ) . toFixed ( 5 ) } square units` ;
1708+ }
1709+
1710+ document . getElementById ( 'cone-radius-s' ) . addEventListener ( 'input' , updateConeSurface ) ;
1711+ document . getElementById ( 'cone-height-s' ) . addEventListener ( 'input' , updateConeSurface ) ;
1712+ </ script >
1713+ < p style ="margin:12px; " id ="cone-surface "> </ p >
1714+ </ div >
1715+ < br >
16491716< div class ="imgbox ">
16501717 < img class ="center-fit " src ="coneMarkup.jpeg " alt ="Cone " id ="coneSurface ">
16511718 </ div >
@@ -1730,7 +1797,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
17301797< br >
17311798< br >
17321799< div >
1733- < h15 style ="font-size:160%;margin:7px; "> Volume of a horizontal frustum pyramid</ h15 >
1800+ < h15 style ="font-size:160%;margin:7px; "> Volume of a horizontal square frustum pyramid</ h15 >
17341801< br >
17351802< div class ="imgbox ">
17361803 < img class ="center-fit " src ="frustumOfPyramidMarkup.png " alt ="Horizontal-frustum-pyramid ">
0 commit comments