higher order polynomial expression

I want to implement matlab code for set of 11 polynomials expression and upto 3rd order derivatives. I want to solve this equation with intergration of all 11 set of polynomials. eg. K = intergration with limit 0 to 1 (ai(x) bj(x) dx), where i = 0 and j = 0 to 11
I have created this:
%Some Polynomials defined over the interval[0,1]
i want this as ai(x) and i = 0 means N0 should be selected
N0 = [0 0 0 0 0 0 0 0 0 0 1 -1 0];
N1 = [0 0 0 0 0 0 0 0 0 1 -1 0 0];
N2 = [0 0 0 0 0 0 0 0 1 -1 -1 1 0];
N3 = [0 0 0 0 0 0 0 1 -1 -3 0 3 0];
N4 = [0 0 0 0 0 0 1 -1 -6 6 3 -3 0];
N5 = [0 0 0 0 0 1 -1 -10 10 15 -15 0 0];
N6 = [0 0 0 0 1 -1 -15 15 45 -45 -15 15 0];
N7 = [0 0 0 1 -1 -21 21 105 -105 -105 105 0 0];
N8 = [0 0 1 -1 -28 28 210 -210 -420 420 105 -105 0];
N9 = [1 -10 -36 36 378 -378 -1260 1260 1260 945 -945 0 0];
N10 = [1 -1 -45 45 630 -630 -3150 3150 4725 -4725 -945 945 0];
%1st order
for bj(x) this 1st order should be selected in an integration. and j = 0 to 11 means N01 to N101
N01= polyder (N0)
N11= polyder (N1);
N21= polyder (N2);
N31= polyder (N3);
N41= polyder (N4);
N51= polyder (N5);
N61= polyder (N6);
N71= polyder (N7);
N81= polyder (N8);
N91= polyder (N9);
N101= polyder (N10);
in above first order size of row vector is also changes
please help me with this code.
Thank you in advance!

4 Comments

John D'Errico
John D'Errico on 18 May 2020
Edited: John D'Errico on 18 May 2020
Hint: this is why you don't create numbered variables as you want to do. MATLAB is not a spreadsheet. It does not work well as a spreadsheet, though people seem to love to try exactly that.
Instead, learn to create vectors and arrays. Learn about cell arrays, although in this case, a simple matrix seems like it would be sufficient, since you seem to have a rectangular array of polynomial coefficients.
That you want to compute up to the third derivative of high order polynomials is a dangerous thing, probably leading to numerical garbage as a result. But what can I say there? People do all sorts of things I think strange. Your choice.
One last point - the word is integration, not intergration. A pretty minor point, I'll admit.
I would like in the measure of the possible to have an example of code on the numerical asymptotic method treating the problems of nonlinearity in physics (method based on the assumption of the unknowns like a series of development of Taylor) as similarly treats your code here- above
thank you in advance
thanks
John D'Errico sir, can you give me sample or example of cell array for polynomials? And if i will take derivation of that polynomials, size of row vector is reduced, how to keep it same? Yes it was spelling mistake, but how to take integration of those cell arrays?
I have gone through convolution for polynomials and also read about polyint which supports only two variables, Here I have 11 polynomials.
Please help me with code.
Thanks John D'Errico sir
I have modified my code as this:
N = {[0 0 0 0 0 0 0 0 0 0 1 -1 0], [0 0 0 0 0 0 0 0 0 1 -1 0 0], [0 0 0 0 0 0 0 0 1 -1 -1 1 0], [0 0 0 0 0 0 0 1 -1 -3 0 3 0], [0 0 0 0 0 0 1 -1 -6 6 3 -3 0], [0 0 0 0 0 1 -1 -10 10 15 -15 0 0], [0 0 0 0 1 -1 -15 15 45 -45 -15 15 0], [0 0 0 1 -1 -21 21 105 -105 -105 105 0 0], [0 0 1 -1 -28 28 210 -210 -420 420 105 -105 0], [1 -10 -36 36 378 -378 -1260 1260 1260 945 -945 0 0], [1 -1 -45 45 630 -630 -3150 3150 4725 -4725 -945 945 0]}
for i=1:11
N1(i) = { polyder(N{1,i}) }
end
for j=1:11
N2(j) = { polyder(N1{1,j}) }
end
for k=1:11
N3(k) = { polyder(N2{1,k}) }
end
now problem is, if I derivate N, then N1, N2, N3 does not produce same size of vector, i.e 1x13. How to do that? and also put some more light on integration of all this polynomials.

Sign in to comment.

Answers (0)

Categories

Asked:

on 18 May 2020

Commented:

on 18 May 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!