euler314 commited on
Commit
ba9a480
·
verified ·
1 Parent(s): b278b60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -47
app.py CHANGED
@@ -365,36 +365,36 @@ st.title("Cubic Root Analysis")
365
  tab1, tab2, tab3 = st.tabs(["z*(β) Curves", "Im{s} vs. z", "Curve Intersections"])
366
 
367
  with tab1:
368
- st.header("Find z Values where Cubic Roots Transition Between Real and Complex")
369
-
370
- col1, col2 = st.columns([1, 2])
371
-
372
- with col1:
373
- z_a_1 = st.number_input("z_a", value=1.0, key="z_a_1")
374
- y_1 = st.number_input("y", value=1.0, key="y_1")
375
- z_min_1 = st.number_input("z_min", value=-10.0, key="z_min_1")
376
- z_max_1 = st.number_input("z_max", value=10.0, key="z_max_1")
377
 
378
- if st.button("Compute z vs. β Curves"):
379
- with col2:
380
- fig = generate_z_vs_beta_plot(z_a_1, y_1, z_min_1, z_max_1)
381
- if fig is not None:
382
- st.plotly_chart(fig, use_container_width=True)
383
-
384
- st.markdown("### Additional Expressions")
385
- st.markdown("""
386
- **Low y Expression (Red):**
387
- ```
388
- ((y - 2)*(-1 + sqrt(y*β*(a-1)))/a + y*β*((a-1)/a) - 1/a - 1) /
389
- ((-1 + sqrt(y*β*(a-1)))/a)^2 + (-1 + sqrt(y*β*(a-1)))/a)
390
- ```
391
-
392
- **High y Expression (Green):**
393
- ```
394
- ((4y + 12)(4 - a) + 16y*β*(a - 1))/(3(4 - a))
395
- ```
396
- where a = z_a
397
- """)
398
 
399
  with tab2:
400
  st.header("Plot Imaginary Parts of Roots vs. z")
@@ -408,11 +408,11 @@ with tab2:
408
  z_min_2 = st.number_input("z_min", value=-10.0, key="z_min_2")
409
  z_max_2 = st.number_input("z_max", value=10.0, key="z_max_2")
410
 
411
- if st.button("Compute Im{s} vs. z"):
412
- with col2:
413
- fig = generate_ims_vs_z_plot(beta, y_2, z_a_2, z_min_2, z_max_2)
414
- if fig is not None:
415
- st.plotly_chart(fig, use_container_width=True)
416
 
417
  with tab3:
418
  st.header("Curve Intersection Analysis")
@@ -430,16 +430,16 @@ with tab3:
430
  s_min = st.number_input("s_min", value=-5.0)
431
  s_max = st.number_input("s_max", value=5.0)
432
 
433
- if st.button("Compute Intersections"):
434
- with col2:
435
- s_range = (s_min, s_max)
436
- fig, intersections = generate_curves_plot(z, y_3, beta_3, a, s_range)
437
- st.plotly_chart(fig, use_container_width=True)
438
-
439
- if len(intersections) > 0:
440
- st.subheader("Intersection Points")
441
- for i, s_val in enumerate(intersections):
442
- y_val = curve1(s_val, z, y_3)
443
- st.write(f"Point {i+1}: s = {s_val:.6f}, y = {y_val:.6f}")
444
- else:
445
- st.write("No intersections found in the given range.")
 
365
  tab1, tab2, tab3 = st.tabs(["z*(β) Curves", "Im{s} vs. z", "Curve Intersections"])
366
 
367
  with tab1:
368
+ st.header("Find z Values where Cubic Roots Transition Between Real and Complex")
369
+
370
+ col1, col2 = st.columns([1, 2])
371
+
372
+ with col1:
373
+ z_a_1 = st.number_input("z_a", value=1.0, key="z_a_1")
374
+ y_1 = st.number_input("y", value=1.0, key="y_1")
375
+ z_min_1 = st.number_input("z_min", value=-10.0, key="z_min_1")
376
+ z_max_1 = st.number_input("z_max", value=10.0, key="z_max_1")
377
 
378
+ if st.button("Compute z vs. β Curves"):
379
+ with col2:
380
+ fig = generate_z_vs_beta_plot(z_a_1, y_1, z_min_1, z_max_1)
381
+ if fig is not None:
382
+ st.plotly_chart(fig, use_container_width=True)
383
+
384
+ st.markdown("### Additional Expressions")
385
+ st.markdown("""
386
+ **Low y Expression (Red):**
387
+ ```
388
+ ((y - 2)*(-1 + sqrt(y*β*(a-1)))/a + y*β*((a-1)/a) - 1/a - 1) /
389
+ ((-1 + sqrt(y*β*(a-1)))/a)^2 + (-1 + sqrt(y*β*(a-1)))/a)
390
+ ```
391
+
392
+ **High y Expression (Green):**
393
+ ```
394
+ ((4y + 12)(4 - a) + 16y*β*(a - 1))/(3(4 - a))
395
+ ```
396
+ where a = z_a
397
+ """)
398
 
399
  with tab2:
400
  st.header("Plot Imaginary Parts of Roots vs. z")
 
408
  z_min_2 = st.number_input("z_min", value=-10.0, key="z_min_2")
409
  z_max_2 = st.number_input("z_max", value=10.0, key="z_max_2")
410
 
411
+ if st.button("Compute Im{s} vs. z"):
412
+ with col2:
413
+ fig = generate_ims_vs_z_plot(beta, y_2, z_a_2, z_min_2, z_max_2)
414
+ if fig is not None:
415
+ st.plotly_chart(fig, use_container_width=True)
416
 
417
  with tab3:
418
  st.header("Curve Intersection Analysis")
 
430
  s_min = st.number_input("s_min", value=-5.0)
431
  s_max = st.number_input("s_max", value=5.0)
432
 
433
+ if st.button("Compute Intersections"):
434
+ with col2:
435
+ s_range = (s_min, s_max)
436
+ fig, intersections = generate_curves_plot(z, y_3, beta_3, a, s_range)
437
+ st.plotly_chart(fig, use_container_width=True)
438
+
439
+ if len(intersections) > 0:
440
+ st.subheader("Intersection Points")
441
+ for i, s_val in enumerate(intersections):
442
+ y_val = curve1(s_val, z, y_3)
443
+ st.write(f"Point {i+1}: s = {s_val:.6f}, y = {y_val:.6f}")
444
+ else:
445
+ st.write("No intersections found in the given range.")