[求助]最大值求法
<p>sin(t0)总共有10个值,请叫高手在下述模式下怎么求出bb的最大值:</p><p>(defun c:test00()<br/>(setq t0 1)<br/> (repeat 10<br/> (setq bb (sin t0))<br/> (setq t0 (+ t0 1))<br/>)***********后面的请高手续写,谢谢!<br/></p> 本帖最后由 作者 于 2008-10-18 15:56:14 编辑(defun c:test00(/ t0 bb)
(setq t0 1)
(repeat 10
(setq bb (max bb (sin t0)))
(setq t0 (+ t0 1)))
bb
)
<font color="#ff0000">请教楼上的这句:(</font><a href="http://www.mjtd.com/object/autolisp/setq.htm" target="_black"><font color="#0000ff">setq</font></a> bb <font color="#ff0000">(</font><a href="http://www.mjtd.com/object/autolisp/max.htm" target="_black"><font color="#0000ff">max</font></a> bb <font color="#ff0000">(</font><a href="http://www.mjtd.com/object/autolisp/sin.htm" target="_black"><font color="#0000ff">sin</font></a> t0<font color="#ff0000">)</font><font color="#ff0000">)</font><font color="#ff0000">)做什么解释,好象不在max函数的使用规则内</font> 本帖最后由 作者 于 2008-10-19 0:53:47 编辑
是我搞错了。用这个(defun c:test00 (/ t0 aa bb)
(setq t0 1)
(repeat 10
(setq bb (sin t0))
(if (< aa bb)(setq aa bb))
(setq t0 (+ t0 1))
)
aa
)
<p>验算了下,这个改过的很好谢谢狂刀.</p> <p>请教下狂刀:</p><p>怎么求出aa为最大值时,t0的值.谢谢!</p>
页:
[1]