Simulation of Percentage Health vs. Time Using Definite Integrals
2020-03-15 09:59
This example models a character's health recovery mechanism. It uses piecewise functions to describe the time cost per percentage of health recovery, and calculates the total time required using definite integrals. It also applies inverse function transformations to graph health percentage versus time, demonstrating integrals and piecewise functions in dynamic simulations.
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="5.0" version="5.0.574.0" app="classic" platform="w" id="C7F3F508-9CFD-4BC7-9AA3-DD7A55DC815C" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/apps/xsd/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="1971" height="931" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.1308980213089802" orientation="1" />
</panes>
<views>
<view id="512" toolbar="0 | 1 501 5 19 , 67 | 2 15 45 18 , 7 37 | 514 3 9 , 13 44 , 47 | 16 51 | 551 550 11 , 20 22 21 23 , 55 56 57 , 12 | 69 | 510 511 , 512 513 | 533 531 , 534 532 , 522 523 , 537 536 , 535 | 521 520 | 36 , 38 49 560 | 571 30 29 570 31 33 | 17 | 540 40 41 42 , 27 28 35 , 6 , 502" visible="false" inframe="false" stylebar="false" location="1,1,1" size="500" window="100,100,600,400" />
<view id="4" toolbar="0 || 2020 , 2021 , 2022 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="false" location="1,1" size="300" window="100,100,600,400" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 || 1008 | 1009 || 6" visible="false" inframe="false" stylebar="true" location="1,3" size="241" window="100,100,600,400" />
<view id="4097" visible="false" inframe="false" stylebar="true" location="1,1" size="689" window="100,100,700,550" />
<view id="1" visible="true" inframe="false" stylebar="true" location="1" size="1705" window="100,100,600,400" />
<view id="2" visible="true" inframe="false" stylebar="true" location="3" size="258" window="100,100,600,400" />
<view id="16" visible="false" inframe="false" stylebar="true" location="1" size="292" window="50,50,500,500" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="300" window="50,50,500,500" />
<view id="64" toolbar="0" visible="false" inframe="false" stylebar="false" location="1" size="480" window="50,50,500,500" />
<view id="128" visible="false" inframe="false" stylebar="false" location="1" size="480" window="50,50,500,500" />
<view id="70" toolbar="0 || 2020 || 2021 || 2022" visible="false" inframe="false" stylebar="true" location="1" size="900" window="50,50,500,500" />
<view id="43" visible="false" inframe="false" stylebar="false" location="1" size="450" window="50,50,500,500" />
</views>
<toolbar show="true" items="0 73 62 | 1 501 67 , 5 19 , 72 75 76 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 14 68 | 30 29 54 32 31 33 | 25 17 26 60 52 61 | 40 41 42 , 27 28 35 , 6" position="1" help="false" />
<input show="true" cmd="true" top="algebra" />
<dockBar show="false" east="false" />
</perspective>
</perspectives>
<labelingStyle val="0"/>
<font size="16"/>
</gui>
<euclidianView>
<viewNumber viewNo="1"/>
<size width="1704" height="877"/>
<coordSystem xZero="139.50740084966995" yZero="769.3773966881159" scale="13.606250422770099" yscale="5.86793301223389"/>
<evSettings axes="true" grid="true" gridIsBold="false" pointCapturing="3" rightAngleStyle="1" checkboxSize="26" gridType="3"/>
<bgColor r="255" g="255" b="255"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="1" grid="0"/>
<axis id="0" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
</euclidianView>
<spreadsheetView>
<size width="0" height="0"/>
<prefCellSize width="70" height="0"/>
<selection hScroll="0" vScroll="0" column="-1" row="-1"/>
</spreadsheetView>
<algebraView>
<mode val="1"/>
<collapsed val="0,1,2,3,5"/>
</algebraView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="5"/>
<angleUnit val="degree"/>
<algebraStyle val="3" spreadsheet="0"/>
<coordStyle val="0"/>
</kernel>
<tableview min="-2" max="2" step="1"/>
<scripting blocked="false" disabled="false"/>
<construction title="赫拉格_當前血量(y)對時間(x)作圖_發布版" author="" date="">
<element type="numeric" label="血量積分終點">
<value val="100"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelOffset x="-15" y="-2"/>
<labelMode val="1"/>
<slider min="血量積分起始" max="100" absoluteScreenLocation="true" width="200" x="514" y="88" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="血量積分起始">
<value val="0"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="0" max="100" absoluteScreenLocation="true" width="200" x="502" y="44" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="赫拉格滿血">
<value val="4225"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="1536" max="4225" absoluteScreenLocation="true" width="200" x="122" y="57" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="安潔加攻速">
<value val="0"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelOffset x="-60" y="-1"/>
<labelMode val="1"/>
<slider min="0" max="8" absoluteScreenLocation="true" width="200" x="122" y="117" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="安潔每秒回血">
<value val="0"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="0" max="25" absoluteScreenLocation="true" width="200" x="117" y="177" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="5" speed="1" type="0" playing="false"/>
</element>
<expression label="單位百分比回血耗時y對血量百分比x作圖" exp="單位百分比回血耗時y對血量百分比x作圖(x) = If[30 ≤ x ≤ 100, 赫拉格滿血 / ((100 * ((7 / 6 * ((x - 170) / -0.7 + 安潔加攻速)) + 安潔每秒回血))), 0 ≤ x < 30, 赫拉格滿血 / ((100 * ((7 / 6 * (200 + 安潔加攻速)) + 安潔每秒回血)))]" />
<element type="function" label="單位百分比回血耗時y對血量百分比x作圖">
<show object="true" label="true" ev="4"/>
<objColor r="0" g="0" b="204" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<fixed val="true"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
</element>
<command name="Integral">
<input a0="單位百分比回血耗時y對血量百分比x作圖" a1="血量積分起始" a2="血量積分終點"/>
<output a0="此面積為回復x百分比血量所花費的時間"/>
</command>
<element type="numeric" label="此面積為回復x百分比血量所花費的時間">
<value val="23.003423884337465"/>
<show object="true" label="true"/>
<objColor r="153" g="51" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
</element>
<expression label="f" exp="f: y = 4225 / ((100 * ((7 / 6 * ((x - 170) / -0.7 + 7)) + 20)))" type="function"/>
<element type="function" label="f">
<show object="false" label="true" ev="4"/>
<objColor r="51" g="153" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<fixed val="true"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
</element>
<element type="numeric" label="c_1">
<value val="0"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.10000000149011612"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="-5" max="5" absoluteScreenLocation="true" width="200" fixed="false" horizontal="true" showAlgebra="true"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation speed="1" type="0" playing="false"/>
</element>
<expression label="時軸y對生命百分比x作圖" exp="時軸y對生命百分比x作圖(x) = If[30 ≤ x ≤ 100, Integral[赫拉格滿血 / ((100 * ((7 / 6 * ((x - 170) / -0.7 + 安潔加攻速)) + 安潔每秒回血)))] + ((3 * 赫拉格滿血) * 30 / (70000 + (350 * 安潔加攻速) + (300 * 安潔每秒回血))) + (((3 * 赫拉格滿血)) / 500 * log(abs((-7 * 安潔加攻速) - (6 * 安潔每秒回血) + 300 - 1700))), 0 ≤ x < 30, Integral[赫拉格滿血 / ((100 * ((7 / 6 * (200 + 安潔加攻速)) + 安潔每秒回血)))]]" />
<element type="function" label="時軸y對生命百分比x作圖">
<show object="true" label="true" ev="4"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="-77" y="-21"/>
<labelMode val="0"/>
<fixed val="true"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
</element>
<expression label="h" exp="y = x" type="line"/>
<element type="line" label="h">
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<fixed val="true"/>
<coords x="-1" y="1" z="0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
<eqnStyle style="user"/>
</element>
<command name="Mirror">
<input a0="時軸y對生命百分比x作圖" a1="h"/>
<output a0="F_{1}"/>
</command>
<element type="curvecartesian" label="F_{1}">
<show object="false" label="true"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<lineStyle thickness="5" type="0" typeHidden="1" opacity="178"/>
</element>
<expression label="反函數變換得到生命百分比y對時軸x作圖" exp="反函數變換得到生命百分比y對時軸x作圖(x) = If[30 ≤ ((-(ℯ^(x - ((((3 * 赫拉格滿血) * 30)) / (70000 + (350 * 安潔加攻速) + (300 * 安潔每秒回血)) + (((3 * 赫拉格滿血)) / 500 * log(abs((-7 * 安潔加攻速) - (6 * 安潔每秒回血) + 300 - 1700))))))^(-500 / ((3 * 赫拉格滿血)))) + (7 * 安潔加攻速) + (6 * 安潔每秒回血) + 1700) / 10 ≤ 100, ((-(ℯ^(x - ((((3 * 赫拉格滿血) * 30)) / (70000 + (350 * 安潔加攻速) + (300 * 安潔每秒回血)) + (((3 * 赫拉格滿血)) / 500 * log(abs((-7 * 安潔加攻速) - (6 * 安潔每秒回血) + 300 - 1700))))))^(-500 / ((3 * 赫拉格滿血)))) + (7 * 安潔加攻速) + (6 * 安潔每秒回血) + 1700) / 10, 0 ≤ ((70000 + (350 * 安潔加攻速) + (300 * 安潔每秒回血)) / ((3 * 赫拉格滿血)) * x) < 30, ((70000 + (350 * 安潔加攻速) + (300 * 安潔每秒回血)) / ((3 * 赫拉格滿血)) * x)]" />
<element type="function" label="反函數變換得到生命百分比y對時軸x作圖">
<show object="true" label="true" ev="4"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="16" y="-78"/>
<labelMode val="0"/>
<fixed val="true"/>
<lineStyle thickness="5" type="0" typeHidden="1"/>
</element>
<command name="Point">
<input a0="反函數變換得到生命百分比y對時軸x作圖"/>
<output a0="參考點"/>
</command>
<element type="point" label="參考點">
<show object="true" label="true"/>
<objColor r="125" g="125" b="255" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<trace val="true"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="6.358484596843958" y="35.02354684547358" z="1"/>
<pointSize val="5"/>
<pointStyle val="0"/>
</element>
</construction>
</geogebra>