Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,6 +58,12 @@ st.markdown("""
|
|
| 58 |
background-color: #1E88E5 !important;
|
| 59 |
color: white !important;
|
| 60 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
</style>
|
| 62 |
""", unsafe_allow_html=True)
|
| 63 |
|
|
@@ -199,7 +205,7 @@ with tab1:
|
|
| 199 |
if os.path.exists(data_file):
|
| 200 |
os.remove(data_file)
|
| 201 |
|
| 202 |
-
# Execute the C++ program
|
| 203 |
cmd = [
|
| 204 |
executable,
|
| 205 |
"eigenvalues",
|
|
@@ -525,7 +531,7 @@ with tab1:
|
|
| 525 |
st.info("This is the previous analysis result. Adjust parameters and click 'Generate Analysis' to create a new visualization.")
|
| 526 |
|
| 527 |
except Exception as e:
|
| 528 |
-
st.info("👈 Set parameters and click 'Generate Analysis' to create a visualization.")
|
| 529 |
else:
|
| 530 |
# Show placeholder
|
| 531 |
st.info("👈 Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
|
|
@@ -561,19 +567,11 @@ with tab2:
|
|
| 561 |
key="cubic_points"
|
| 562 |
)
|
| 563 |
|
| 564 |
-
cubic_range = st.slider(
|
| 565 |
-
"z range",
|
| 566 |
-
min_value=0.1,
|
| 567 |
-
max_value=20.0,
|
| 568 |
-
value=(0.01, 10.0),
|
| 569 |
-
step=0.1,
|
| 570 |
-
help="Range of z values to calculate",
|
| 571 |
-
key="cubic_range"
|
| 572 |
-
)
|
| 573 |
-
|
| 574 |
# Show cubic equation
|
|
|
|
| 575 |
st.markdown("### Cubic Equation")
|
| 576 |
st.latex(r"zas^3 + [z(a+1)+a(1-y)]\,s^2 + [z+(a+1)-y-y\beta (a-1)]\,s + 1 = 0")
|
|
|
|
| 577 |
|
| 578 |
# Generate button
|
| 579 |
cubic_generate_button = st.button("Generate Im(s) vs z Analysis",
|
|
@@ -607,7 +605,7 @@ with tab2:
|
|
| 607 |
if os.path.exists(data_file):
|
| 608 |
os.remove(data_file)
|
| 609 |
|
| 610 |
-
# Execute the C++ program
|
| 611 |
cmd = [
|
| 612 |
executable,
|
| 613 |
"cubic",
|
|
@@ -683,13 +681,12 @@ with tab2:
|
|
| 683 |
'yanchor': 'top'
|
| 684 |
},
|
| 685 |
xaxis={
|
| 686 |
-
'title': 'z',
|
| 687 |
'titlefont': {'size': 18, 'color': '#424242'},
|
| 688 |
'tickfont': {'size': 14},
|
| 689 |
'gridcolor': 'rgba(220, 220, 220, 0.5)',
|
| 690 |
'showgrid': True,
|
| 691 |
-
'type': 'log'
|
| 692 |
-
'title': 'z (logarithmic scale)'
|
| 693 |
},
|
| 694 |
yaxis={
|
| 695 |
'title': 'Im(s)',
|
|
@@ -855,4 +852,23 @@ with tab2:
|
|
| 855 |
# Show placeholder
|
| 856 |
st.info("👈 Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
|
| 857 |
|
| 858 |
-
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
background-color: #1E88E5 !important;
|
| 59 |
color: white !important;
|
| 60 |
}
|
| 61 |
+
.math-box {
|
| 62 |
+
background-color: #f8f9fa;
|
| 63 |
+
border-left: 3px solid #1E88E5;
|
| 64 |
+
padding: 10px;
|
| 65 |
+
margin: 10px 0;
|
| 66 |
+
}
|
| 67 |
</style>
|
| 68 |
""", unsafe_allow_html=True)
|
| 69 |
|
|
|
|
| 205 |
if os.path.exists(data_file):
|
| 206 |
os.remove(data_file)
|
| 207 |
|
| 208 |
+
# Execute the C++ program - FIXED ARGUMENTS ORDER
|
| 209 |
cmd = [
|
| 210 |
executable,
|
| 211 |
"eigenvalues",
|
|
|
|
| 531 |
st.info("This is the previous analysis result. Adjust parameters and click 'Generate Analysis' to create a new visualization.")
|
| 532 |
|
| 533 |
except Exception as e:
|
| 534 |
+
st.info("👈 Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
|
| 535 |
else:
|
| 536 |
# Show placeholder
|
| 537 |
st.info("👈 Set parameters and click 'Generate Eigenvalue Analysis' to create a visualization.")
|
|
|
|
| 567 |
key="cubic_points"
|
| 568 |
)
|
| 569 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 570 |
# Show cubic equation
|
| 571 |
+
st.markdown('<div class="math-box">', unsafe_allow_html=True)
|
| 572 |
st.markdown("### Cubic Equation")
|
| 573 |
st.latex(r"zas^3 + [z(a+1)+a(1-y)]\,s^2 + [z+(a+1)-y-y\beta (a-1)]\,s + 1 = 0")
|
| 574 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 575 |
|
| 576 |
# Generate button
|
| 577 |
cubic_generate_button = st.button("Generate Im(s) vs z Analysis",
|
|
|
|
| 605 |
if os.path.exists(data_file):
|
| 606 |
os.remove(data_file)
|
| 607 |
|
| 608 |
+
# Execute the C++ program - FIXED ARGUMENTS ORDER
|
| 609 |
cmd = [
|
| 610 |
executable,
|
| 611 |
"cubic",
|
|
|
|
| 681 |
'yanchor': 'top'
|
| 682 |
},
|
| 683 |
xaxis={
|
| 684 |
+
'title': 'z (logarithmic scale)',
|
| 685 |
'titlefont': {'size': 18, 'color': '#424242'},
|
| 686 |
'tickfont': {'size': 14},
|
| 687 |
'gridcolor': 'rgba(220, 220, 220, 0.5)',
|
| 688 |
'showgrid': True,
|
| 689 |
+
'type': 'log' # Use logarithmic scale for better visualization
|
|
|
|
| 690 |
},
|
| 691 |
yaxis={
|
| 692 |
'title': 'Im(s)',
|
|
|
|
| 852 |
# Show placeholder
|
| 853 |
st.info("👈 Set parameters and click 'Generate Im(s) vs z Analysis' to create a visualization.")
|
| 854 |
|
| 855 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 856 |
+
|
| 857 |
+
# Add footer with information
|
| 858 |
+
with st.expander("About this Application"):
|
| 859 |
+
st.markdown("""
|
| 860 |
+
## Matrix Analysis Dashboard
|
| 861 |
+
|
| 862 |
+
This application provides tools for analyzing matrix properties and related cubic equations:
|
| 863 |
+
|
| 864 |
+
### Tab 1: Eigenvalue Analysis
|
| 865 |
+
Visualizes the relationship between empirical and theoretical eigenvalues of matrices as a function of β.
|
| 866 |
+
|
| 867 |
+
### Tab 2: Im(s) vs z Analysis
|
| 868 |
+
Explores the imaginary parts of the roots of the cubic equation:
|
| 869 |
+
```
|
| 870 |
+
zas³ + [z(a+1)+a(1-y)]s² + [z+(a+1)-y-yβ(a-1)]s + 1 = 0
|
| 871 |
+
```
|
| 872 |
+
|
| 873 |
+
The application uses C++ for high-performance numerical calculations and Python with Streamlit and Plotly for the interactive user interface and visualizations.
|
| 874 |
+
""")
|