我想知道是否有人对编写mandelbrot流有任何建议。我写了以下函数来帮助我:Mandelbrot在计划中设置
(define (make-complex a b) (cons a b))
(define (real-coeff c) (car c))
(define (imag-coeff c) (cdr c))
(define (c-add c d)
(make-complex (+ (real-coeff c) (real-coeff d))
(+ (imag-coeff c) (imag-coeff d))))
(define (c-mult c d)
(make-complex (- (* (real-coeff c) (real-coeff d))
(* (imag-coeff c) (imag-coeff d)))
(+ (* (real-coeff c) (imag-coeff d))
(* (imag-coeff c) (real-coeff d)))))
(define (c-length c)
(define (square x) (* x x))
(sqrt (+ (square (real-coeff c))
(square (imag-coeff c)))))
我有那个fz(x)= x2 + z。该流应返回:a,fz(a),fz(fz(a)),fz(fz(fz(a)))。我很困惑如何使用我编写的函数来创建具有此输出的流。任何人有什么好的建议,以何去何从?
您是否知道Scheme对复杂数字有内置支持? – uselpa
您是否知道Scheme对流有第三方库支持? – GoZoner
我不知道这两件事。我从发帖中学到了很多东西。 –