euler314 commited on
Commit
46a5b16
Β·
verified Β·
1 Parent(s): 9bf4d29

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -47
app.py CHANGED
@@ -17,7 +17,7 @@ from sympy import symbols, solve, I, re, im, Poly, simplify, N, mpmath
17
  # Set page config with wider layout
18
  st.set_page_config(
19
  page_title="Matrix Analysis Dashboard",
20
- page_icon="πŸ“Š",
21
  layout="wide",
22
  initial_sidebar_state="expanded"
23
  )
@@ -388,7 +388,7 @@ CubicRoots solveCubic(double a, double b, double c, double d) {
388
  }
389
 
390
  if (std::abs(delta0) < zero_threshold) {
391
- // Delta0 β‰ˆ 0: One double root and one simple root
392
  double simple = std::cbrt(-delta1);
393
  double doubleRoot = -simple/2 - shift;
394
  double simpleRoot = simple - shift;
@@ -716,21 +716,21 @@ bool eigenvalueAnalysis(int n, int p, double a, double y, int fineness,
716
  << ", theory_tolerance = " << theory_tolerance << std::endl;
717
  std::cout << "Output will be saved to: " << output_file << std::endl;
718
 
719
- // ─── Beta range parameters ────────────────────────────────────────
720
  const int num_beta_points = fineness; // Controlled by fineness parameter
721
  std::vector<double> beta_values(num_beta_points);
722
  for (int i = 0; i < num_beta_points; ++i) {
723
  beta_values[i] = static_cast<double>(i) / (num_beta_points - 1);
724
  }
725
 
726
- // ─── Storage for results ────────────────────────────────────────
727
  std::vector<double> max_eigenvalues(num_beta_points);
728
  std::vector<double> min_eigenvalues(num_beta_points);
729
  std::vector<double> theoretical_max_values(num_beta_points);
730
  std::vector<double> theoretical_min_values(num_beta_points);
731
 
732
  try {
733
- // ─── Random‐Gaussian X and S_n ────────────────────────────────
734
  std::random_device rd;
735
  std::mt19937_64 rng{rd()};
736
  std::normal_distribution<double> norm(0.0, 1.0);
@@ -740,7 +740,7 @@ bool eigenvalueAnalysis(int n, int p, double a, double y, int fineness,
740
  for(int j = 0; j < n; ++j)
741
  X.at<double>(i,j) = norm(rng);
742
 
743
- // ─── Process each beta value ─────────────────────────────────
744
  for (int beta_idx = 0; beta_idx < num_beta_points; ++beta_idx) {
745
  double beta = beta_values[beta_idx];
746
 
@@ -748,7 +748,7 @@ bool eigenvalueAnalysis(int n, int p, double a, double y, int fineness,
748
  theoretical_max_values[beta_idx] = compute_theoretical_max(a, y, beta, theory_grid_points, theory_tolerance);
749
  theoretical_min_values[beta_idx] = compute_theoretical_min(a, y, beta, theory_grid_points, theory_tolerance);
750
 
751
- // ─── Build T_n matrix ──────────────────────────────────
752
  int k = static_cast<int>(std::floor(beta * p));
753
  std::vector<double> diags(p, 1.0);
754
  std::fill_n(diags.begin(), k, a);
@@ -759,10 +759,10 @@ bool eigenvalueAnalysis(int n, int p, double a, double y, int fineness,
759
  T_n.at<double>(i,i) = diags[i];
760
  }
761
 
762
- // ─── Form B_n = (1/n) * X * T_n * X^T ────────────
763
  cv::Mat B = (X.t() * T_n * X) / static_cast<double>(n);
764
 
765
- // ─── Compute eigenvalues of B ────────────────────────────
766
  cv::Mat eigVals;
767
  cv::eigen(B, eigVals);
768
  std::vector<double> eigs(n);
@@ -820,7 +820,7 @@ int main(int argc, char* argv[]) {
820
 
821
  try {
822
  if (mode == "eigenvalues") {
823
- // ─── Eigenvalue analysis mode ───────────────────────────────────────────
824
  if (argc != 10) {
825
  std::cerr << "Error: Incorrect number of arguments for eigenvalues mode." << std::endl;
826
  std::cerr << "Usage: " << argv[0] << " eigenvalues <n> <p> <a> <y> <fineness> <theory_grid_points> <theory_tolerance> <output_file>" << std::endl;
@@ -857,7 +857,7 @@ int main(int argc, char* argv[]) {
857
 
858
  # Compile the C++ code with the right OpenCV libraries
859
  st.sidebar.title("Dashboard Settings")
860
- need_compile = not os.path.exists(executable) or st.sidebar.button("πŸ”„ Recompile C++ Code")
861
 
862
  if need_compile:
863
  with st.sidebar:
@@ -891,11 +891,11 @@ if need_compile:
891
 
892
  if success:
893
  compiled = True
894
- st.success(f"βœ… Successfully compiled with: {cmd}")
895
  break
896
 
897
  if not compiled:
898
- st.error("❌ All compilation attempts failed.")
899
  with st.expander("Compilation Details"):
900
  st.code(compile_output)
901
  st.stop()
@@ -904,7 +904,7 @@ if need_compile:
904
  if platform.system() != "Windows":
905
  os.chmod(executable, 0o755)
906
 
907
- st.success("βœ… C++ code compiled successfully!")
908
 
909
  # Set higher precision for mpmath
910
  mpmath.mp.dps = 100 # 100 digits of precision
@@ -1042,7 +1042,7 @@ def compute_ImS_vs_Z(a, y, beta, num_points, z_min, z_max, progress_callback=Non
1042
  progress_callback(i / num_points)
1043
 
1044
  # Coefficients for the cubic equation:
1045
- # zasΒ³ + [z(a+1)+a(1-y)]sΒ² + [z+(a+1)-y-yΞ²(a-1)]s + 1 = 0
1046
  coef_a = z * a
1047
  coef_b = z * (a + 1) + a * (1 - y)
1048
  coef_c = z + (a + 1) - y - y * beta * (a - 1)
@@ -1116,8 +1116,8 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1116
  rows=2,
1117
  cols=1,
1118
  subplot_titles=(
1119
- f"Imaginary Parts of Roots: a={cubic_a}, y={cubic_y}, Ξ²={cubic_beta}",
1120
- f"Real Parts of Roots: a={cubic_a}, y={cubic_y}, Ξ²={cubic_beta}"
1121
  ),
1122
  vertical_spacing=0.15,
1123
  specs=[[{"type": "scatter"}], [{"type": "scatter"}]]
@@ -1129,9 +1129,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1129
  x=z_values,
1130
  y=ims_values1,
1131
  mode='lines',
1132
- name='Im(s₁)',
1133
  line=dict(color='rgb(239, 85, 59)', width=2.5),
1134
- hovertemplate='z: %{x:.4f}<br>Im(s₁): %{y:.6f}<extra>Root 1</extra>'
1135
  ),
1136
  row=1, col=1
1137
  )
@@ -1141,9 +1141,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1141
  x=z_values,
1142
  y=ims_values2,
1143
  mode='lines',
1144
- name='Im(sβ‚‚)',
1145
  line=dict(color='rgb(0, 129, 201)', width=2.5),
1146
- hovertemplate='z: %{x:.4f}<br>Im(sβ‚‚): %{y:.6f}<extra>Root 2</extra>'
1147
  ),
1148
  row=1, col=1
1149
  )
@@ -1153,9 +1153,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1153
  x=z_values,
1154
  y=ims_values3,
1155
  mode='lines',
1156
- name='Im(s₃)',
1157
  line=dict(color='rgb(0, 176, 80)', width=2.5),
1158
- hovertemplate='z: %{x:.4f}<br>Im(s₃): %{y:.6f}<extra>Root 3</extra>'
1159
  ),
1160
  row=1, col=1
1161
  )
@@ -1166,9 +1166,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1166
  x=z_values,
1167
  y=real_values1,
1168
  mode='lines',
1169
- name='Re(s₁)',
1170
  line=dict(color='rgb(239, 85, 59)', width=2.5),
1171
- hovertemplate='z: %{x:.4f}<br>Re(s₁): %{y:.6f}<extra>Root 1</extra>'
1172
  ),
1173
  row=2, col=1
1174
  )
@@ -1178,9 +1178,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1178
  x=z_values,
1179
  y=real_values2,
1180
  mode='lines',
1181
- name='Re(sβ‚‚)',
1182
  line=dict(color='rgb(0, 129, 201)', width=2.5),
1183
- hovertemplate='z: %{x:.4f}<br>Re(sβ‚‚): %{y:.6f}<extra>Root 2</extra>'
1184
  ),
1185
  row=2, col=1
1186
  )
@@ -1190,9 +1190,9 @@ def create_dash_style_visualization(result, cubic_a, cubic_y, cubic_beta):
1190
  x=z_values,
1191
  y=real_values3,
1192
  mode='lines',
1193
- name='Re(s₃)',
1194
  line=dict(color='rgb(0, 176, 80)', width=2.5),
1195
- hovertemplate='z: %{x:.4f}<br>Re(s₃): %{y:.6f}<extra>Root 3</extra>'
1196
  ),
1197
  row=2, col=1
1198
  )
