Question: Using PolynomialFit

I am playing around with the PolynomialFit command in maple.
If I want to get a return of 1% then I can simply plug in the return at time t
for v in the expression below. That works for all different returns.

However, this does not add that much value because imagine that you are buying a stock
you dont know before hand what the return is going to be in the next period but you still
want to get 1% return. I guess it is impossible to figure that one out.

Can PolynomialFit be used for any other cool purpose?!


n := 400:
X := Sample(RandomVariable(Normal(0, 1)), n):
Y := Vector(floor((1/2)*n), fill = 1, datatype = float):

sol := PolynomialFit(5, X[1 .. floor((1/2)*n)], Y, v);
data := [seq(eval(sol, v = X[i]), i = 1 .. n)]:

eval(sol, v = X[300]);
eval(sol, v = X[320]);
eval(sol, v = X[330]);
eval(sol, v = X[350]);

display({plot([seq([i, data[i]], i = 1 .. floor((1/2)*n))], color = green, legend = ["Fitted=1%"]), plot([seq([i, data[i]], i = floor((1/2)*n) .. n)], color = red, legend = ["Forcasted"]), plot([floor((1/2)*n), y, y = -5 .. 5], color = black, thickness = 2), LineChart(X, color = blue, legend = ["Random Noise"], markers = false)})

Please Wait...