今天我弄榕坚推荐的软件中的这一范例,整出的图怪怪的,大家帮忙想想办法。原软件中的程序英文,由于我底子差,有些地方可猜出一二,有些地方不懂,如读天书。榕老师、梅老师英文棒。我把此摆在这公众出入多的地方:
原程序如下:
N_sin_M {
; newton's method applied to f(z) = sin(z) - c
; Q(z) = z - f(z)/f'(z) = z - ((sin(z)-c)/cos(z))
global:
init:
z = 0
complex delta_z = 0
complex c = #pixel
bool continue = true
loop:
delta_z = ( sin(z) - c ) / cos(z)
if |delta_z| < @delta
continue = false
if @zmode=="step"
z = delta_z
endif ; zmode
else
z = z - delta_z
endif ; < @delta
bailout:
; -- this isn't the bailout but the continuing condition
; false = bail; true = continue
continue
default:
title = "Newton-M, sin(z)-c" ; [v1.0]
magn = 0.25
periodicity = 0
heading
caption = "Bailout"
endheading
float param delta
caption="Bailout delta"
hint="Square of max step. Use small values."
default=1e-8
min=0
endparam
param zmode
caption = "final z"
enum = "z" "step"
default = 1
endparam
switch:
type = "N_sin_J"
cv = #pixel
delta = delta
zmode = zmode
} |