From 422579be5cfd241bdc825fc95fc5e08b001f4203 Mon Sep 17 00:00:00 2001 From: mbestler <104646544+mbestler@users.noreply.github.com> Date: Tue, 26 Nov 2024 17:30:09 +0100 Subject: [PATCH] Added a test notebook for the 2 step Homotopy --- .gitignore | 1 - 2stepHomotopyTest.ipynb | 706 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 706 insertions(+), 1 deletion(-) create mode 100644 2stepHomotopyTest.ipynb diff --git a/.gitignore b/.gitignore index 0de345cf..72b2b42c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,4 @@ docs/build/** examples/jdp.mplstyle docs/node_modules/** docs/package-lock.json -*.ipynb examples/parametron_result.jld2 \ No newline at end of file diff --git a/2stepHomotopyTest.ipynb b/2stepHomotopyTest.ipynb new file mode 100644 index 00000000..60641204 --- /dev/null +++ b/2stepHomotopyTest.ipynb @@ -0,0 +1,706 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(u1, v1, u2, v2, u3, v3, u4, v4, u5, v5, u6, v6, u7, v7, u8, v8, ω, α, γ, λ, ω0, J)" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "using HomotopyContinuation\n", + "@var u1, v1, u2, v2, u3, v3, u4, v4, u5, v5, u6, v6, u7, v7, u8, v8, ω, α, γ, λ, ω0, J" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Setting up the system" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "8 parametrons (does not work)" + ] + }, + { + "cell_type": "code", + "execution_count": 117, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "System of length 16\n", + " 16 variables: u1, v1, u2, v2, u3, v3, u4, v4, u5, v5, u6, v6, u7, v7, u8, v8\n", + " 6 parameters: ω, α, γ, λ, ω0, J\n", + "\n", + " -J*(u2 + u3 + u4 + u5 + u6 + u7 + u8) - u1*ω^2 + u1*ω0^2 + 0.75*u1^3*α + 0.75*u1*v1^2*α - 0.5*u1*λ*ω0^2 + v1*γ*ω\n", + " -J*(v2 + v3 + v4 + v5 + v6 + v7 + v8) - v1*ω^2 + v1*ω0^2 + 0.75*v1^3*α - u1*γ*ω + 0.75*u1^2*v1*α + 0.5*v1*λ*ω0^2\n", + " -J*(u1 + u3 + u4 + u5 + u6 + u7 + u8) - u2*ω^2 + u2*ω0^2 + 0.75*u2^3*α + 0.75*u2*v2^2*α - 0.5*u2*λ*ω0^2 + v2*γ*ω\n", + " -J*(v1 + v3 + v4 + v5 + v6 + v7 + v8) - v2*ω^2 + v2*ω0^2 + 0.75*v2^3*α - u2*γ*ω + 0.75*u2^2*v2*α + 0.5*v2*λ*ω0^2\n", + " -J*(u1 + u2 + u4 + u5 + u6 + u7 + u8) - u3*ω^2 + u3*ω0^2 + 0.75*u3^3*α + 0.75*u3*v3^2*α - 0.5*u3*λ*ω0^2 + v3*γ*ω\n", + " -J*(v1 + v2 + v4 + v5 + v6 + v7 + v8) - v3*ω^2 + v3*ω0^2 + 0.75*v3^3*α - u3*γ*ω + 0.75*u3^2*v3*α + 0.5*v3*λ*ω0^2\n", + " -J*(u1 + u2 + u3 + u5 + u6 + u7 + u8) - u4*ω^2 + u4*ω0^2 + 0.75*u4^3*α + 0.75*u4*v4^2*α - 0.5*u4*λ*ω0^2 + v4*γ*ω\n", + " -J*(v1 + v2 + v3 + v5 + v6 + v7 + v8) - v4*ω^2 + v4*ω0^2 + 0.75*v4^3*α - u4*γ*ω + 0.75*u4^2*v4*α + 0.5*v4*λ*ω0^2\n", + " -J*(u1 + u2 + u3 + u4 + u6 + u7 + u8) - u5*ω^2 + u5*ω0^2 + 0.75*u5^3*α + 0.75*u5*v5^2*α - 0.5*u5*λ*ω0^2 + v5*γ*ω\n", + " -J*(v1 + v2 + v3 + v4 + v6 + v7 + v8) - v5*ω^2 + v5*ω0^2 + 0.75*v5^3*α - u5*γ*ω + 0.75*u5^2*v5*α + 0.5*v5*λ*ω0^2\n", + " -J*(u1 + u2 + u3 + u4 + u5 + u7 + u8) - u6*ω^2 + u6*ω0^2 + 0.75*u6^3*α + 0.75*u6*v6^2*α - 0.5*u6*λ*ω0^2 + v6*γ*ω\n", + " -J*(v1 + v2 + v3 + v4 + v5 + v7 + v8) - v6*ω^2 + v6*ω0^2 + 0.75*v6^3*α - u6*γ*ω + 0.75*u6^2*v6*α + 0.5*v6*λ*ω0^2\n", + " -J*(u1 + u2 + u3 + u4 + u5 + u6 + u8) - u7*ω^2 + u7*ω0^2 + 0.75*u7^3*α + 0.75*u7*v7^2*α - 0.5*u7*λ*ω0^2 + v7*γ*ω\n", + " -J*(v1 + v2 + v3 + v4 + v5 + v6 + v8) - v7*ω^2 + v7*ω0^2 + 0.75*v7^3*α - u7*γ*ω + 0.75*u7^2*v7*α + 0.5*v7*λ*ω0^2\n", + " -J*(u1 + u2 + u3 + u4 + u5 + u6 + u7) - u8*ω^2 + u8*ω0^2 + 0.75*u8^3*α + 0.75*u8*v8^2*α - 0.5*u8*λ*ω0^2 + v8*γ*ω\n", + " -J*(v1 + v2 + v3 + v4 + v5 + v6 + v7) - v8*ω^2 + v8*ω0^2 + 0.75*v8^3*α - u8*γ*ω + 0.75*u8^2*v8*α + 0.5*v8*λ*ω0^2" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "eqs = [\n", + " -u1*ω^2 + u1*ω0^2 + (3/4)*u1^3*α + (3/4)*u1*v1^2*α + (-1/2)*u1*λ*ω0^2 + v1*γ*ω - J*(u2 + u3 + u4 + u5 + u6 + u7 + u8),\n", + " -v1*ω^2 + v1*ω0^2 + (3/4)*v1^3*α - u1*γ*ω + (3/4)*u1^2*v1*α + (1/2)*v1*λ*ω0^2 - J*(v2 + v3 + v4 + v5 + v6 + v7 + v8),\n", + " -u2*ω^2 + u2*ω0^2 + (3/4)*u2^3*α + (3/4)*u2*v2^2*α + (-1/2)*u2*λ*ω0^2 + v2*γ*ω - J*(u1 + u3 + u4 + u5 + u6 + u7 + u8),\n", + " -v2*ω^2 + v2*ω0^2 + (3/4)*v2^3*α - u2*γ*ω + (3/4)*u2^2*v2*α + (1/2)*v2*λ*ω0^2 - J*(v1 + v3 + v4 + v5 + v6 + v7 + v8),\n", + " -u3*ω^2 + u3*ω0^2 + (3/4)*u3^3*α + (3/4)*u3*v3^2*α + (-1/2)*u3*λ*ω0^2 + v3*γ*ω - J*(u1 + u2 + u4 + u5 + u6 + u7 + u8),\n", + " -v3*ω^2 + v3*ω0^2 + (3/4)*v3^3*α - u3*γ*ω + (3/4)*u3^2*v3*α + (1/2)*v3*λ*ω0^2 - J*(v1 + v2 + v4 + v5 + v6 + v7 + v8),\n", + " -u4*ω^2 + u4*ω0^2 + (3/4)*u4^3*α + (3/4)*u4*v4^2*α + (-1/2)*u4*λ*ω0^2 + v4*γ*ω - J*(u1 + u2 + u3 + u5 + u6 + u7 + u8),\n", + " -v4*ω^2 + v4*ω0^2 + (3/4)*v4^3*α - u4*γ*ω + (3/4)*u4^2*v4*α + (1/2)*v4*λ*ω0^2 - J*(v1 + v2 + v3 + v5 + v6 + v7 + v8),\n", + " -u5*ω^2 + u5*ω0^2 + (3/4)*u5^3*α + (3/4)*u5*v5^2*α + (-1/2)*u5*λ*ω0^2 + v5*γ*ω - J*(u1 + u2 + u3 + u4 + u6 + u7 + u8),\n", + " -v5*ω^2 + v5*ω0^2 + (3/4)*v5^3*α - u5*γ*ω + (3/4)*u5^2*v5*α + (1/2)*v5*λ*ω0^2 - J*(v1 + v2 + v3 + v4 + v6 + v7 + v8),\n", + " -u6*ω^2 + u6*ω0^2 + (3/4)*u6^3*α + (3/4)*u6*v6^2*α + (-1/2)*u6*λ*ω0^2 + v6*γ*ω - J*(u1 + u2 + u3 + u4 + u5 + u7 + u8),\n", + " -v6*ω^2 + v6*ω0^2 + (3/4)*v6^3*α - u6*γ*ω + (3/4)*u6^2*v6*α + (1/2)*v6*λ*ω0^2 - J*(v1 + v2 + v3 + v4 + v5 + v7 + v8),\n", + " -u7*ω^2 + u7*ω0^2 + (3/4)*u7^3*α + (3/4)*u7*v7^2*α + (-1/2)*u7*λ*ω0^2 + v7*γ*ω - J*(u1 + u2 + u3 + u4 + u5 + u6 + u8),\n", + " -v7*ω^2 + v7*ω0^2 + (3/4)*v7^3*α - u7*γ*ω + (3/4)*u7^2*v7*α + (1/2)*v7*λ*ω0^2 - J*(v1 + v2 + v3 + v4 + v5 + v6 + v8),\n", + " -u8*ω^2 + u8*ω0^2 + (3/4)*u8^3*α + (3/4)*u8*v8^2*α + (-1/2)*u8*λ*ω0^2 + v8*γ*ω - J*(u1 + u2 + u3 + u4 + u5 + u6 + u7),\n", + " -v8*ω^2 + v8*ω0^2 + (3/4)*v8^3*α - u8*γ*ω + (3/4)*u8^2*v8*α + (1/2)*v8*λ*ω0^2 - J*(v1 + v2 + v3 + v4 + v5 + v6 + v7)\n", + "]\n", + "\n", + "F = System(eqs, parameters = [ω, α, γ, λ, ω0, J], variables = [u1, v1, u2, v2, u3, v3, u4, v4, u5, v5, u6, v6, u7, v7, u8, v8])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "4 parametrons" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "System of length 8\n", + " 8 variables: u1, v1, u2, v2, u3, v3, u4, v4\n", + " 6 parameters: ω, α, γ, λ, ω0, J\n", + "\n", + " -J*u2 - J*u3 - J*u4 - u1*ω^2 + u1*ω0^2 + 0.75*u1^3*α + 0.75*u1*v1^2*α - 0.5*u1*λ*ω0^2 + v1*γ*ω\n", + " -J*v2 - J*v3 - J*v4 - v1*ω^2 + v1*ω0^2 + 0.75*v1^3*α - u1*γ*ω + 0.75*u1^2*v1*α + 0.5*v1*λ*ω0^2\n", + " -J*u1 - J*u3 - J*u4 - u2*ω^2 + u2*ω0^2 + 0.75*u2^3*α + 0.75*u2*v2^2*α - 0.5*u2*λ*ω0^2 + v2*γ*ω\n", + " -J*v1 - J*v3 - J*v4 - v2*ω^2 + v2*ω0^2 + 0.75*v2^3*α - u2*γ*ω + 0.75*u2^2*v2*α + 0.5*v2*λ*ω0^2\n", + " -J*u1 - J*u2 - J*u4 - u3*ω^2 + u3*ω0^2 + 0.75*u3^3*α + 0.75*u3*v3^2*α - 0.5*u3*λ*ω0^2 + v3*γ*ω\n", + " -J*v1 - J*v2 - J*v4 - v3*ω^2 + v3*ω0^2 + 0.75*v3^3*α - u3*γ*ω + 0.75*u3^2*v3*α + 0.5*v3*λ*ω0^2\n", + " -J*u1 - J*u2 - J*u3 - u4*ω^2 + u4*ω0^2 + 0.75*u4^3*α + 0.75*u4*v4^2*α - 0.5*u4*λ*ω0^2 + v4*γ*ω\n", + " -J*v1 - J*v2 - J*v3 - v4*ω^2 + v4*ω0^2 + 0.75*v4^3*α - u4*γ*ω + 0.75*u4^2*v4*α + 0.5*v4*λ*ω0^2" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "eqs = [\n", + " -u1*ω^2 + u1*ω0^2 + (3/4)*u1^3*α + (3/4)*u1*v1^2*α + (-1/2)*u1*λ*ω0^2 + v1*γ*ω - J*u2 - J*u3 - J*u4,\n", + " -v1*ω^2 + v1*ω0^2 + (3/4)*v1^3*α - u1*γ*ω + (3/4)*u1^2*v1*α + (1/2)*v1*λ*ω0^2 - J*v2 - J*v3 - J*v4,\n", + " -u2*ω^2 + u2*ω0^2 + (3/4)*u2^3*α + (3/4)*u2*v2^2*α + (-1/2)*u2*λ*ω0^2 + v2*γ*ω - J*u1 - J*u3 - J*u4,\n", + " -v2*ω^2 + v2*ω0^2 + (3/4)*v2^3*α - u2*γ*ω + (3/4)*u2^2*v2*α + (1/2)*v2*λ*ω0^2 - J*v1 - J*v3 - J*v4,\n", + " -u3*ω^2 + u3*ω0^2 + (3/4)*u3^3*α + (3/4)*u3*v3^2*α + (-1/2)*u3*λ*ω0^2 + v3*γ*ω - J*u4 - J*u2 - J*u1,\n", + " -v3*ω^2 + v3*ω0^2 + (3/4)*v3^3*α - u3*γ*ω + (3/4)*u3^2*v3*α + (1/2)*v3*λ*ω0^2 - J*v4 - J*v2 - J*v1,\n", + " -u4*ω^2 + u4*ω0^2 + (3/4)*u4^3*α + (3/4)*u4*v4^2*α + (-1/2)*u4*λ*ω0^2 + v4*γ*ω - J*u3 - J*u2 - J*u1,\n", + " -v4*ω^2 + v4*ω0^2 + (3/4)*v4^3*α - u4*γ*ω + (3/4)*u4^2*v4*α + (1/2)*v4*λ*ω0^2 - J*v3 - J*v2 - J*v1,\n", + "]\n", + "\n", + "F = System(eqs, parameters = [ω, α, γ, λ, ω0, J], variables = [u1, v1, u2, v2, u3, v3, u4, v4])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "1 parametron" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "eqs2 = [\n", + " -u1*ω^2 + u1*ω0^2 + (3/4)*u1^3*α + (3/4)*u1*v1^2*α + (-1/2)*u1*λ*ω0^2 + v1*γ*ω,\n", + " -v1*ω^2 + v1*ω0^2 + (3/4)*v1^3*α - u1*γ*ω + (3/4)*u1^2*v1*α + (1/2)*v1*λ*ω0^2,\n", + "]\n", + "\n", + "F2 = System(eqs, parameters = [ω, α, γ, λ, ω0, J], variables = [u1, v1])\n", + "start_parameters2 = [0.9, 1.0, 0.01, 5, 1.1, 0]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Test values" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "6-element Vector{Float64}:\n", + " 0.9\n", + " 1.0\n", + " 0.01\n", + " 5.0\n", + " 1.1\n", + " 1.0" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "input_array = [\n", + " [0.9, 1.0, 0.01, 5, 1.1, 1],\n", + " [0.9105263157894737, 1.0, 0.01, 5, 1.1, 1],\n", + " [0.9210526315789473, 1.0, 0.01, 5, 1.1, 1],\n", + " [0.9315789473684211, 1.0, 0.01, 5, 1.1, 1],\n", + " [0.9421052631578948, 1.0, 0.01, 5, 1.1, 1],\n", + " [0.9526315789473684, 1.0, 0.01, 5, 1.1, 1]]\n", + "\n", + "start_parameters = [0.9, 1.0, 0.01, 5, 1.1, 0]\n", + "start_parameters_withJ = [0.9, 1.0, 0.01, 5, 1.1, 1]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "2 step no J" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[32mTracking 6561 paths... 14%|████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 19%|██████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 25%|███████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 30%|█████████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 36%|███████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 42%|████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 48%|██████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 53%|███████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 58%|█████████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 64%|███████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 71%|████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 78%|██████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 84%|████████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 91%|██████████████████████████ | ETA: 0:00:00\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 97%|████████████████████████████| ETA: 0:00:00\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 100%|████████████████████████████| Time: 0:00:03\u001b[39m\u001b[K\n", + "\u001b[34m # paths tracked: 6561\u001b[39m\u001b[K\n", + "\u001b[34m # non-singular solutions (real): 625 (81)\u001b[39m\u001b[K\n", + "\u001b[34m # singular endpoints (real): 0 (0)\u001b[39m\u001b[K\n", + "\u001b[34m # total solutions (real): 625 (81)\u001b[39m\u001b[K\n", + "\u001b[32mSolving for 6 parameters... 33%|████████ | ETA: 0:00:05\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 50%|████████████ | ETA: 0:00:04\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 67%|████████████████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 83%|████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 100%|███████████████████████| Time: 0:00:08\u001b[39m\u001b[K\n", + "\u001b[34m # parameters solved: 6\u001b[39m\u001b[K\n", + "\u001b[34m # paths tracked: 3750\u001b[39m\u001b[K\n" + ] + }, + { + "data": { + "text/plain": [ + "6-element Vector{Tuple{Result, Vector{Float64}}}:\n", + " (Result with 521 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 521 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 526 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 526 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9105263157894737, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 524 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 524 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9210526315789473, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 525 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 525 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9315789473684211, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 524 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 524 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9421052631578948, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 524 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 524 non-singular solutions (29 real)\n", + "• random_seed: 0x5c5cb10b\n", + ", [0.9526315789473684, 1.0, 0.01, 5.0, 1.1, 1.0])" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "warmup_solution = HomotopyContinuation.solve(\n", + " F;\n", + " start_system=:total_degree,\n", + " target_parameters=start_parameters,\n", + " threading=true\n", + ")\n", + "\n", + "newsol=solutions(warmup_solution);\n", + "for i in length(solutions(warmup_solution))\n", + " newsol[i]=solutions(warmup_solution)[i].+rand(8)*0.00001im+rand(8)*0.0000001\n", + "end\n", + "\n", + "fSolution = HomotopyContinuation.solve(\n", + " F,\n", + " newsol;\n", + " start_parameters = start_parameters,\n", + " target_parameters=input_array,\n", + " threading=true\n", + ")\n", + "\n", + "fSolution" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "625-element Vector{Vector{ComplexF64}}:\n", + " [-1.0691058840368783e-50 - 0.003178969950357846im, -6.842277657836021e-49 - 2.1369695153505464im, 0.0 - 0.003178969950357846im, 0.0 - 2.1369695153505464im, -1.0691058840368783e-50 - 0.003178969950357846im, -6.842277657836021e-49 - 2.1369695153505464im, 0.0 - 0.003178969950357846im, 0.0 - 2.1369695153505464im]\n", + " [0.0 + 0.003178969950357846im, 2.938735877055719e-39 + 2.1369695153505464im, 5.877471754111438e-39 - 0.0031789699503578465im, 0.0 - 2.1369695153505464im, 5.877471754111438e-39 - 0.0031789699503578465im, 0.0 - 2.1369695153505464im, 5.877471754111438e-39 - 0.0031789699503578465im, 0.0 - 2.1369695153505464im]\n", + " [1.8708218523875026 + 0.0im, 0.00278304693094187 + 0.0im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im]\n", + " [1.0676559728189082e-45 + 0.0im, 3.587324068671532e-43 + 0.0im, -1.504632769052528e-36 - 0.003178969950357846im, -2.407412430484045e-35 - 2.1369695153505464im, 0.0 - 0.003178969950357846im, -1.2037062152420224e-35 - 2.1369695153505464im, -1.504632769052528e-36 - 0.003178969950357846im, -2.407412430484045e-35 - 2.1369695153505464im]\n", + " [-1.8708218523875026 + 1.504632769052528e-36im, -0.0027830469309418696 - 4.70197740328915e-38im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im, -7.52316384526264e-37 - 0.0031789699503578465im, -1.2037062152420224e-35 - 2.1369695153505464im]\n", + " [0.0 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im, 1.8367099231598242e-40 + 0.0031789699503578465im, -1.4693679385278594e-39 + 2.1369695153505464im, 0.0 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im, 0.0 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im]\n", + " [0.0 + 0.003178969950357846im, 2.938735877055719e-39 + 2.1369695153505464im, -3.6734198463196485e-40 + 0.003178969950357846im, 1.4693679385278594e-39 + 2.1369695153505464im, 5.877471754111438e-39 - 0.0031789699503578465im, 4.70197740328915e-38 - 2.1369695153505464im, 5.877471754111438e-39 - 0.0031789699503578465im, 4.70197740328915e-38 - 2.1369695153505464im]\n", + " [1.8708218523875029 + 2.0089014784560578e-41im, 0.00278304693094187 + 2.152394441202919e-42im, 1.8367099231598242e-40 + 0.003178969950357846im, 0.0 + 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 2.350988701644575e-38 - 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im]\n", + " [0.0 + 0.0im, 0.0 + 0.0im, 1.8367099231598242e-40 + 0.003178969950357846im, 0.0 + 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 2.350988701644575e-38 - 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im]\n", + " [-1.8708218523875026 + 0.0im, -0.0027830469309418696 + 0.0im, 1.8367099231598242e-40 + 0.003178969950357846im, 0.0 + 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 2.350988701644575e-38 - 2.1369695153505464im, 5.877471754111438e-39 - 0.003178969950357846im, 4.70197740328915e-38 - 2.1369695153505464im]\n", + " ⋮\n", + " [1.0947644252537633e-47 + 0.003178969950357846im, 7.006492321624085e-46 + 2.1369695153505464im, 0.0 + 0.0im, 0.0 + 0.0im, -1.8708218523875024 + 1.2316099784104838e-47im, -0.0027830469309418696 + 1.0263416486754031e-48im, -1.8708218523875024 + 1.9158377441940858e-47im, -0.0027830469309418696 + 0.0im]\n", + " [1.8708218523875024 - 4.81482486096809e-35im, 0.0027830469309418696 - 3.009265538105056e-36im, 0.0 - 6.516454912224781e-50im, 0.0 - 2.1895288505075267e-47im, -1.8708218523875026 + 0.0im, -0.00278304693094187 - 9.62964972193618e-35im, -1.8708218523875026 - 1.1555579666323415e-33im, -0.00278304693094187 - 9.62964972193618e-35im]\n", + " [0.0 - 2.08526557191193e-48im, 0.0 - 7.006492321624085e-46im, 0.0 + 2.08526557191193e-48im, 0.0 + 7.006492321624085e-46im, -1.8708218523875026 - 1.232595164407831e-32im, -0.00278304693094187 - 3.0814879110195774e-33im, -1.8708218523875026 + 0.0im, -0.00278304693094187 - 3.0814879110195774e-33im]\n", + " [-1.8708218523875026 + 0.0im, -0.0027830469309418704 + 0.0im, 0.0 - 2.08526557191193e-48im, 0.0 - 7.006492321624085e-46im, -1.8708218523875026 + 0.0im, -0.0027830469309418696 + 0.0im, -1.8708218523875026 + 0.0im, -0.0027830469309418704 + 0.0im]\n", + " [-7.52316384526264e-37 - 0.003178969950357846im, -1.2037062152420224e-35 - 2.1369695153505464im, -1.8708218523875026 + 9.027796614315168e-36im, -0.0027830469309418696 + 1.410593220986745e-37im, -1.8708218523875026 + 9.027796614315168e-36im, -0.0027830469309418696 + 9.4039548065783e-38im, -1.8708218523875026 + 9.027796614315168e-36im, -0.0027830469309418696 + 1.410593220986745e-37im]\n", + " [1.0947644252537633e-47 + 0.003178969950357846im, 7.006492321624085e-46 + 2.1369695153505464im, -1.8708218523875024 + 1.9158377441940858e-47im, -0.0027830469309418696 + 0.0im, -1.8708218523875024 + 1.2316099784104838e-47im, -0.0027830469309418696 + 1.0263416486754031e-48im, -1.8708218523875024 + 1.9158377441940858e-47im, -0.0027830469309418696 + 0.0im]\n", + " [1.8708218523875026 + 0.0im, 0.0027830469309418696 - 1.504632769052528e-36im, -1.8708218523875026 - 5.7777898331617076e-34im, -0.0027830469309418696 - 7.222237291452134e-35im, -1.8708218523875029 + 1.1555579666323415e-33im, -0.002783046930941869 + 4.81482486096809e-35im, -1.8708218523875026 - 5.7777898331617076e-34im, -0.0027830469309418696 - 7.222237291452134e-35im]\n", + " [0.0 + 2.08526557191193e-48im, 0.0 + 7.006492321624085e-46im, -1.8708218523875026 - 2.465190328815662e-32im, -0.0027830469309418704 + 0.0im, -1.8708218523875026 + 0.0im, -0.00278304693094187 + 0.0im, -1.8708218523875026 + 0.0im, -0.00278304693094187 + 0.0im]\n", + " [-1.870821847178418 + 1.939296786960706e-6im, -0.0027829924559342836 + 4.34575563603091e-6im, -1.8708217974732624 + 5.665919267919917e-6im, -0.0027829545672204644 + 2.7879400865198436e-6im, -1.870821790173536 + 7.076588127348126e-6im, -0.0027829600266840297 + 1.2002854966457744e-6im, -1.870821771463035 + 2.1615050880567324e-6im, -0.0027829996344246387 + 1.4687018136390973e-6im]" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "newsol" + ] + }, + { + "cell_type": "code", + "execution_count": 100, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "8-element Vector{Float64}:\n", + " -1.5154259527006888\n", + " -0.001459485302354014\n", + " 1.5155034646754815\n", + " 0.005212677741462676\n", + " 1.515514060697262\n", + " 0.0033130058615278265\n", + " -1.5154259527006888\n", + " -0.0014594853023540133" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "real_solutions(fSolution[6][1])[10]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "2 step J" + ] + }, + { + "cell_type": "code", + "execution_count": 111, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[32mTracking 6561 paths... 14%|████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 19%|██████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 23%|███████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 29%|█████████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 35%|██████████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 40%|████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 46%|█████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 51%|███████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 56%|████████████████ | ETA: 0:00:02\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 62%|██████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 67%|███████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 72%|█████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 78%|██████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 83%|████████████████████████ | ETA: 0:00:01\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 88%|█████████████████████████ | ETA: 0:00:00\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 93%|███████████████████████████ | ETA: 0:00:00\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 99%|████████████████████████████| ETA: 0:00:00\u001b[39m\u001b[K\n", + "\n", + "\n", + "\n", + "\u001b[32mTracking 6561 paths... 100%|████████████████████████████| Time: 0:00:03\u001b[39m\u001b[K\n", + "\u001b[34m # paths tracked: 6561\u001b[39m\u001b[K\n", + "\u001b[34m # non-singular solutions (real): 625 (29)\u001b[39m\u001b[K\n", + "\u001b[34m # singular endpoints (real): 0 (0)\u001b[39m\u001b[K\n", + "\u001b[34m # total solutions (real): 625 (29)\u001b[39m\u001b[K\n" + ] + }, + { + "data": { + "text/plain": [ + "6-element Vector{Tuple{Result, Vector{Float64}}}:\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9105263157894737, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9210526315789473, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9315789473684211, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9421052631578948, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 625 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0x8707696c\n", + ", [0.9526315789473684, 1.0, 0.01, 5.0, 1.1, 1.0])" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "warmup_solution = HomotopyContinuation.solve(\n", + " F;\n", + " start_system=:total_degree,\n", + " target_parameters=start_parameters_withJ,\n", + " threading=true\n", + ")\n", + "\n", + "newsol=solutions(warmup_solution);\n", + "\n", + "\n", + "HomotopyContinuation.solve(\n", + " F,\n", + " newsol;\n", + " start_parameters = start_parameters_withJ,\n", + " target_parameters=input_array,\n", + " threading=true\n", + ")\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "1 step" + ] + }, + { + "cell_type": "code", + "execution_count": 112, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "┌ Warning: Solving for many parameters with total degree start system is not recommended. Instead, one should use a two-step approach: first solve a system with generic parameters, and track its solutions to the desired parameters. See https://www.juliahomotopycontinuation.org/guides/many-systems/.\n", + "└ @ HomotopyContinuation C:\\Users\\Markus\\.julia\\packages\\HomotopyContinuation\\HdN5z\\src\\solve.jl:766\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\u001b[32mSolving for 6 parameters... 33%|████████ | ETA: 0:00:13\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 50%|████████████ | ETA: 0:00:10\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 67%|████████████████ | ETA: 0:00:07\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 83%|████████████████████ | ETA: 0:00:03\u001b[39m\u001b[K\n", + "\n", + "\u001b[32mSolving for 6 parameters... 100%|███████████████████████| Time: 0:00:19\u001b[39m\u001b[K\n", + "\u001b[34m # parameters solved: 6\u001b[39m\u001b[K\n", + "\u001b[34m # paths tracked: 39366\u001b[39m\u001b[K\n" + ] + }, + { + "data": { + "text/plain": [ + "6-element Vector{Tuple{Result, Vector{Float64}}}:\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9105263157894737, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9210526315789473, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9315789473684211, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9421052631578948, 1.0, 0.01, 5.0, 1.1, 1.0])\n", + " (Result with 625 solutions\n", + "=========================\n", + "• 6561 paths tracked\n", + "• 625 non-singular solutions (29 real)\n", + "• random_seed: 0xd7102576\n", + "• start_system: :total_degree\n", + ", [0.9526315789473684, 1.0, 0.01, 5.0, 1.1, 1.0])" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "fullsolution = HomotopyContinuation.solve(\n", + " F;\n", + " start_system=:total_degree,\n", + " target_parameters=input_array,\n", + " threading=true\n", + ")\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Julia 1.11.1", + "language": "julia", + "name": "julia-1.11" + }, + "language_info": { + "file_extension": ".jl", + "mimetype": "application/julia", + "name": "julia", + "version": "1.11.1" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +}