我想知道是否有人對編寫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
我不知道這兩件事。我從發帖中學到了很多東西。 –