Probably a No-Brainer
hh
hh at hyperhh.de
Thu Dec 27 14:02:43 EST 2018
You don't want to compute it but want to write it out into a field?
on mouseUp
put taylorsum(4,"x") into fld "OUT"
end mouseUp
function taylorsum n,x -- n is the degree, x the function argument
put "1" into s -- or: put x &"^0/0!" into s
repeat with i=1 to n
put " + " & x &"^"& i &"/"& i &"!" after s
end repeat
return char 1 to -1 of s
end taylorsum
taylorsum(4,"x") yields --> 1 + x^1/1! + x^2/2! + x^3/3! + x^4/4!
taylorsum(4,"2") yields --> 1 + 2^1/1! + 2^2/2! + 2^3/3! + 2^4/4!
More information about the use-livecode
mailing list