Skip to content

Phase 7: Enhanced Plotter#108

Closed
4awmy wants to merge 8 commits into
mainfrom
phase-7-enhanced-plotter
Closed

Phase 7: Enhanced Plotter#108
4awmy wants to merge 8 commits into
mainfrom
phase-7-enhanced-plotter

Conversation

@4awmy
Copy link
Copy Markdown
Owner

@4awmy 4awmy commented May 3, 2026

Sophisticated plotting support for all chapters, pure black background integration, and result highlighting.

4awmy and others added 8 commits April 30, 2026 11:10
Comprehensive updates across all solvers and GUI pages:

**Engine Improvements:**
- Enhanced root finder with improved iteration tracking
- Extended calculus engine with all numerical integration methods
- Improved network solver with better convergence handling
- Better step-by-step data collection for all solvers

**GUI Enhancements:**
- Ch 2 (Linear Systems): Dynamic n×n matrix grid input, load example problems, iteration table display
- Ch 1 (Root Finding): Load example problems dropdown, iteration table in right panel, fixed input field layout
- Ch 3 (Numerical Calculus): Enhanced layout and visualization
- All pages: Iteration tables showing step-by-step solver progress

**User Experience:**
- Load example buttons allow quick testing with predefined problems from numerical_methods_problems.md
- Iteration tables display convergence progress (iteration #, values, errors)
- Better input validation and error handling
- Improved result display panels

This enables users to:
✅ Solve all problems from numerical methods problem sheet
✅ Use matrix grid for easy linear system entry
✅ View detailed iteration history
✅ Load pre-configured examples for testing

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@4awmy 4awmy self-assigned this May 3, 2026
@4awmy
Copy link
Copy Markdown
Owner Author

4awmy commented May 3, 2026

Self-review: PlotManager updated with bar and shaded area plots. Highlights target points. @copilot review requested.

@4awmy
Copy link
Copy Markdown
Owner Author

4awmy commented May 3, 2026

Review: Phase 7 — Enhanced Plotter

@gemini please fix the following issues on branch phase-7-enhanced-plotter:


BUG 1 — plot_solution_path crashes on NaN/complex intermediate guesses

File: numcore_gui/visualization.py, line ~175

path_y = [f(x) for x in guesses] evaluates f(x) at every intermediate Newton/Secant guess. If any step produced a near-infinity or complex intermediate, this line will crash without user feedback. Wrap in try/except:

try:
    path_y = [f(x) for x in guesses]
except Exception:
    # Fallback: only show final point if path cannot be computed
    path_y = [f(guesses[-1])]
    guesses = [guesses[-1]]

BUG 2 — export_plot has no directory-creation safety

File: numcore_gui/visualization.py, line ~322

self.figure.savefig(filename) will raise FileNotFoundError if the target directory doesn't exist. Fix:

def export_plot(self, filename: str):
    os.makedirs(os.path.dirname(os.path.abspath(filename)), exist_ok=True)
    self.figure.savefig(filename, facecolor=self.figure.get_facecolor())

Also pass facecolor to preserve the black background in the exported file.


MISSING — Bisection-specific bracket visualization not implemented

Per the spec (T048), there should be a plot_bisection_brackets() method that overlays narrowing bracket markers on the function curve per iteration. The current plot_solution_path is generic. Add a dedicated method:

def plot_bisection_brackets(self, steps: List[NumericalStep], f_str: str):
    """Plot function curve with narrowing bracket markers per bisection iteration."""
    ...

Implement it to draw vertical dashed lines for a and b at each step, color-coded from light to dark to show convergence.


MINOR — _style_toolbar uses bare except

File: numcore_gui/visualization.py, line ~62

except:
    pass

Replace with except Exception: pass to avoid silently swallowing SystemExit or KeyboardInterrupt.


CLEANUP — Remove artifact files

Remove gemini_*.log, issue*.md, ISSUES.md from the commit.

@4awmy
Copy link
Copy Markdown
Owner Author

4awmy commented May 3, 2026

Fixed: plot_solution_path handles NaN. export_plot creates directories. Added plot_bisection_brackets. @claude please review.

@4awmy
Copy link
Copy Markdown
Owner Author

4awmy commented May 3, 2026

Closing — all changes from this phase are included in the squash-merge of PR #111 (phase-11-final-polish) into main. All review fixes have been applied and verified.

@4awmy 4awmy closed this May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant