1
0

first commit

This commit is contained in:
Suiranoil
2024-03-19 14:03:49 +03:00
commit 00024e4ed1
17 changed files with 1191 additions and 0 deletions

BIN
Л2-В6/Lab_2.pdf Normal file

Binary file not shown.

View File

@@ -0,0 +1,517 @@
<mxfile host="app.diagrams.net" modified="2024-03-11T07:01:00.290Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36" etag="xR261IYYNs-OPL3Uj3Tm" version="22.1.21" type="device" pages="6">
<diagram name="Half DIv" id="wbIuXKdkg5ZydlB-8m3I">
<mxGraphModel dx="989" dy="509" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-1" target="TxWHqS0Z3eQh_NNlYQ_y-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-1" value="half_div_method(f, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="340" y="120" width="220" height="30" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-2" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="390" y="660" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-3" target="TxWHqS0Z3eQh_NNlYQ_y-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-3" value="x_n = (a + b) / 2&lt;br&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-8" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-5" target="TxWHqS0Z3eQh_NNlYQ_y-7">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-21" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-5" target="TxWHqS0Z3eQh_NNlYQ_y-18">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="570" y="265" />
<mxPoint x="570" y="590" />
<mxPoint x="450" y="590" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-5" value="abs(f(x_n)) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="385" y="230" width="130" height="70" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-10" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-7" target="TxWHqS0Z3eQh_NNlYQ_y-9">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-7" value="x_n = (a + b) / 2" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="405" y="320" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-13" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-9" target="TxWHqS0Z3eQh_NNlYQ_y-11">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-9" target="TxWHqS0Z3eQh_NNlYQ_y-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-9" value="f(a) * f(x_n) &amp;lt; 0" style="rhombus;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="402.5" y="380" width="95" height="60" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-16" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-11" target="TxWHqS0Z3eQh_NNlYQ_y-15">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-11" value="b = x_n" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="340" y="470" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-17" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=0.5;exitY=1;exitDx=0;exitDy=0;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-12" target="TxWHqS0Z3eQh_NNlYQ_y-15">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-12" value="a = x_n" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="500" y="470" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-20" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-15">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="220" as="targetPoint" />
<Array as="points">
<mxPoint x="330" y="555" />
<mxPoint x="330" y="220" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-15" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="420" y="540" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-19" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;fontFamily=Helvetica;" edge="1" parent="1" source="TxWHqS0Z3eQh_NNlYQ_y-18" target="TxWHqS0Z3eQh_NNlYQ_y-2">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="TxWHqS0Z3eQh_NNlYQ_y-18" value="return x_n" style="rounded=0;whiteSpace=wrap;html=1;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="412.5" y="610" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="IcDKZ4LQSpk8jwLigyKe-1" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="510" y="238" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="IcDKZ4LQSpk8jwLigyKe-2" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="450" y="288" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="IcDKZ4LQSpk8jwLigyKe-3" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="368" y="386" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="IcDKZ4LQSpk8jwLigyKe-4" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontFamily=Helvetica;" vertex="1" parent="1">
<mxGeometry x="493" y="385" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="m7PvEl4LINJCrbTA7qHv" name="Chord">
<mxGraphModel dx="989" dy="509" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="En1udxgOBDVjKzdu_g3T-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-2" target="En1udxgOBDVjKzdu_g3T-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-2" value="chord_method(f, f_dd, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="330" y="120" width="240" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-3" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="390" y="950" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-5" target="En1udxgOBDVjKzdu_g3T-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-5" value="x_n = (a + b) / 2&lt;br&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-8" target="En1udxgOBDVjKzdu_g3T-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-8" target="En1udxgOBDVjKzdu_g3T-21">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="560" y="265" />
<mxPoint x="560" y="860" />
<mxPoint x="450" y="860" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-8" value="abs(f(x_n)) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;" vertex="1" parent="1">
<mxGeometry x="385" y="230" width="130" height="70" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-9" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-10" target="En1udxgOBDVjKzdu_g3T-13">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-10" value="X = a" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="405" y="320" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-24" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-13" target="En1udxgOBDVjKzdu_g3T-23">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-13" target="En1udxgOBDVjKzdu_g3T-22">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="530" y="420" />
<mxPoint x="530" y="530" />
<mxPoint x="450" y="530" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-13" value="f(X) * f_dd(X) &amp;lt;= 0" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="391.25" y="390" width="117.5" height="60" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-19">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="220" as="targetPoint" />
<Array as="points">
<mxPoint x="450" y="840" />
<mxPoint x="340" y="840" />
<mxPoint x="340" y="220" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-19" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="790" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-20" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-21" target="En1udxgOBDVjKzdu_g3T-3">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="450" y="950" />
<mxPoint x="450" y="950" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-21" value="return x_n" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="413" y="890" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-28" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-22" target="En1udxgOBDVjKzdu_g3T-27">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-31" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-22" target="En1udxgOBDVjKzdu_g3T-29">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="530" y="580" />
<mxPoint x="530" y="690" />
<mxPoint x="450" y="690" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-22" value="f(X) * f_dd(X) &amp;lt;= 0" style="rhombus;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="391.25" y="555" width="117.5" height="60" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-26" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-23" target="En1udxgOBDVjKzdu_g3T-22">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-23" value="X = b" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="417.5" y="480" width="65" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-27" target="En1udxgOBDVjKzdu_g3T-29">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-27" value="return None" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="412.5" y="640" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-36" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="En1udxgOBDVjKzdu_g3T-29" target="En1udxgOBDVjKzdu_g3T-19">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="En1udxgOBDVjKzdu_g3T-29" value="x_n = x_n - f(x_n) * (X - x_n) / (f(X) - f(x_n))" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="720" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-1" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="515" y="238" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-2" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="446" y="291" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-3" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="446" y="448" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-4" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="499" y="395" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-5" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="497" y="552" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="-j4IdEF3rIPhRTsJx84a-6" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="450" y="611" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="Ewkb1kwSzLa2aXDJ_c8E" name="Newton">
<mxGraphModel dx="683" dy="351" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="k1ct6UH8q8BLBysB6W33-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-2" target="k1ct6UH8q8BLBysB6W33-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-2" value="newtons_method(f, f_d, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="325" y="120" width="250" height="30" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-3" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="390" y="540" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-5" target="k1ct6UH8q8BLBysB6W33-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-5" value="x_n = a&lt;br&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="40" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-8" target="k1ct6UH8q8BLBysB6W33-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-8" target="k1ct6UH8q8BLBysB6W33-21">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="570" y="265" />
<mxPoint x="570" y="470" />
<mxPoint x="450" y="470" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-8" value="abs(f(x_n)) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;" vertex="1" parent="1">
<mxGeometry x="385" y="230" width="130" height="70" as="geometry" />
</mxCell>
<mxCell id="XFkZYtIsXRbkd52yrBHi-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-10" target="k1ct6UH8q8BLBysB6W33-19">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-10" value="x_n = x_n - f(x_n) / f_d(x_n)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="405" y="320" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" target="k1ct6UH8q8BLBysB6W33-15">
<mxGeometry relative="1" as="geometry">
<mxPoint x="402.5" y="410" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-12" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" target="k1ct6UH8q8BLBysB6W33-17">
<mxGeometry relative="1" as="geometry">
<mxPoint x="497.5" y="410" as="sourcePoint" />
</mxGeometry>
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-18" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-19">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="220" as="targetPoint" />
<Array as="points">
<mxPoint x="450" y="450" />
<mxPoint x="330" y="450" />
<mxPoint x="330" y="220" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-19" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="400" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-20" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="k1ct6UH8q8BLBysB6W33-21" target="k1ct6UH8q8BLBysB6W33-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="k1ct6UH8q8BLBysB6W33-21" value="return x_n" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="412.5" y="490" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="3OE8DBbEHPLtUKMTXa2F-1" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="447" y="291" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="3OE8DBbEHPLtUKMTXa2F-2" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="517" y="238" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="Rr3xRNARGJOExsobsdPE" name="Mod Newtons">
<mxGraphModel dx="1434" dy="738" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="oYErA9m1tR8F3-8wQpgo-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-2" target="oYErA9m1tR8F3-8wQpgo-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-2" value="modified_newtons_method(f, f_d, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="307.5" y="120" width="285" height="30" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-3" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="390" y="550" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-5" target="oYErA9m1tR8F3-8wQpgo-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-5" value="x_n = a&lt;br&gt;f_d_0 = f_d(x_n)&lt;br&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-8" target="oYErA9m1tR8F3-8wQpgo-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-8" target="oYErA9m1tR8F3-8wQpgo-14">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="550" y="275" />
<mxPoint x="550" y="480" />
<mxPoint x="450" y="480" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-8" value="abs(f(x_n)) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;" vertex="1" parent="1">
<mxGeometry x="385" y="240" width="130" height="70" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-10" target="oYErA9m1tR8F3-8wQpgo-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-10" value="x_n = x_n - f(x_n) / f_d_0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="405" y="330" width="90" height="40" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-12">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="230" as="targetPoint" />
<Array as="points">
<mxPoint x="450" y="460" />
<mxPoint x="360" y="460" />
<mxPoint x="360" y="230" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-12" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="410" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="oYErA9m1tR8F3-8wQpgo-14" target="oYErA9m1tR8F3-8wQpgo-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="oYErA9m1tR8F3-8wQpgo-14" value="return x_n" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="412.5" y="500" width="75" height="30" as="geometry" />
</mxCell>
<mxCell id="W8xdrJVDDaAdr1LwNb81-1" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="445" y="303" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="W8xdrJVDDaAdr1LwNb81-2" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="510" y="246" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="51YhTPWcsMFmQt2WqvVV" name="Combined">
<mxGraphModel dx="989" dy="509" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="zdkqlnk47-PjrHgtbhlL-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-2" target="zdkqlnk47-PjrHgtbhlL-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-2" value="combined_method(f, f_d, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="307.5" y="120" width="285" height="30" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-3" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="390" y="550" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-5" target="zdkqlnk47-PjrHgtbhlL-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-5" value="&lt;div&gt;x_n = a&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;background-color: initial;&quot;&gt;y_n = b&lt;/span&gt;&lt;/div&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-8" target="zdkqlnk47-PjrHgtbhlL-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-8" target="zdkqlnk47-PjrHgtbhlL-14">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="570" y="275" />
<mxPoint x="570" y="480" />
<mxPoint x="450" y="480" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-8" value="abs(x_n - y_n) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;" vertex="1" parent="1">
<mxGeometry x="377.5" y="240" width="145" height="70" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-10" target="zdkqlnk47-PjrHgtbhlL-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-10" value="&lt;div&gt;x_n = x_n - f(x_n) / f_d(x_n)&lt;/div&gt;&lt;div&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;y_n = y_n - f(y_n) * (x_n - y_n) / (f(x_n) - f(y_n))&lt;/div&gt;" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="357.5" y="330" width="185" height="50" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-12">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="230" as="targetPoint" />
<Array as="points">
<mxPoint x="450" y="460" />
<mxPoint x="330" y="460" />
<mxPoint x="330" y="230" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-12" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="410" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="zdkqlnk47-PjrHgtbhlL-14" target="zdkqlnk47-PjrHgtbhlL-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="zdkqlnk47-PjrHgtbhlL-14" value="return (x_n + y_n) / 2" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="391.25" y="500" width="117.5" height="30" as="geometry" />
</mxCell>
<mxCell id="zc9r_NZ-D602_4hLvoX7-1" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="447" y="302" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="zc9r_NZ-D602_4hLvoX7-2" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="520" y="250" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
<diagram id="zmJh-cu3u4QNUGEy1ztf" name="Iterative">
<mxGraphModel dx="1195" dy="615" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-1" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-2" target="G-ayLxhA-LWAzPQ1L_Mv-5">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-2" value="iterative_method(f, f_d, a, b, max_iter, eps)" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="307.5" y="120" width="285" height="30" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-3" value="Конец" style="rounded=1;whiteSpace=wrap;html=1;arcSize=50;" vertex="1" parent="1">
<mxGeometry x="390" y="550" width="120" height="30" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-5" target="G-ayLxhA-LWAzPQ1L_Mv-8">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-5" value="&lt;div&gt;x =&amp;nbsp;a - f(a) / f_d(a)&lt;br&gt;&lt;/div&gt;i = 0" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="390" y="170" width="120" height="50" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-6" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-8" target="G-ayLxhA-LWAzPQ1L_Mv-10">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-8" target="G-ayLxhA-LWAzPQ1L_Mv-14">
<mxGeometry relative="1" as="geometry">
<Array as="points">
<mxPoint x="570" y="275" />
<mxPoint x="570" y="480" />
<mxPoint x="450" y="480" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-8" value="abs(x_n - y_n) &amp;gt;= eps and i &amp;lt; max_iter" style="rhombus;whiteSpace=wrap;html=1;perimeterSpacing=0;rounded=0;shadow=0;spacing=30;" vertex="1" parent="1">
<mxGeometry x="377.5" y="240" width="145" height="70" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-9" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-10" target="G-ayLxhA-LWAzPQ1L_Mv-12">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-10" value="x =&amp;nbsp;x - f(x) / f_d(x)" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="357.5" y="330" width="185" height="50" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-12">
<mxGeometry relative="1" as="geometry">
<mxPoint x="450" y="230" as="targetPoint" />
<Array as="points">
<mxPoint x="450" y="460" />
<mxPoint x="330" y="460" />
<mxPoint x="330" y="230" />
</Array>
</mxGeometry>
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-12" value="i += 1" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="420" y="410" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-13" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" edge="1" parent="1" source="G-ayLxhA-LWAzPQ1L_Mv-14" target="G-ayLxhA-LWAzPQ1L_Mv-3">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="G-ayLxhA-LWAzPQ1L_Mv-14" value="return x" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
<mxGeometry x="391.25" y="500" width="117.5" height="30" as="geometry" />
</mxCell>
<mxCell id="JN9VUWSohEjc5PBiCDA9-1" value="Да" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="445" y="302" width="40" height="30" as="geometry" />
</mxCell>
<mxCell id="JN9VUWSohEjc5PBiCDA9-2" value="Нет" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;" vertex="1" parent="1">
<mxGeometry x="522" y="248" width="40" height="30" as="geometry" />
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>

View File

@@ -0,0 +1,205 @@
import aim
import сomputational_mathematics as cm
from PyQt6.QtWidgets import QComboBox, QPushButton, QLineEdit, QFormLayout
import sys
import numpy as np
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel
from PyQt6.QtGui import QIcon
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
class Form(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setWindowTitle("Lab2")
self.setWindowIcon(QIcon("icon.png"))
self.setGeometry(100, 100, 800, 940)
main_layout = QVBoxLayout()
# Группа "Уравнение"
equation_html = (
'<span style="color:rgb(87, 46, 120); font-size:28px;">Уравнение:</span>'
)
equation_html += "<br>"
equation_html += (
'<span style="font-size:28px;">y = x<sup>3</sup> - 10 * x + 2</span>'
)
# Создаем QLabel с использованием HTML разметки
label_equation = QLabel(self)
label_equation.setText(equation_html)
label_equation.setWordWrap(True) # Переносим текст если он не помещается в окне
# Добавляем QLabel в вашу группу и на главный слой
group_equation = QVBoxLayout()
group_equation.addWidget(label_equation)
main_layout.addLayout(group_equation)
# Группа "Параметры"
self.group_parameters = QFormLayout()
label_name = QLabel("Параметры:", self)
label_name.setStyleSheet("color: rgb(87, 46, 120); font-size: 28px")
self.group_parameters.addWidget(label_name)
self.label_a = QLabel("a:", self)
self.label_a.setStyleSheet("color: rgb(87, 46, 120); font-size: 20px")
self.line_edit_a = QLineEdit(self)
self.line_edit_a.setText("-10000.0")
self.label_b = QLabel("b:", self)
self.label_b.setStyleSheet("color: rgb(87, 46, 120); font-size: 20px")
self.line_edit_b = QLineEdit(self)
self.line_edit_b.setText("10000.0")
self.group_parameters.addRow(label_name)
self.group_parameters.addRow(self.label_a, self.line_edit_a)
self.group_parameters.addRow(self.label_b, self.line_edit_b)
main_layout.addLayout(self.group_parameters)
# Группа "Действия"
self.group_actions = QVBoxLayout()
label_actions = QLabel("Действия:", self)
label_actions.setStyleSheet("color: rgb(87, 46, 120); font-size: 28px")
self.button_find_solution = QPushButton("Решить", self)
self.button_find_solution.clicked.connect(self.findSolution)
self.combo_box_solutions = QComboBox(self)
self.combo_box_solutions.addItems(
[
"Метод половинного деления",
"Метод хорд",
"Метод Ньютона",
"Модифицированный метод",
"Комбинированный метод",
"Итерационный метод",
]
)
group_parameters = QFormLayout()
group_parameters.addRow(label_actions)
group_parameters.addRow(self.button_find_solution, self.combo_box_solutions)
self.group_actions.addLayout(group_parameters)
self.label_result = QLabel("Результат:", self)
self.label_result.setStyleSheet("color: rgb(87, 46, 120); font-size: 20px")
self.group_actions.addWidget(self.label_result)
self.line_edit_result = QLineEdit(self)
self.group_actions.addWidget(self.line_edit_result)
self.line_edit_roots = QLineEdit(self)
self.group_actions.addWidget(self.line_edit_roots)
self.line_edit_section = QLineEdit(self)
self.group_actions.addWidget(self.line_edit_section)
self.line_edit_result.setText(f"Решения: ")
self.line_edit_roots.setText(f"Найдено: z интервалов")
self.line_edit_section.setText(f"Отрезок (a, b)")
main_layout.addLayout(self.group_actions)
self.setLayout(main_layout)
# Добавление виджета для графика
self.canvas = FigureCanvas(Figure())
main_layout.addWidget(self.canvas)
self.setLayout(main_layout)
self.plotGraph()
def findSolution(self):
method = self.combo_box_solutions.currentText()
a = float(self.line_edit_a.text())
b = float(self.line_edit_b.text())
x_range = np.array(np.arange(a, b, step=0.1), dtype=np.float64)
y_range = aim.f(x_range)
solution_range = []
for i in range(len(x_range) - 1):
if y_range[i] * y_range[i + 1] < 0:
solution_range.append((x_range[i], x_range[i + 1]))
strResult = "Решения: "
strSection = "Отрезки: "
self.line_edit_roots.setText(f"Найдено: {len(solution_range)} интервала")
for a, b in solution_range:
if method == "Метод половинного деления":
strResult += "[" + str(cm.half_div_method(aim.f, aim.f_d, a, b)) + "] "
strSection += f" ({a}, {b}) "
elif method == "Метод хорд":
strResult += (
"[" + str(cm.chord_method(aim.f, aim.f_d, aim.f_dd, a, b)) + "] "
)
strSection += f" ({a}, {b}) "
elif method == "Метод Ньютона":
strResult += "[" + str(cm.newtons_method(aim.f, aim.f_d, a, b)) + "] "
strSection += f" ({a}, {b}) "
elif method == "Модифицированный метод":
strResult += (
"[" + str(cm.modified_newtons_method(aim.f, aim.f_d, a, b)) + "] "
)
strSection += f" ({a}, {b}) "
elif method == "Комбинированный метод":
strResult += "[" + str(cm.combined_method(aim.f, aim.f_d, a, b)) + "] "
strSection += f" ({a}, {b}) "
elif method == "Итерационный метод":
strResult += "[" + str(cm.iterative_method(aim.f, aim.f_d, a, b)) + "] "
strSection += f" ({a}, {b}) "
self.line_edit_section.setText(strSection)
self.line_edit_result.setText(strResult)
solution_range.clear()
def plotGraph(self):
x = np.linspace(-10, 10, 400)
y = x**3 - 10 * x + 2
ax = self.canvas.figure.subplots()
ax.plot(x, y, label="$x^3 - 10x + 2$", color="b")
# Добавляем оси axis
ax.spines["left"].set_position(("data", 0))
ax.spines["bottom"].set_position(("data", 0))
ax.spines["right"].set_color("none")
ax.spines["top"].set_color("none")
ax.yaxis.set_ticks_position("left")
ax.xaxis.set_ticks_position("bottom")
# Добавляем точки на оси x и их значения
x_intercepts = x[np.where(np.diff(np.signbit(y)))[0]]
for x_intercept in x_intercepts:
ax.plot(x_intercept, 0, "ro") # добавляем красную точку
ax.annotate(
f"x={x_intercept:.2f}", (x_intercept, 0.5), color="r"
) # добавляем значение x
# Ограничиваем график по оси y до 15
ax.set_ylim(-15, 15)
ax.set_title("График уравнения")
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.grid(True)
ax.legend()
self.canvas.draw()
if __name__ == "__main__":
app = QApplication(sys.argv)
form = Form()
form.show()
sys.exit(app.exec())

View File

@@ -0,0 +1,26 @@
import sympy
func_str = "x ** 3 - 10 * x + 2"
func = sympy.sympify(func_str)
func_d = sympy.diff(func)
func_dd = sympy.diff(func_d)
func_l = sympy.lambdify("x", func, "numpy")
func_d_l = sympy.lambdify("x", func_d, "numpy")
func_dd_l = sympy.lambdify("x", func_dd, "numpy")
def f_str():
return func_str
def f(x):
return func_l(x)
def f_d(x):
return func_d_l(x)
def f_dd(x):
return func_dd_l(x)

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@@ -0,0 +1,77 @@
def half_div_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = (a + b) / 2
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = (a + b) / 2
f_ = f(x_n)
if f_ == 0:
break
if f(a) * f_ < 0:
b = x_n
else:
a = x_n
i += 1
return x_n
def chord_method(f, f_d, f_dd, a, b, max_iter=1_000_000, eps=0.01):
x_n = (a + b) / 2
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
X = a
if f(X) * f_dd(X) <= 0:
X = b
if f(X) * f_dd(X) <= 0:
return None
x_n = x_n - f(x_n) * (X - x_n) / (f(X) - f(x_n))
i += 1
return x_n
def newtons_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = a
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d(x_n)
i += 1
return x_n
def modified_newtons_method(f, f_d, a, b, max_iter=1_000_000, eps=0.01):
x_n = a
f_d_0 = f_d(x_n)
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d_0
i += 1
return x_n
def combined_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = a
y_n = b
i = 0
while abs(x_n - y_n) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d(x_n)
y_n = y_n - f(y_n) * (x_n - y_n) / (f(x_n) - f(y_n))
i += 1
return (x_n + y_n) / 2
def iterative_method(f, f_d, a, b, max_iter=10_000, eps=0.0001):
def phi(x):
return x - f(x) / f_d(x)
i = 0
x = phi(a)
while abs(f(x)) >= eps and i < max_iter:
x = phi(x)
i += 1
return x

Binary file not shown.

BIN
Л2-В6/Отчет.docx Normal file

Binary file not shown.

2
Л2-В6/Программа/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.venv
*/__pycache__

View File

@@ -0,0 +1,5 @@
sympy
numpy
matplotlib
pyqt6
scipy

View File

@@ -0,0 +1,82 @@
def half_div_method(f, a, b, max_iter=10_000, eps=0.00001):
x_n = (a + b) / 2
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = (a + b) / 2
if f(a) * f(x_n) < 0:
b = x_n
else:
a = x_n
i += 1
return x_n
def chord_method(f, f_dd, a, b, max_iter=10_000, eps=0.00001):
x_n = (a + b) / 2
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
X = a
if f(X) * f_dd(X) <= 0:
X = b
if f(X) * f_dd(X) <= 0:
return None
x_n = x_n - f(x_n) * (X - x_n) / (f(X) - f(x_n))
i += 1
return x_n
def newtons_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = a
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d(x_n)
i += 1
return x_n
def modified_newtons_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = a
f_d_0 = f_d(x_n)
i = 0
while abs(f(x_n)) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d_0
i += 1
return x_n
def combined_method(f, f_d, a, b, max_iter=10_000, eps=0.00001):
x_n = a
y_n = b
i = 0
while abs(x_n - y_n) >= eps and i < max_iter:
x_n = x_n - f(x_n) / f_d(x_n)
y_n = y_n - f(y_n) * (x_n - y_n) / (f(x_n) - f(y_n))
i += 1
return (x_n + y_n) / 2
def iterative_method(f, f_d, a, b, max_iter=10_000, eps=0.0001):
def phi(x):
return x - f(x) / f_d(x)
x = phi(a)
i = 0
while abs(f(x)) >= eps and i < max_iter:
x = phi(x)
i += 1
return x

View File

@@ -0,0 +1,13 @@
import sys
from PyQt6.QtWidgets import QApplication
from PyQt6.QtGui import QFont
import window
if __name__ == "__main__":
app = QApplication(sys.argv)
font = QFont("Cascadia Code", 14)
app.setFont(font)
window = window.MainWindow()
window.show()
sys.exit(app.exec())

View File

@@ -0,0 +1,27 @@
import sympy
func_str = "x ** 4 - x ** 2 + 5 * x - 10"
func = sympy.sympify(func_str)
func_d = sympy.diff(func)
func_dd = sympy.diff(func_d)
func_l = sympy.lambdify("x", func, cse=True)
func_d_l = sympy.lambdify("x", func_d, cse=True)
func_dd_l = sympy.lambdify("x", func_dd, cse=True)
def f_str():
return func_str
def f(x):
return func_l(x)
def f_d(x):
return func_d_l(x)
def f_dd(x):
return func_dd_l(x)

View File

@@ -0,0 +1,232 @@
import task
from algorithm import *
import sys
from PyQt6.QtWidgets import (
QMessageBox,
QMainWindow,
QLabel,
QComboBox,
QPushButton,
QFormLayout,
QWidget,
QLineEdit,
QHBoxLayout,
)
from PyQt6.QtCore import Qt
import numpy as np
import scipy
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
matplotlib.use("QtAgg")
class InputField(QWidget):
def __init__(self, parent, label_text, placeholder_text, lineedit_text):
super().__init__(parent)
self._layout = QHBoxLayout(self)
self._layout.setContentsMargins(0, 0, 0, 0)
self.label = QLabel(label_text)
self.lineedit = QLineEdit(lineedit_text)
self.lineedit.setPlaceholderText(placeholder_text)
self._layout.addWidget(self.label)
self._layout.addWidget(self.lineedit)
def get_value(self):
return self.lineedit.text()
def set_value(self, value):
self.lineedit.setText(value)
def on_change(self, func):
self.lineedit.textChanged.connect(func)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.a = float(-3)
self.b = float(2)
self.steps = int(1000)
self.setupUI()
def setupUI(self):
self.setWindowTitle("Лабораторная работа №2")
self.setFixedSize(800, 800)
self.central_widget = QWidget()
self.setCentralWidget(self.central_widget)
layout = QFormLayout()
self.label1 = QLabel("Вариант 6", self)
layout.addWidget(self.label1)
self.label5 = QLabel(f"Уравнение {task.f_str()}", self)
layout.addWidget(self.label5)
self.label3 = QLabel("Диапазон:", self)
layout.addWidget(self.label3)
self.aInput = InputField(self, " a: ", "от", str(self.a))
self.aInput.on_change(self.aInput_changed)
layout.addWidget(self.aInput)
self.bInput = InputField(self, " b: ", "до", str(self.b))
self.bInput.on_change(self.bInput_changed)
layout.addWidget(self.bInput)
self.stepsInput = InputField(self, " шаги: ", "шаги", str(self.steps))
self.stepsInput.on_change(self.stepsInput_changed)
layout.addWidget(self.stepsInput)
self.plot = plt.figure()
self.canvas = FigureCanvasQTAgg(self.plot)
self.plot_axes = self.plot.add_subplot(111)
self.drawPlot(self.a, self.b)
layout.addWidget(self.canvas)
self.findIntervalsButton = QPushButton("Найти интервалы", self)
self.findIntervalsButton.clicked.connect(self.findIntervalsButton_clicked)
layout.addWidget(self.findIntervalsButton)
self.intervals = []
self.comboBoxIntervals = QComboBox(self)
layout.addWidget(self.comboBoxIntervals)
self.label2 = QLabel("Способ решения:", self)
layout.addWidget(self.label2)
self.comboBoxSolutions = QComboBox(self)
self.comboBoxSolutions.addItem("Половинного деления")
self.comboBoxSolutions.addItem("Хорд")
self.comboBoxSolutions.addItem("Ньютона")
self.comboBoxSolutions.addItem("Ньютона (мод)")
self.comboBoxSolutions.addItem("Комбинированный")
self.comboBoxSolutions.addItem("Итераций")
layout.addWidget(self.comboBoxSolutions)
self.buttonFindSolution = QPushButton("Решить", self)
self.buttonFindSolution.clicked.connect(self.findSolutionButton_clicked)
layout.addWidget(self.buttonFindSolution)
self.label4 = QLabel("Ответ:", self)
layout.addWidget(self.label4)
self.labelResult = QLabel(self)
layout.addWidget(self.labelResult)
self.central_widget.setLayout(layout)
def aInput_changed(self):
try:
a_str = self.aInput.get_value()
if not (a_str == "" or a_str == "-"):
self.a = float(a_str)
self.drawPlot(self.a, self.b)
except:
self.aInput.set_value(str(self.a))
def bInput_changed(self):
try:
b_str = self.bInput.get_value()
if not (b_str == "" or b_str == "-"):
self.b = float(b_str)
self.drawPlot(self.a, self.b)
except:
self.bInput.set_value(str(self.b))
def stepsInput_changed(self):
try:
steps_str = self.stepsInput.get_value()
if not (steps_str == ""):
self.steps = int(steps_str)
self.steps = max(2, min(10000, self.steps))
self.stepsInput.set_value(str(self.steps))
self.drawPlot(self.a, self.b)
except:
self.stepsInput.set_value(str(self.steps))
def redraw(self):
self.canvas.draw()
def findIntervalsButton_clicked(self):
self.intervals = self.find_root_intervals(
self.a, self.b, abs(self.b - self.a) / self.steps, task.f
)
self.comboBoxIntervals.clear()
for a, b in self.intervals:
self.comboBoxIntervals.addItem(f"({a:.5f}, {b:.5f})")
def findSolutionButton_clicked(self):
try:
(a, b) = self.intervals[self.comboBoxIntervals.currentIndex()]
solution = self.find_root(a, b, self.comboBoxSolutions.currentIndex())
if solution is None:
self.labelResult.setText("Решение не найдено")
else:
self.labelResult.setText(f"{solution:.12f}")
except:
self.labelResult.setText("Интервал не выбран")
def drawPlot(self, a, b):
steps = self.steps
step = abs(b - a) / steps
intervals = self.find_root_intervals(a, b, step, task.f)
roots = []
for interval in intervals:
root = scipy.optimize.fsolve(task.f, interval)
roots.extend(root)
x_values = np.linspace(a, b, steps)
y_values = task.f(x_values)
ax = self.plot_axes
ax.clear()
ax.plot(x_values, y_values)
ax.axhline(0, color="black", linewidth=1)
ax.set_xlabel("x")
ax.axvline(0, color="black", linewidth=1)
ax.set_ylabel("y")
ax.grid(True)
ax.plot(x_values, y_values, label="y = f(x)")
ax.scatter(roots, np.zeros_like(roots), color="red")
for root in roots:
ax.text(root, 0, f"x={root:.5f}", ha="left", va="bottom")
self.redraw()
def find_root(self, a, b, method):
solution = None
match method:
case 0:
solution = half_div_method(task.f, a, b)
case 1:
solution = chord_method(task.f, task.f_dd, a, b)
case 2:
solution = newtons_method(task.f, task.f_d, a, b)
case 3:
solution = modified_newtons_method(task.f, task.f_d, a, b)
case 4:
solution = combined_method(task.f, task.f_d, a, b)
case 5:
solution = iterative_method(task.f, task.f_d, a, b)
return solution
def find_root_intervals(self, a, b, step, f):
x_range = np.array(np.arange(a, b, step), dtype=np.float64)
y_range = f(x_range)
solution_range = []
for i in range(len(x_range) - 1):
if y_range[i] * y_range[i + 1] < 0:
solution_range.append((x_range[i], x_range[i + 1]))
return solution_range