Post Reply 
How to do this on my Prime ?
09-29-2017, 11:56 AM
Post: #1
How to do this on my Prime ?
Hi,

I am learn how to calculate a fonction of parabole with 3 points given.
Me I do at hand pincil and paper, after I have resolve I obtain a system of 3 equations what I resolve with app linear solver. But I have to calculation by hand
the system as I say.

On internet I have see on a computer hand I dont' know the name a solution automatic, which I have tryied on Prime but no work. May be is a way to do same ?


In attachement I give what I do with hand and the other picture, may be you help me to do with Prime. Because I know how to do with hand ,it save me time for excercizes further if there is a solution automatic with Prime.

I hope it is clear because it is difficult for me to speek american.


Attached File(s) Thumbnail(s)
       

Gérard.
Find all posts by this user
Quote this message in a reply
09-29-2017, 12:26 PM
Post: #2
RE: How to do this on my Prime ?
1 - The quickest way might be to determine the Lagrange polynomial:

lagrange([1 -2 3], [2 1 4])

(then simplify the result).

2 - If you really want to solve the linear equations then you can do that as follows:

linsolve([a+b+c=2 4*a-2*b+c=1 9*a+3*b+c=4], [a b c])

3 - Or if you want to imitate the approach in your second screenshot:

f(x):=a*x^2+b*x+c
solve({f(1)=2,f(-2)=1,f(3)=4},[a b c])
Find all posts by this user
Quote this message in a reply
09-29-2017, 12:32 PM
Post: #3
RE: How to do this on my Prime ?
(09-29-2017 11:56 AM)ggauny@live.fr Wrote:  I am learn how to calculate a fonction of parabole with 3 points given.
Me I do at hand pincil and paper, after I have resolve I obtain a system of 3 equations what I resolve with app linear solver. But I have to calculation by hand
the system as I say.

I am sure there is a more elegant way on the Prime, but all you need is the linear equation solver. For a parabola the equation system is as follows:

Code:
   | x1² x1  1 |   →     | y1 |
   | x2² x2  1 | * p =   | y2 |
   | x3² x3  1 |         | y3 |

So simply start the linear solver and fill the matrix.
Consider the example in your screenshot:

Enter the x-values into the center column and the y-values on the right-hand side:

Code:
   | _  1  _ |   →     | 2 |
   | _ -2  _ | * p =   | 1 |
   | _  3  _ |         | 4 |

Fill the left column with the squares of the center column:

Code:
   | 1  1  _ |   →     | 2 |
   | 4 -2  _ | * p =   | 1 |
   | 9  3  _ |         | 4 |

Fill the right column with 1s:

Code:
   | 1  1  1 |   →     | 2 |
   | 4 -2  1 | * p =   | 1 |
   | 9  3  1 |         | 4 |

Now solve this system and you're done.

Dieter
Find all posts by this user
Quote this message in a reply
09-29-2017, 12:52 PM (This post was last modified: 09-29-2017 01:00 PM by Gerson W. Barbosa.)
Post: #4
RE: How to do this on my Prime ?
Interesting ideas in this old thread (others, not mine).
Find all posts by this user
Quote this message in a reply
09-29-2017, 01:22 PM
Post: #5
RE: How to do this on my Prime ?
(09-29-2017 12:52 PM)Gerson W. Barbosa Wrote:  Interesting ideas in this old thread (others, not mine).
Thanks for that link.

And as you already suggested: Cramer's Rule is not very efficient in general and should probably be avoided for numerical calculations, especially when the dimension goes up.

And I am not 100% sure, but I seem to remember that the determinant calculations are also quite sensitive to rounding (not if all you care about are integer x values of course). Again, this becomes more of a problem as the dimension goes up.
Find all posts by this user
Quote this message in a reply
09-29-2017, 02:59 PM
Post: #6
RE: How to do this on my Prime ?
Hi,

One again many thank you at all.

You are great teachers mathematician !

Have a good day.

Gérard.
Find all posts by this user
Quote this message in a reply
09-29-2017, 04:53 PM (This post was last modified: 09-29-2017 04:58 PM by toshk.)
Post: #7
RE: How to do this on my Prime ?
(09-29-2017 12:32 PM)Dieter Wrote:  
(09-29-2017 11:56 AM)ggauny@live.fr Wrote:  I am learn how to calculate a fonction of parabole with 3 points given.
Me I do at hand pincil and paper, after I have resolve I obtain a system of 3 equations what I resolve with app linear solver. But I have to calculation by hand
the system as I say.

I am sure there is a more elegant way on the Prime, but all you need is the linear equation solver. For a parabola the equation system is as follows:

Code:
   | x1² x1  1 |   →     | y1 |
   | x2² x2  1 | * p =   | y2 |
   | x3² x3  1 |         | y3 |

So simply start the linear solver and fill the matrix.
Consider the example in your screenshot:

Enter the x-values into the center column and the y-values on the right-hand side:

Code:
   | _  1  _ |   →     | 2 |
   | _ -2  _ | * p =   | 1 |
   | _  3  _ |         | 4 |

Fill the left column with the squares of the center column:

Code:
   | 1  1  _ |   →     | 2 |
   | 4 -2  _ | * p =   | 1 |
   | 9  3  _ |         | 4 |

Fill the right column with 1s:

Code:
   | 1  1  1 |   →     | 2 |
   | 4 -2  1 | * p =   | 1 |
   | 9  3  1 |         | 4 |

Now solve this system and you're done.

Dieter
[[2],[1],[4]]/vandermonde([1,-2,3])
for ill/weird/large/spare matrix: try
LSQ(vandermonde([1,-2,3]),[[2],[1],[4]])
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)