Linear least squares

Please choose your input form:
A system of
your own

Please specify the number of rows : 1<=N<=1000!

N=

Please specify the number of columns: 1<=n<=N!

n=

Please write down the coefficients of your system here: rowwise, with the right hand side appended, the numbers separated by blank or comma.
Each row must begin on a new line, but may extend over several lines. Don't write beyond the visible area.

A,b =

Predefined
models

Please choose a model:

Polynomial with monomial basis Should [a,b] be transformed to [-1,1]?
yes
no


p1 * 1 + p2 * x + p3 * x2 + p4 * x3 + p5 * x4 + p6 * x5

Polynomial with Legendre basis p1 * L0(x) + p2 * L1(x) + p3 * L2(x) + p4 * L3(x) + p5 * L4(x) + p6 * L5(x)
Trigonometric polynomial p1 * 1 + p2 * sin[c1 π x] + p3 * cos[c2 π x] + p4 * sin[c3 π x] + p5 * cos[c4π x]
exponential sum p1 * 1 + p2 exp(c1x) + p3 exp(c2x) + p4 exp(c3 x) + p5 exp(c4 x)

Please specify the ''true'' coefficients p1 to p5 resp. p1 to p6.
Important:
you give simply a list of the coefficients, for example
1,2,3,0,1,1   for 1 * 1 + 2 * x + 3 * x2 + 0 * x3 + 1 * x4 + 1* x5
coefficients =

For the cases of model 3 or 4 specify the coeffcients ci, i=1,2,3,4 here. These are fixed in the computation!
c =

Specify the interval for the free variable x [a,b]:
a = b =

Specify the number N of data points:

N = 100
N = 500
Own value: N = Important: N <= 1000

Please specify the level for error generation. 0.01 means one percent of the largest y-value:
errlev =
Important: 0 <= errlev <= 1 !

A model of your own

Please specify the number of rows : 1<=N<=1000!

N=

Please specify the number of columns: 1<=n<=N!

n=

Please type the code for the evaluation of a row of A (the n ''Ansatz'' functions) in the following textarea. Remember the correct line formatting: first 6 columns blank or 5 blanks and an alphanumeric character in column 6 (for a continuation line) or a numeric label in columns 1 to 5 with blank in column 6! Evaluation instructions in columns 7 to 72. Use the visible area only.
Important: the result must be row(1),...,row(n). Input variables are n and x.
Variable names to be used are x(j), j=1,...,n.
You can make use of local variables h1,h2,h3,h4, a vector v with 100 components, the constants pi , e1(=exp(1)) and sqrt2(=sqrt(2)).
You also can use the integers i,j,k (for example for loops) and the logicals bool1,bool2,bool3. These local variables are all initialized with zero resp. .false. Values you assign to them are saved for the next row evaluation, hence you might use these to simplify your code. You are not allowed to define any variables yourself.
data generation

please specify the data interval here:
a = b =

Please specify the 'true' coefficients here from which the data will be generated using your model

Please specify the level of error generation here in the interval [0,1]:
errlev =

your own discrete data

Please write here the list of your (x,y)-data. m pairs of numbers, separated by comma or blank or new line. You may put several pairs on one line in order to save space.

Click on "evaluate", in order to submit your input.

back to the theory page

 Back to the top!

10.10.2013