在tcl(opensees)中执行以下代码时,它显示“杀死儿童的分段违规”,并且程序停止工作。
set Ntrials 10000
set Nfails 0
for {set i 1} {$i <= $Ntrials} {incr i} {
set U '';#initialize list to Null
foreach rv [getRVTags] {
set val [expr rand()]; #random float between 0 and 1
lappend U [getStdNormalInverseCDF $val]
}
set X [transformUtoX $U]
set irv 0
foreach rv "1 2" {
updateParameter $rv[lindex $X $irv]
incr irv
}
set x1 [getParamValue 1]
set X2 [getParamValue 2]
set g [expr $x1*$x1-$x2*$x2];#g=R^2-S^2
if { $g <= 0 } {
incr Nfail
}
}
puts "Monte Carlo Simulation, pf = [expr double($Nfail)/$Ntrials]";