@@ -1482,7 +1482,7 @@ def create_complex_plane_visualization(result, z_idx):
1482
  symbol='circle',
1483
  line=dict(width=1, color='black')
1484
  ),
1485
- text=['s₁', 'sβ‚‚', 's₃'],
1486
  textposition="top center",
1487
  name='Roots'
1488
  ))
@@ -1614,7 +1614,7 @@ with st.sidebar.expander("Theme & Appearance"):
1614
  color_theory_min = 'rgb(180, 30, 180)'
1615
 
1616
  # Create tabs for different analyses
1617
- tab1, tab2 = st.tabs(["πŸ“Š Eigenvalue Analysis (C++)", "πŸ“ˆ Im(s) vs z Analysis (SymPy)"])
1618
 
1619
  # Tab 1: Eigenvalue Analysis (KEEP UNCHANGED from original)
1620
  with tab1:
@@ -1648,7 +1648,7 @@ with tab1:
1648
  max_value=500,
1649
  value=100,
1650
  step=10,
1651
- help="Number of points to calculate along the Ξ² axis (0 to 1)",
1652
  key="eig_fineness"
1653
  )
1654
  st.markdown('</div>', unsafe_allow_html=True)
@@ -1831,7 +1831,7 @@ with tab1:
1831
  color=color_max,
1832
  line=dict(color='white', width=1)
1833
  ),
1834
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Max</extra>'
1835
  ))
1836
 
1837
  fig.add_trace(go.Scatter(
@@ -1846,7 +1846,7 @@ with tab1:
1846
  color=color_min,
1847
  line=dict(color='white', width=1)
1848
  ),
1849
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Min</extra>'
1850
  ))
1851
 
1852
  fig.add_trace(go.Scatter(
@@ -1861,7 +1861,7 @@ with tab1:
1861
  color=color_theory_max,
1862
  line=dict(color='white', width=1)
1863
  ),
1864
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Max</extra>'
1865
  ))
1866
 
1867
  fig.add_trace(go.Scatter(
@@ -1876,7 +1876,7 @@ with tab1:
1876
  color=color_theory_min,
1877
  line=dict(color='white', width=1)
1878
  ),
1879
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Min</extra>'
1880
  ))
1881
 
1882
  # Configure layout for better appearance
@@ -1890,7 +1890,7 @@ with tab1:
1890
  'yanchor': 'top'
1891
  },
1892
  xaxis={
1893
- 'title': {'text': 'Ξ² Parameter', 'font': {'size': 18, 'color': '#424242'}},
1894
  'tickfont': {'size': 14},
1895
  'gridcolor': 'rgba(220, 220, 220, 0.5)',
1896
  'showgrid': True
@@ -1986,7 +1986,7 @@ with tab1:
1986
  color=color_max,
1987
  line=dict(color='white', width=1)
1988
  ),
