solve waldtest() problem
add 1-(2), still need to modify. No newton method