خرید بک لینک

Vote count: 0

I'm not much familiar with this programming language and I just need to run one function to compute some coeficients.

f[x] = x^2 - 2 x + 2
g[x] = x^3 - 2 x^2 - 2 x - 2
f1 = Root[f[x], 1];
f2 = Root[f[x], 2];
g1 = Root[g[x], 1];
g2 = Root[g[x], 2];
g3 = Root[g[x], 3];

foo[rootList, alpha, beta] :=
(
    res = {};
    For[i = 1, i <= Length[rootList], i++, alphaI = rootList[[i]];
        For[j = 1, j <= Length[rootList], j++, betaJ = rootList[[j]];
            If[betaJ != beta,
            (
                kor = Simplify [(alphaI - alpha) / (beta - betaJ)];
                res = Append[res, N[kor, 5]];
            ),
            ]
        ]
    ]
    Return[res];
)
roots = [f1, f2, g1, g2, g3];
cs = foo[roots, f1, g1]

this piece of code gives me this error:

Syntax::tsntxi: "For[i=1,i<=Length[rootList],i++,alphaI=rootList[[i]];" is incomplete; more input is needed.

And don't see what is wrong. I'm using mathematica 10.4

asked 43 secs ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 18 ارديبهشت 1396 ساعت: 17:33

صفحه بندی