1989
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Max</extra>'
1990
  ))
1991
 
1992
  fig.add_trace(go.Scatter(
@@ -2001,7 +2001,7 @@ with tab1:
2001
  color=color_min,
2002
  line=dict(color='white', width=1)
2003
  ),
2004
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Min</extra>'
2005
  ))
2006
 
2007
  fig.add_trace(go.Scatter(
@@ -2016,7 +2016,7 @@ with tab1:
2016
  color=color_theory_max,
2017
  line=dict(color='white', width=1)
2018
  ),
2019
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Max</extra>'
2020
  ))
2021
 
2022
  fig.add_trace(go.Scatter(
@@ -2031,7 +2031,7 @@ with tab1:
2031
  color=color_theory_min,
2032
  line=dict(color='white', width=1)
2033
  ),
2034
- hovertemplate='Ξ²: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Min</extra>'
2035
  ))
2036
 
2037
  # Configure layout for better appearance
@@ -2045,7 +2045,7 @@ with tab1:
2045
  'yanchor': 'top'
2046
  },
2047
  xaxis={
2048
- 'title': {'text': 'Ξ² Parameter', 'font': {'size': 18, 'color': '#424242'}},
2049
  'tickfont': {'size': 14},
2050
  'gridcolor': 'rgba(220, 220, 220, 0.5)',
2051
  'showgrid': True
@@ -2074,10 +2074,10 @@ with tab1:
2074
  st.info("This is the previous analysis result. Adjust parameters and click 'Generate Analysis' to create a new visualization.")
2075
 
2076
  except Exception as e:
2077
- st.info("πŸ‘ˆ Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
2078
  else:
2079
  # Show placeholder
2080
- st.info("πŸ‘ˆ Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
2081
 
2082
  st.markdown('</div>', unsafe_allow_html=True)
2083
 
@@ -2097,7 +2097,7 @@ with tab2:
2097
  help="Parameter a > 1", key="cubic_a")
2098
  cubic_y = st.number_input("Value for y", min_value=0.1, max_value=10.0, value=1.0, step=0.1,
2099
  help="Parameter y > 0", key="cubic_y")
2100
- cubic_beta = st.number_input("Value for Ξ²", min_value=0.0, max_value=1.0, value=0.5, step=0.05,
2101
  help="Value between 0 and 1", key="cubic_beta")
2102
  st.markdown('</div>', unsafe_allow_html=True)
2103
 
@@ -2307,11 +2307,11 @@ with tab2:
2307
  st.plotly_chart(complex_fig, use_container_width=True)
2308
 
2309
  except Exception as e:
2310
- st.info("πŸ‘ˆ Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
2311
  st.error(f"Error loading previous data: {str(e)}")
2312
  else:
2313
  # Show placeholder
2314
- st.info("πŸ‘ˆ Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
2315
 
2316
  st.markdown('</div>', unsafe_allow_html=True)
2317
 
 
17
  # Set page config with wider layout
18
  st.set_page_config(
19
  page_title="Matrix Analysis Dashboard",
20
+ page_icon="Γ°ΒŸΒ“ΒŠ",
21
  layout="wide",
22
  initial_sidebar_state="expanded"
23
  )
 
388
  }
389
 
390
  if (std::abs(delta0) < zero_threshold) {
391
+ // Delta0 Γ’Β‰Βˆ 0: One double root and one simple root
392
  double simple = std::cbrt(-delta1);
393
  double doubleRoot = -simple/2 - shift;
394
  double simpleRoot = simple - shift;
 
716
  << ", theory_tolerance = " << theory_tolerance << std::endl;
717
  std::cout << "Output will be saved to: " << output_file << std::endl;
718
 
719
+ // Ҕ€Ò”€Ò”€ Beta range parameters Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
720
  const int num_beta_points = fineness; // Controlled by fineness parameter
721
  std::vector<double> beta_values(num_beta_points);
722
  for (int i = 0; i < num_beta_points; ++i) {
723
  beta_values[i] = static_cast<double>(i) / (num_beta_points - 1);
724
  }
725
 
726
+ // Ҕ€Ò”€Ò”€ Storage for results Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
727
  std::vector<double> max_eigenvalues(num_beta_points);
728
  std::vector<double> min_eigenvalues(num_beta_points);
729
  std::vector<double> theoretical_max_values(num_beta_points);
730
  std::vector<double> theoretical_min_values(num_beta_points);
731
 
732
  try {
733
+ // Ҕ€Ò”€Ò”€ RandomҀGaussian X and S_n Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
734
  std::random_device rd;
735
  std::mt19937_64 rng{rd()};
736
  std::normal_distribution<double> norm(0.0, 1.0);
 
740
  for(int j = 0; j < n; ++j)
741
  X.at<double>(i,j) = norm(rng);
742
 
743
+ // Ҕ€Ò”€Ò”€ Process each beta value Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
744
  for (int beta_idx = 0; beta_idx < num_beta_points; ++beta_idx) {
745
  double beta = beta_values[beta_idx];
746
 
 
748
  theoretical_max_values[beta_idx] = compute_theoretical_max(a, y, beta, theory_grid_points, theory_tolerance);
749
  theoretical_min_values[beta_idx] = compute_theoretical_min(a, y, beta, theory_grid_points, theory_tolerance);
750
 
751
+ // Ҕ€Ò”€Ò”€ Build T_n matrix Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
752
  int k = static_cast<int>(std::floor(beta * p));
753
  std::vector<double> diags(p, 1.0);
754
  std::fill_n(diags.begin(), k, a);
 
759
  T_n.at<double>(i,i) = diags[i];
760
  }
761
 
762
+ // Ҕ€Ò”€Ò”€ Form B_n = (1/n) * X * T_n * X^T Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
763
  cv::Mat B = (X.t() * T_n * X) / static_cast<double>(n);
764
 
765
+ // Ҕ€Ò”€Ò”€ Compute eigenvalues of B Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
766
  cv::Mat eigVals;
767
  cv::eigen(B, eigVals);
768
  std::vector<double> eigs(n);
 
820
 
821
  try {
822
  if (mode == "eigenvalues") {
823
+ // Ҕ€Ò”€Ò”€ Eigenvalue analysis mode Ҕ€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€Ò”€
824
  if (argc != 10) {
825
  std::cerr << "Error: Incorrect number of arguments for eigenvalues mode." << std::endl;
826
  std::cerr << "Usage: " << argv[0] << " eigenvalues <n> <p> <a> <y> <fineness> <theory_grid_points> <theory_tolerance> <output_file>" << std::endl;
 
857
 
858
  # Compile the C++ code with the right OpenCV libraries
859
  st.sidebar.title("Dashboard Settings")
860
+ need_compile = not os.path.exists(executable) or st.sidebar.button("Γ°ΒŸΒ”Β„ Recompile C++ Code")
861
 
862
  if need_compile:
863
  with st.sidebar:
 
891
 
892
  if success:
893
  compiled = True
894
+ st.success(f"Γ’ΒœΒ… Successfully compiled with: {cmd}")
895
  break
896
 
897
  if not compiled:
898
+ st.error("ҝŒ All compilation attempts failed.")
899
  with st.expander("Compilation Details"):
900
  st.code(compile_output)
901
  st.stop()
 
904
  if platform.system() != "Windows":
905
  os.chmod(executable, 0o755)
906
 
907
+ st.success("Γ’ΒœΒ… C++ code compiled successfully!")
908
 
909
  # Set higher precision for mpmath
910
  mpmath.mp.dps = 100 # 100 digits of precision
 
1042
  progress_callback(i / num_points)
1043
 
1044
  # Coefficients for the cubic equation:
1045
+ # zas³ + [z(a+1)+a(1-y)]s² + [z+(a+1)-y-yβ(a-1)]s + 1 = 0
1046
  coef_a = z * a
1047
  coef_b = z * (a + 1) + a * (1 - y)
1048
  coef_c = z + (a + 1) - y - y * beta * (a - 1)
 
1116
  rows=2,
1117
  cols=1,
1118
  subplot_titles=(
1119
+ f"Imaginary Parts of Roots: a={cubic_a}, y={cubic_y}, β={cubic_beta}",
1120
+ f"Real Parts of Roots: a={cubic_a}, y={cubic_y}, β={cubic_beta}"
1121
  ),
1122
  vertical_spacing=0.15,
1123
  specs=[[{"type": "scatter"}], [{"type": "scatter"}]]
 
1129
  x=z_values,
1130
  y=ims_values1,
1131
  mode='lines',
1132
+ name='Im(s҂)',
1133
  line=dict(color='rgb(239, 85, 59)', width=2.5),
1134
+ hovertemplate='z: %{x:.4f}<br>Im(s҂): %{y:.6f}<extra>Root 1</extra>'
1135
  ),
1136
  row=1, col=1
1137
  )
 
1141
  x=z_values,
1142
  y=ims_values2,
1143
  mode='lines',
1144
+ name='Im(s҂‚)',
1145
  line=dict(color='rgb(0, 129, 201)', width=2.5),
1146
+ hovertemplate='z: %{x:.4f}<br>Im(s҂‚): %{y:.6f}<extra>Root 2</extra>'
1147
  ),
1148
  row=1, col=1
1149
  )
 
1153
  x=z_values,
1154
  y=ims_values3,
1155
  mode='lines',
1156
+ name='Im(s҂ƒ)',
1157
  line=dict(color='rgb(0, 176, 80)', width=2.5),
1158
+ hovertemplate='z: %{x:.4f}<br>Im(s҂ƒ): %{y:.6f}<extra>Root 3</extra>'
1159
  ),
1160
  row=1, col=1
1161
  )
 
1166
  x=z_values,
1167
  y=real_values1,
1168
  mode='lines',
1169
+ name='Re(s҂)',
1170
  line=dict(color='rgb(239, 85, 59)', width=2.5),
1171
+ hovertemplate='z: %{x:.4f}<br>Re(s҂): %{y:.6f}<extra>Root 1</extra>'
1172
  ),
1173
  row=2, col=1
1174
  )
 
1178
  x=z_values,
1179
  y=real_values2,
1180
  mode='lines',
1181
+ name='Re(s҂‚)',
1182
  line=dict(color='rgb(0, 129, 201)', width=2.5),
1183
+ hovertemplate='z: %{x:.4f}<br>Re(s҂‚): %{y:.6f}<extra>Root 2</extra>'
1184
  ),
1185
  row=2, col=1
1186
  )
 
1190
  x=z_values,
1191
  y=real_values3,
1192
  mode='lines',
1193
+ name='Re(s҂ƒ)',
1194
  line=dict(color='rgb(0, 176, 80)', width=2.5),
1195
+ hovertemplate='z: %{x:.4f}<br>Re(s҂ƒ): %{y:.6f}<extra>Root 3</extra>'
1196
  ),
1197
  row=2, col=1
1198
  )
 
1482
  symbol='circle',
1483
  line=dict(width=1, color='black')
1484
  ),
1485
+ text=['s҂', 's҂‚', 's҂ƒ'],
1486
  textposition="top center",
1487
  name='Roots'
1488
  ))
 
1614
  color_theory_min = 'rgb(180, 30, 180)'
1615
 
1616
  # Create tabs for different analyses
1617
+ tab1, tab2 = st.tabs(["Γ°ΒŸΒ“ΒŠ Eigenvalue Analysis (C++)", "Γ°ΒŸΒ“Βˆ Im(s) vs z Analysis (SymPy)"])
1618
 
