Trabb Pardo–Knuth algorithm: Difference between revisions

m
(Add MATLAB implementation)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 1,594:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
print "Please enter 11 numbers :"
n[] = number strsplit input " "
print ""
print "Evaluating f(x) = |x|^0.5 + 5x^3 for the given inputs :"
for i = len n[] downto 1
r = sqrt abs n[i] + 5 * pow n[i] 3
write "f(" & n[i] & ") = "
if r > 400
print "Overflow!"
else
print r
.
.
# without this section, the input is interactive
input_data
10 -1 1 2 3 4 4.3 4.31 4.32 4.32 4.29
</syntaxhighlight>
 
=={{header|EchoLisp}}==
Line 4,351 ⟶ 4,371:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdin, Stdout
import "./fmt" for Fmt
 
var f = Fn.new { |x| x.abs.sqrt + 5*x*x*x }
9,482

edits