Method of Least Squares question

In summary, the best least squares approximation for function x^(1/3) on [-1,1] by a quadratic function q(x) = c0 + c1x + c2x^2 is found to be p(x) = c1\hat{u1} + c2\hat{u2} + c3\hat{u3}.
  • #1
clope023
992
131

Homework Statement



for vector space C[-1,1] with L^2 inner product

<f,g> = [tex]\int[/tex]f(x)g(x)dx

find the best least squares approximation for function x^(1/3) on [-1,1] by a quadratic function q(x) = c0 + c1x + c2x^2


Homework Equations



s+r = n

<t^s, t^r> = [tex]\int[/tex]t^ndt = { 2/(n+1) if n is even
0 if n is odd }

The Attempt at a Solution



q(x) = c0*1 + c1*x + c2*x^2

take inner product of functions of q(x)

||1|| = sqrt(2)
||x|| = sqrt(2/3)
||x^2|| = sqrt(2/5)

normalize vectors in the basis

[tex]\hat{u1}[/tex] = 1/sqrt(2)
[tex]\hat{u2}[/tex] = x/sqrt(2/3)
[tex]\hat{u3}[/tex] = x^2/sqrt(2/5)

find coefficients by taking integrals of unit vectors with function x^1/3

c1 = (1/sqrt(2))[tex]\int[/tex]x^1/3dx = [tex]\stackrel{3}{4sqrt(2)}[/tex]

c2 = (1/sqrt(2/3))[tex]\int[/tex]x^4/3dx = [tex]\stackrel{3}{7sqrt(2/3)}[/tex]

c3 = (1/sqrt(2/5))[tex]\int[/tex]x^7/3dx = [tex]\stackrel{3}{10sqrt(2/5)}[/tex]

therefore p(x) = c1[tex]\hat{u1}[/tex] + c2[tex]\hat{u2}[/tex] + c3[tex]\hat{u3}[/tex]

just wanting to confirm my answer, thanks for any and all help anyone can give and I'll write back this time, lol
 
Physics news on Phys.org
  • #2
are your basis functions orthogonal? i think that might help...
 
  • #3
lanedance said:
are your basis functions orthogonal? i think that might help...

I did test for that, 1 and x were orthogonal, x and x^2 were orthogonal, however 1 and x^2 were not orthogonal and neither were any of the functions with each other, to try and remidy this I changed the functions such that I added a variable to make them orthogonal or make their integral equal to zero, so

[tex]\int[/tex]1dx = [tex]\int[/tex]adx = 0

[tex]\int[/tex]x^2dx = [tex]\int[/tex](x-a)^2dx = 0

[tex]\int[/tex]x^2x^2dx = [tex]\int[/tex]x^4dx = [tex]\int[/tex](x-a)^4dx = 0

however many of my solutions except the first one turned into some horrible monster with complex numbers and wasn't so sure that was correct, was my reasoning correct to do this?
 
  • #4
or the least squares method to miinimise the error, I'm pretty sure your functions need to be orthonormal (actualy orthogonal, but as the normlaisation helps), the way to do it is thorugh gram schimdt type process

so for the zeroth order function, pick the most general constant
[tex]f_0(x) = a [/tex]
test nomalisation
[tex]\int_{-1}^{1} dx (f_0(x))^2 = 2a^2 [/tex]
[tex]f_0(x) = \frac{1}{\sqrt{2}} [/tex]

and again for the next, f1
[tex]f_1(x) = b + cx [/tex]
test orthognality
[tex]\int_{-1}^{1} dx (f_0(x).f_1(x))
= \int_{-1}^{1} dx \frac{1}{\sqrt{2}} (b+cx)
= \frac{1}{\sqrt{2}}(bx+cx^2) _{-1}^{1}
= \frac{1}{\sqrt{2}}(b(1-(-1)) +c(1^2-(-1)^2))
= \frac{1}{\sqrt{2}}(2b) = 0
[/tex]

hence b = 0 (as you found), then do the normalisation for c, and for the last, start from
d + ex +fx^2
 

1. What is the Method of Least Squares?

The Method of Least Squares is a statistical technique used to find the best fit line or curve for a set of data points. It minimizes the sum of the squared differences between the actual data points and the predicted values on the line or curve.

2. When is the Method of Least Squares used?

The Method of Least Squares is commonly used in various fields such as mathematics, physics, and economics to analyze and model data. It is used when there is a relationship between two variables and the goal is to find the best fitting line or curve to represent the data.

3. How does the Method of Least Squares work?

The Method of Least Squares works by finding the line or curve that minimizes the sum of the squared differences between the actual data points and the predicted values. This is done by calculating the distance between each data point and the line or curve, squaring it, and then summing all the squared distances. The line or curve that produces the smallest sum of squared distances is considered the best fit line or curve.

4. What are the assumptions of the Method of Least Squares?

The Method of Least Squares assumes that the data follows a linear relationship, there is no measurement error, and the errors are normally distributed. It also assumes that the errors for each data point are independent of each other.

5. What are the limitations of the Method of Least Squares?

The Method of Least Squares may not be appropriate for data that does not follow a linear relationship. It also assumes that there is no measurement error, which may not be true in real-world data. Additionally, it may not be suitable for data with outliers or extreme values, as these can heavily influence the results.

Similar threads

  • Calculus and Beyond Homework Help
Replies
10
Views
459
  • Calculus and Beyond Homework Help
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
2
Views
838
  • Calculus and Beyond Homework Help
Replies
2
Views
720
  • Calculus and Beyond Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
12
Views
997
  • Calculus and Beyond Homework Help
Replies
4
Views
4K
  • Calculus and Beyond Homework Help
Replies
3
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
804
Back
Top