1619
  # Tab 1: Eigenvalue Analysis (KEEP UNCHANGED from original)
1620
  with tab1:
 
1648
  max_value=500,
1649
  value=100,
1650
  step=10,
1651
+ help="Number of points to calculate along the β axis (0 to 1)",
1652
  key="eig_fineness"
1653
  )
1654
  st.markdown('</div>', unsafe_allow_html=True)
 
1831
  color=color_max,
1832
  line=dict(color='white', width=1)
1833
  ),
1834
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Max</extra>'
1835
  ))
1836
 
1837
  fig.add_trace(go.Scatter(
 
1846
  color=color_min,
1847
  line=dict(color='white', width=1)
1848
  ),
1849
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Min</extra>'
1850
  ))
1851
 
1852
  fig.add_trace(go.Scatter(
 
1861
  color=color_theory_max,
1862
  line=dict(color='white', width=1)
1863
  ),
1864
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Max</extra>'
1865
  ))
1866
 
1867
  fig.add_trace(go.Scatter(
 
1876
  color=color_theory_min,
1877
  line=dict(color='white', width=1)
1878
  ),
1879
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Min</extra>'
1880
  ))
1881
 
1882
  # Configure layout for better appearance
 
1890
  'yanchor': 'top'
1891
  },
1892
  xaxis={
1893
+ 'title': {'text': 'β Parameter', 'font': {'size': 18, 'color': '#424242'}},
1894
  'tickfont': {'size': 14},
1895
  'gridcolor': 'rgba(220, 220, 220, 0.5)',
1896
  'showgrid': True
 
1986
  color=color_max,
1987
  line=dict(color='white', width=1)
1988
  ),
