Skip to content

Fix simulate init value for unfailed components#161

Open
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix/simulate-init-value
Open

Fix simulate init value for unfailed components#161
Chessing234 wants to merge 1 commit intomitmath:Fall24from
Chessing234:fix/simulate-init-value

Conversation

@Chessing234
Copy link
Copy Markdown

Summary

  • Fix the simulate function in simulating_component_failure.jl to initialize the failure-time array with max_steps instead of 0
  • Components that never fail (small p) now correctly report max_steps as their failure time instead of 0
  • Add max_steps parameter (default 100) to replace the hardcoded value, and update all loop conditions to compare against max_steps

Fixes #154

Test plan

  • Run the notebook with small p values (e.g. p = 0.001) and verify unfailed components show max_steps (100) instead of 0
  • Run with p = 1.0 and verify all components still fail at time 1
  • Verify default behavior is unchanged for typical p values

🤖 Generated with Claude Code

…onents

Components that never fail (small p) were recorded as failing at time 0
instead of never failing. Initialize the failure-time array with max_steps
and check against max_steps in the loop, so unfailed components correctly
report max_steps as their failure time.

Fixes mitmath#154

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

An error in the function simulate in simulating_component_failure.jl

1 participant