0
0
mirror of http://CODE.RHODECODE.COM/u/O/O/O synced 2024-09-20 04:36:41 -04:00
O/⚪ᕤᕦ⚪ИN⚪ꖴ⚪ᙏ⚪ᗩ⚪ᴥ⚪ᕤᕦ⚪Ⓞ⚪ᴥ⚪ߦ⚪◌⚪◌⚪◌⚪◌⚪◌⚪◌⚪ߦ⚪ᴥ⚪Ⓞ⚪ᕤᕦ⚪ᴥ⚪ᗩ⚪ᙏ⚪ꖴ⚪ИN⚪ᕤᕦ⚪/⚪ИN⚪Ⓞ⚪옷⚪✤⚪人⚪ߦ⚪◌⚪◌⚪◌⚪◌⚪◌⚪◌⚪ߦ⚪人⚪✤⚪옷⚪Ⓞ⚪ИN⚪/⚪ᴥ⚪ᗱᗴ⚪✤⚪人⚪ߦ⚪ᑎ⚪ᒍᒐ⚪◌⚪◌⚪◌⚪◌⚪◌⚪◌⚪ᒍᒐ⚪ᑎ⚪ߦ⚪人⚪✤⚪ᗱᗴ⚪ᴥ⚪/BИYPI.⚪ᴥ⚪ᗱᗴ⚪✤⚪Ⓞ⚪ᙁ⚪ߦ⚪◯⚪ᗱᗴ⚪ᗯ⚪ᴥ⚪ᑎ⚪ᑐᑕ⚪◯⚪ИN⚪Ⓞ⚪ꖴ⚪✤⚪ᑐᑕ⚪ᑎ⚪ꗳ⚪◯⚪ᗱᗴ⚪ᴥ⚪ᑎ⚪✤⚪ᗩ⚪ᗯ⚪ᴥ⚪ᑎ⚪ᑐᑕ⚪◯⚪ᗝ⚪ᗱᗴ⚪ꖴ⚪ꗳ⚪ꖴ⚪ᑐᑕ⚪ᗱᗴ⚪ߦ⚪ᔓᔕ⚪◌⚪◌⚪◌⚪◌⚪◌⚪◌⚪ᔓᔕ⚪ߦ⚪ᗱᗴ⚪ᑐᑕ⚪ꖴ⚪ꗳ⚪ꖴ⚪ᗱᗴ⚪ᗝ⚪◯⚪ᑐᑕ⚪ᑎ⚪ᴥ⚪ᗯ⚪ᗩ⚪✤⚪ᑎ⚪ᴥ⚪ᗱᗴ⚪◯⚪ꗳ⚪ᑎ⚪ᑐᑕ⚪✤⚪ꖴ⚪Ⓞ⚪ИN⚪◯⚪ᑐᑕ⚪ᑎ⚪ᴥ⚪ᗯ⚪ᗱᗴ⚪◯⚪ߦ⚪ᙁ⚪Ⓞ⚪✤⚪ᗱᗴ⚪ᴥ⚪.IPYNB
ec1b13268e BИYPI.ᗱᗴߦᗱᗴᑐᑕИNᑐᑕᗱᗴᑐᑕᗱᗴᑐᑕᗱᗴߦᔓᔕᔓᔕߦᗱᗴᑐᑕᗱᗴᑐᑕᗱᗴᑐᑕИNᑐᑕᗱᗴߦᗱᗴ.IPYNB
2023-11-12 07:09:42 +00:00

1 line
2.8 KiB
Plaintext

{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[],"dockerImageVersionId":30579,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nfrom ipywidgets import interact\nimport plotly.graph_objects as go\nfrom math import *\n\ndef kappa(formula, x):\n return eval(formula, {'acos': acos, 'exp': exp, 'cos': cos, 'sin': sin, 'pi': pi, 'x': x})\n\ndef plot(formula='(1 + cos(((4)/2)*x))/2', RANGE_FROM=0, RANGE_TO=4*pi, N=10):\n num_points = 1+2**N\n\n # Generate x values with the specified number of points\n x_vals = np.linspace(RANGE_FROM, RANGE_TO, num_points)\n\n # Compute kappa values\n kappa_vals = np.array([kappa(formula, x_val) for x_val in x_vals])\n\n theta_vals = np.cumsum(kappa_vals) * (x_vals[1]-x_vals[0]) if num_points > 1 else np.array([0])\n x_coords_ = np.cumsum(np.cos(theta_vals)) * (x_vals[1] - x_vals[0]) if num_points > 1 else np.array([0])\n y_coords_ = np.cumsum(np.sin(theta_vals)) * (x_vals[1] - x_vals[0]) if num_points > 1 else np.array([0])\n\n # Check if the first point is zero, if not, add it manually\n if x_coords_[0] != 0 or y_coords_[0] != 0:\n x_coords = np.insert(x_coords_, 0, 0)\n y_coords = np.insert(y_coords_, 0, 0)\n else:\n x_coords = x_coords_\n y_coords = y_coords_\n\n fig = go.Figure()\n\n fig.add_trace(go.Scatter(x=x_coords, y=y_coords, mode='lines', name='Curve'))\n\n fig.update_layout(autosize=True, xaxis=dict(scaleanchor='y', scaleratio=1))\n fig.show()\n\n# Create the interactive plot\ninteract(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));","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"execution":{"iopub.status.busy":"2023-11-12T07:01:38.567603Z","iopub.execute_input":"2023-11-12T07:01:38.568046Z","iopub.status.idle":"2023-11-12T07:01:39.122214Z","shell.execute_reply.started":"2023-11-12T07:01:38.568004Z","shell.execute_reply":"2023-11-12T07:01:39.121279Z"},"jupyter":{"source_hidden":true},"trusted":true},"execution_count":1,"outputs":[{"output_type":"display_data","data":{"text/plain":"interactive(children=(Text(value='(1 + cos(((4)/2)*x))/2', description='formula'), FloatSlider(value=0.0, desc…","application/vnd.jupyter.widget-view+json":{"version_major":2,"version_minor":0,"model_id":"97d06e9715754ecbac76d3fbd0d3df08"}},"metadata":{}}]}]}