From 23e00672b4fc0f41d55daeecc636c364e945c1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=A0=80?= Date: Sun, 12 Nov 2023 06:49:16 +0000 Subject: [PATCH] =?UTF-8?q?YP.=E2=9A=AA=E1=B4=A5=E2=9A=AA=E1=97=B1?= =?UTF-8?q?=E1=97=B4=E2=9A=AA=E2=9C=A4=E2=9A=AA=E2=93=84=E2=9A=AA=E1=99=81?= =?UTF-8?q?=E2=9A=AA=DF=A6=E2=9A=AA=E2=97=AF=E2=9A=AA=E1=97=B1=E1=97=B4?= =?UTF-8?q?=E2=9A=AA=E1=97=AF=E2=9A=AA=E1=B4=A5=E2=9A=AA=E1=91=8E=E2=9A=AA?= =?UTF-8?q?=E1=91=90=E1=91=95=E2=9A=AA=E2=97=AF=E2=9A=AA=D0=98N=E2=9A=AA?= =?UTF-8?q?=E2=93=84=E2=9A=AA=EA=96=B4=E2=9A=AA=E2=9C=A4=E2=9A=AA=E1=91=90?= =?UTF-8?q?=E1=91=95=E2=9A=AA=E1=91=8E=E2=9A=AA=EA=97=B3=E2=9A=AA=E2=97=AF?= =?UTF-8?q?=E2=9A=AA=E1=97=B1=E1=97=B4=E2=9A=AA=E1=B4=A5=E2=9A=AA=E1=91=8E?= =?UTF-8?q?=E2=9A=AA=E2=9C=A4=E2=9A=AA=E1=97=A9=E2=9A=AA=E1=97=AF=E2=9A=AA?= =?UTF-8?q?=E1=B4=A5=E2=9A=AA=E1=91=8E=E2=9A=AA=E1=91=90=E1=91=95=E2=9A=AA?= =?UTF-8?q?=E2=97=AF=E2=9A=AA=E1=97=9D=E2=9A=AA=E1=97=B1=E1=97=B4=E2=9A=AA?= =?UTF-8?q?=EA=96=B4=E2=9A=AA=EA=97=B3=E2=9A=AA=EA=96=B4=E2=9A=AA=E1=91=90?= =?UTF-8?q?=E1=91=95=E2=9A=AA=E1=97=B1=E1=97=B4=E2=9A=AA=DF=A6=E2=9A=AA?= =?UTF-8?q?=E1=94=93=E1=94=95=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AA?= =?UTF-8?q?.PY?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...—±α—΄βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺИNβšͺβ“„βšͺκ–΄βšͺ✀βšͺᑐᑕβšͺα‘Žβšͺκ—³βšͺβ—―βšͺα—±α—΄βšͺα΄₯βšͺα‘Žβšͺ✀βšͺα—©βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺᗝβšͺα—±α—΄βšͺκ–΄βšͺκ—³βšͺκ–΄βšͺᑐᑕβšͺα—±α—΄βšͺί¦βšͺα”“α”•βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺα”“α”•βšͺί¦βšͺα—±α—΄βšͺᑐᑕβšͺκ–΄βšͺκ—³βšͺκ–΄βšͺα—±α—΄βšͺᗝβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—©βšͺ✀βšͺα‘Žβšͺα΄₯βšͺα—±α—΄βšͺβ—―βšͺκ—³βšͺα‘Žβšͺᑐᑕβšͺ✀βšͺκ–΄βšͺβ“„βšͺИNβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—±α—΄βšͺβ—―βšͺί¦βšͺᙁβšͺβ“„βšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ.PY | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 βšͺᕀᕦβšͺИNβšͺκ–΄βšͺᙏβšͺα—©βšͺα΄₯βšͺᕀᕦβšͺβ“„βšͺα΄₯βšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺα΄₯βšͺβ“„βšͺᕀᕦβšͺα΄₯βšͺα—©βšͺᙏβšͺκ–΄βšͺИNβšͺᕀᕦβšͺ/βšͺИNβšͺβ“„βšͺ옷βšͺ✀βšͺδΊΊβšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺδΊΊβšͺ✀βšͺ옷βšͺβ“„βšͺИNβšͺ/βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺδΊΊβšͺί¦βšͺα‘Žβšͺᒍᒐβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺᒍᒐβšͺα‘Žβšͺί¦βšͺδΊΊβšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ/YP.βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺβ“„βšͺᙁβšͺί¦βšͺβ—―βšͺα—±α—΄βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺИNβšͺβ“„βšͺκ–΄βšͺ✀βšͺᑐᑕβšͺα‘Žβšͺκ—³βšͺβ—―βšͺα—±α—΄βšͺα΄₯βšͺα‘Žβšͺ✀βšͺα—©βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺᗝβšͺα—±α—΄βšͺκ–΄βšͺκ—³βšͺκ–΄βšͺᑐᑕβšͺα—±α—΄βšͺί¦βšͺα”“α”•βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺα”“α”•βšͺί¦βšͺα—±α—΄βšͺᑐᑕβšͺκ–΄βšͺκ—³βšͺκ–΄βšͺα—±α—΄βšͺᗝβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—©βšͺ✀βšͺα‘Žβšͺα΄₯βšͺα—±α—΄βšͺβ—―βšͺκ—³βšͺα‘Žβšͺᑐᑕβšͺ✀βšͺκ–΄βšͺβ“„βšͺИNβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—±α—΄βšͺβ—―βšͺί¦βšͺᙁβšͺβ“„βšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ.PY diff --git a/βšͺᕀᕦβšͺИNβšͺκ–΄βšͺᙏβšͺα—©βšͺα΄₯βšͺᕀᕦβšͺβ“„βšͺα΄₯βšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺα΄₯βšͺβ“„βšͺᕀᕦβšͺα΄₯βšͺα—©βšͺᙏβšͺκ–΄βšͺИNβšͺᕀᕦβšͺ/βšͺИNβšͺβ“„βšͺ옷βšͺ✀βšͺδΊΊβšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺδΊΊβšͺ✀βšͺ옷βšͺβ“„βšͺИNβšͺ/βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺδΊΊβšͺί¦βšͺα‘Žβšͺᒍᒐβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺᒍᒐβšͺα‘Žβšͺί¦βšͺδΊΊβšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ/YP.βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺβ“„βšͺᙁβšͺί¦βšͺβ—―βšͺα—±α—΄βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺИNβšͺβ“„βšͺκ–΄βšͺ✀βšͺᑐᑕβšͺα‘Žβšͺκ—³βšͺβ—―βšͺα—±α—΄βšͺα΄₯βšͺα‘Žβšͺ✀βšͺα—©βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺᗝβšͺα—±α—΄βšͺκ–΄βšͺκ—³βšͺκ–΄βšͺᑐᑕβšͺα—±α—΄βšͺί¦βšͺα”“α”•βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺα”“α”•βšͺί¦βšͺα—±α—΄βšͺᑐᑕβšͺκ–΄βšͺκ—³βšͺκ–΄βšͺα—±α—΄βšͺᗝβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—©βšͺ✀βšͺα‘Žβšͺα΄₯βšͺα—±α—΄βšͺβ—―βšͺκ—³βšͺα‘Žβšͺᑐᑕβšͺ✀βšͺκ–΄βšͺβ“„βšͺИNβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—±α—΄βšͺβ—―βšͺί¦βšͺᙁβšͺβ“„βšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ.PY b/βšͺᕀᕦβšͺИNβšͺκ–΄βšͺᙏβšͺα—©βšͺα΄₯βšͺᕀᕦβšͺβ“„βšͺα΄₯βšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺα΄₯βšͺβ“„βšͺᕀᕦβšͺα΄₯βšͺα—©βšͺᙏβšͺκ–΄βšͺИNβšͺᕀᕦβšͺ/βšͺИNβšͺβ“„βšͺ옷βšͺ✀βšͺδΊΊβšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺδΊΊβšͺ✀βšͺ옷βšͺβ“„βšͺИNβšͺ/βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺδΊΊβšͺί¦βšͺα‘Žβšͺᒍᒐβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺᒍᒐβšͺα‘Žβšͺί¦βšͺδΊΊβšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ/YP.βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺβ“„βšͺᙁβšͺί¦βšͺβ—―βšͺα—±α—΄βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺИNβšͺβ“„βšͺκ–΄βšͺ✀βšͺᑐᑕβšͺα‘Žβšͺκ—³βšͺβ—―βšͺα—±α—΄βšͺα΄₯βšͺα‘Žβšͺ✀βšͺα—©βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺᗝβšͺα—±α—΄βšͺκ–΄βšͺκ—³βšͺκ–΄βšͺᑐᑕβšͺα—±α—΄βšͺί¦βšͺα”“α”•βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺα”“α”•βšͺί¦βšͺα—±α—΄βšͺᑐᑕβšͺκ–΄βšͺκ—³βšͺκ–΄βšͺα—±α—΄βšͺᗝβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—©βšͺ✀βšͺα‘Žβšͺα΄₯βšͺα—±α—΄βšͺβ—―βšͺκ—³βšͺα‘Žβšͺᑐᑕβšͺ✀βšͺκ–΄βšͺβ“„βšͺИNβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—±α—΄βšͺβ—―βšͺί¦βšͺᙁβšͺβ“„βšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ.PY new file mode 100644 index 00000000..f5d92f71 --- /dev/null +++ b/βšͺᕀᕦβšͺИNβšͺκ–΄βšͺᙏβšͺα—©βšͺα΄₯βšͺᕀᕦβšͺβ“„βšͺα΄₯βšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺα΄₯βšͺβ“„βšͺᕀᕦβšͺα΄₯βšͺα—©βšͺᙏβšͺκ–΄βšͺИNβšͺᕀᕦβšͺ/βšͺИNβšͺβ“„βšͺ옷βšͺ✀βšͺδΊΊβšͺί¦βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺί¦βšͺδΊΊβšͺ✀βšͺ옷βšͺβ“„βšͺИNβšͺ/βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺδΊΊβšͺί¦βšͺα‘Žβšͺᒍᒐβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺᒍᒐβšͺα‘Žβšͺί¦βšͺδΊΊβšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ/YP.βšͺα΄₯βšͺα—±α—΄βšͺ✀βšͺβ“„βšͺᙁβšͺί¦βšͺβ—―βšͺα—±α—΄βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺИNβšͺβ“„βšͺκ–΄βšͺ✀βšͺᑐᑕβšͺα‘Žβšͺκ—³βšͺβ—―βšͺα—±α—΄βšͺα΄₯βšͺα‘Žβšͺ✀βšͺα—©βšͺα—―βšͺα΄₯βšͺα‘Žβšͺᑐᑕβšͺβ—―βšͺᗝβšͺα—±α—΄βšͺκ–΄βšͺκ—³βšͺκ–΄βšͺᑐᑕβšͺα—±α—΄βšͺί¦βšͺα”“α”•βšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺβ—Œβšͺα”“α”•βšͺί¦βšͺα—±α—΄βšͺᑐᑕβšͺκ–΄βšͺκ—³βšͺκ–΄βšͺα—±α—΄βšͺᗝβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—©βšͺ✀βšͺα‘Žβšͺα΄₯βšͺα—±α—΄βšͺβ—―βšͺκ—³βšͺα‘Žβšͺᑐᑕβšͺ✀βšͺκ–΄βšͺβ“„βšͺИNβšͺβ—―βšͺᑐᑕβšͺα‘Žβšͺα΄₯βšͺα—―βšͺα—±α—΄βšͺβ—―βšͺί¦βšͺᙁβšͺβ“„βšͺ✀βšͺα—±α—΄βšͺα΄₯βšͺ.PY @@ -0,0 +1,38 @@ +import numpy as np +from ipywidgets import interact +import plotly.graph_objects as go +from math import * + +def kappa(formula, x): + return eval(formula, {'acos': acos, 'exp': exp, 'cos': cos, 'sin': sin, 'pi': pi, 'x': x}) + +def plot(formula='(1 + cos(((4)/2)*x))/2', RANGE_FROM=0, RANGE_TO=4*pi, N=10): + num_points = 1+2**N + + # Generate x values with the specified number of points + x_vals = np.linspace(RANGE_FROM, RANGE_TO, num_points) + + # Compute kappa values + kappa_vals = np.array([kappa(formula, x_val) for x_val in x_vals]) + + theta_vals = np.cumsum(kappa_vals) * (x_vals[1]-x_vals[0]) if num_points > 1 else np.array([0]) + x_coords_ = np.cumsum(np.cos(theta_vals)) * (x_vals[1] - x_vals[0]) if num_points > 1 else np.array([0]) + y_coords_ = np.cumsum(np.sin(theta_vals)) * (x_vals[1] - x_vals[0]) if num_points > 1 else np.array([0]) + + # Check if the first point is zero, if not, add it manually + if x_coords_[0] != 0 or y_coords_[0] != 0: + x_coords = np.insert(x_coords_, 0, 0) + y_coords = np.insert(y_coords_, 0, 0) + else: + x_coords = x_coords_ + y_coords = y_coords_ + + fig = go.Figure() + + fig.add_trace(go.Scatter(x=x_coords, y=y_coords, mode='lines', name='Curve')) + + fig.update_layout(autosize=True, xaxis=dict(scaleanchor='y', scaleratio=1)) + fig.show() + +# Create the interactive plot +interact(plot, formula='(1 + cos(((4)/2)*x))/2', RANGE_FROM=(0, 4*pi, pi/4), RANGE_TO=(0, 4*pi, pi/4), N=(1,16)); \ No newline at end of file