euler314 commited on
Commit
a860d9a
·
verified ·
1 Parent(s): 2690664

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -53
app.py CHANGED
@@ -317,59 +317,59 @@ def find_intersections(z, y, beta, a, s_range, n_guesses, tolerance):
317
  return intersections
318
 
319
  def generate_curves_plot(z, y, beta, a, s_range, n_points, n_guesses, tolerance):
320
- s = np.linspace(s_range[0], s_range[1], n_points)
321
-
322
- # Compute curves
323
- y1 = curve1(s, z, y)
324
- y2 = curve2(s, y, beta, a)
325
-
326
- # Find intersections with improved accuracy
327
- intersections = find_intersections(z, y, beta, a, s_range, n_guesses, tolerance)
328
-
329
- fig = go.Figure()
330
-
331
- fig.add_trace(
332
- go.Scatter(
333
- x=s, y=y1,
334
- mode='lines',
335
- name='z*s² + (z-y+1)*s + 1',
336
- line=dict(color='blue', width=2)
337
- )
338
- )
339
-
340
- fig.add_trace(
341
- go.Scatter(
342
- x=s, y=y2,
343
- mode='lines',
344
- name='y*β*((a-1)*s)/(a*s+1)',
345
- line=dict(color='red', width=2)
346
- )
347
- )
348
-
349
- if len(intersections) > 0:
350
- fig.add_trace(
351
- go.Scatter(
352
- x=intersections,
353
- y=curve1(intersections, z, y),
354
- mode='markers',
355
- name='Intersections',
356
- marker=dict(
357
- size=12,
358
- color='green',
359
- symbol='x',
360
- line=dict(width=2)
361
- )
362
- )
363
- )
364
-
365
- fig.update_layout(
366
- title=f"Curve Intersection Analysis (y={y:.4f}, β={beta:.4f}, a={a:.4f})",
367
- xaxis_title="s",
368
- yaxis_title="Value",
369
- hovermode="closest",
370
- showlegend=True,
371
- legend=dict(
372
- yanchor="top",
373
  y=0.99,
374
  xanchor="left",
375
  x=0.01
 
317
  return intersections
318
 
319
  def generate_curves_plot(z, y, beta, a, s_range, n_points, n_guesses, tolerance):
320
+ s = np.linspace(s_range[0], s_range[1], n_points)
321
+
322
+ # Compute curves
323
+ y1 = curve1(s, z, y)
324
+ y2 = curve2(s, y, beta, a)
325
+
326
+ # Find intersections with improved accuracy
327
+ intersections = find_intersections(z, y, beta, a, s_range, n_guesses, tolerance)
328
+
329
+ fig = go.Figure()
330
+
331
+ fig.add_trace(
332
+ go.Scatter(
333
+ x=s, y=y1,
334
+ mode='lines',
335
+ name='z*s² + (z-y+1)*s + 1',
336
+ line=dict(color='blue', width=2)
337
+ )
338
+ )
339
+
340
+ fig.add_trace(
341
+ go.Scatter(
342
+ x=s, y=y2,
343
+ mode='lines',
344
+ name='y*β*((a-1)*s)/(a*s+1)',
345
+ line=dict(color='red', width=2)
346
+ )
347
+ )
348
+
349
+ if len(intersections) > 0:
350
+ fig.add_trace(
351
+ go.Scatter(
352
+ x=intersections,
353
+ y=curve1(intersections, z, y),
354
+ mode='markers',
355
+ name='Intersections',
356
+ marker=dict(
357
+ size=12,
358
+ color='green',
359
+ symbol='x',
360
+ line=dict(width=2)
361
+ )
362
+ )
363
+ )
364
+
365
+ fig.update_layout(
366
+ title=f"Curve Intersection Analysis (y={y:.4f}, β={beta:.4f}, a={a:.4f})",
367
+ xaxis_title="s",
368
+ yaxis_title="Value",
369
+ hovermode="closest",
370
+ showlegend=True,
371
+ legend=dict(
372
+ yanchor="top",
373
  y=0.99,
374
  xanchor="left",
375
  x=0.01