Thanks for reminding, my SAS sofeware actually have a little problems when installing, FROOT function is not available in my computer, but the bisection method is OK. Then I change the statement as below: proc iml; start func(x); f1 = pdf("Normal", x, 12.7, 6.7); /* density of N(12.7,6.7), where 6.7 is std dev in your example*/ f2 = pdf("Normal", x, 37.3, 3); return( f1 - f2 ); finish; start bisection(a, b); dx = 1e-6; dy = 1e-4; do i = 1 to 100; c = (a+b)/2; if abs(func(c)) < dy | (b-a)/2 < dx then return(c); if func(a)#func(c) > 0 then a = c; else b = c; end; return (.); finish; z = bisection(27, 37); print z; Then the SAS procedure determines the solution is "Z=29.03". Is the statement mentioned above right or wrong? By the way, you said that the function f(x) - f1(x)-f2(x) is zero at the crossing point,but why return(f1-f2) in the func(x), is that meaning f1(x)-f2(x)=0??? Looking forward your friendly answer! Many thanks and best regards!
... View more