wolfram mathematica - How to fix the procedure -
help me, please! there's procedure operation[f_]
. works correctly , plot functions:cos,sin. but, unfortunately, doesn't work e^x , log[e,x] , outputs errors, maybe because inputting not correct name of function or else;(( what's problem?
spxsin = {-1, -0.35, 0.3, 0.95, 1.6, 2.375, 3.15, 3.925, 4.7, 5.025, 5.35, 5.675, 6}; spxcos = {-1, -0.75, -0.5, -0.25, 0, 0.775, 1.55, 2.325, 3.1, 3.825, 4.55, 5.275, 6}; spxlny = {-1, 0.75, 2.5, 4.25, 6}; spxey = {-1, 0.75, 2.5, 4.25, 6}; operation[f_] := block[{data}, data = table[{x, f[x]}, {x, -1, 6, 0.1}]; graphics[{thick, blue, line[data], green, table[point[{spx[[i]], f[spx[[i]]]}], {i, 1, length[spx]}], pink, opacity[.7], table[rectangle[{spx[[i]], f[spx[[i]]]}, {spx[[i + 1]], f[spx[[i + 1]]]}], {i, 1, length[spx] - 1}] }, axes -> true]] which[ f == sin, spx := spxsin, f == cos, spx := spxcos, f == e^x , spx := spxlny, f == log, spx := spxey] operation[sin] operation[cos] operation[e^x] operation[log]
euler's e needs entered esc ee esc. looks me @ entered standard e.
note exp exponential function in mathematica.
Comments
Post a Comment