1989
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Max</extra>'
1990
  ))
1991
 
1992
  fig.add_trace(go.Scatter(
 
2001
  color=color_min,
2002
  line=dict(color='white', width=1)
2003
  ),
2004
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Empirical Min</extra>'
2005
  ))
2006
 
2007
  fig.add_trace(go.Scatter(
 
2016
  color=color_theory_max,
2017
  line=dict(color='white', width=1)
2018
  ),
2019
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Max</extra>'
2020
  ))
2021
 
2022
  fig.add_trace(go.Scatter(
 
2031
  color=color_theory_min,
2032
  line=dict(color='white', width=1)
2033
  ),
2034
+ hovertemplate='β: %{x:.3f}<br>Value: %{y:.6f}<extra>Theoretical Min</extra>'
2035
  ))
2036
 
2037
  # Configure layout for better appearance
 
2045
  'yanchor': 'top'
2046
  },
2047
  xaxis={
2048
+ 'title': {'text': 'β Parameter', 'font': {'size': 18, 'color': '#424242'}},
2049
  'tickfont': {'size': 14},
2050
  'gridcolor': 'rgba(220, 220, 220, 0.5)',
2051
  'showgrid': True
 
2074
  st.info("This is the previous analysis result. Adjust parameters and click 'Generate Analysis' to create a new visualization.")
2075
 
2076
  except Exception as e:
2077
+ st.info("Γ°ΒŸΒ‘Βˆ Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
2078
  else:
2079
  # Show placeholder
2080
+ st.info("Γ°ΒŸΒ‘Βˆ Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
2081
 
2082
  st.markdown('</div>', unsafe_allow_html=True)
2083
 
 
2097
  help="Parameter a > 1", key="cubic_a")
2098
  cubic_y = st.number_input("Value for y", min_value=0.1, max_value=10.0, value=1.0, step=0.1,
2099
  help="Parameter y > 0", key="cubic_y")
2100
+ cubic_beta = st.number_input("Value for β", min_value=0.0, max_value=1.0, value=0.5, step=0.05,
2101
  help="Value between 0 and 1", key="cubic_beta")
2102
  st.markdown('</div>', unsafe_allow_html=True)
2103
 
 
2307
  st.plotly_chart(complex_fig, use_container_width=True)
2308
 
2309
  except Exception as e:
2310
+ st.info("Γ°ΒŸΒ‘Βˆ Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
2311
  st.error(f"Error loading previous data: {str(e)}")
2312
  else:
2313
  # Show placeholder
2314
+ st.info("Γ°ΒŸΒ‘Βˆ Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
2315
 
2316
  st.markdown('</div>', unsafe_allow_html=True)
2317