Question: Need a basic javascript program to build the Lagrange polynomial that goes through the points (p = [[0,3.8414709848078967],[0.6931471805599453,6.6818861490654635],[1.0986122886681098,7.5355691627323065],[1.3862943611198906,7.788374949171635],[1.6094379124341003,8.478827375073264],[1.791759469228055,9.887622378713294],[1.9459101490553132,11.440627194940042],[2.0794415416798357,12.307124413342725]]) and evaluate the function at x=1.5. Define

Need a basic javascript program to build the Lagrange polynomial that goes through the points (p = [[0,3.8414709848078967],[0.6931471805599453,6.6818861490654635],[1.0986122886681098,7.5355691627323065],[1.3862943611198906,7.788374949171635],[1.6094379124341003,8.478827375073264],[1.791759469228055,9.887622378713294],[1.9459101490553132,11.440627194940042],[2.0794415416798357,12.307124413342725]]) and evaluate the function at x=1.5. Define the data points and the value of x in variables that can be easily replaced, like this: p = [[0,3.8414709848078967],[0.6931471805599453,6.6818861490654635],[1.0986122886681098,7.5355691627323065],[1.3862943611198906,7.788374949171635],[1.6094379124341003,8.478827375073264],[1.791759469228055,9.887622378713294],[1.9459101490553132,11.440627194940042],[2.0794415416798357,12.307124413342725]] x = 1.5 all I need you to display is the value of f(x). With a Lagrange polynomial your answer would be f(x) = 2.1271966695785522x^7 -28.013010025024414x^6 +127.76653289794922x^5 -276.1880187988281x^4 +308.3759117126465x^3 -173.41200065612793x^2 +42.868422985076904x +3.841470984610453 and you will be getting the original values that you had input: (0, 3.8415), (0.6931, 6.6819), (1.0986, 7.5356), (1.3863, 7.7884), (1.6094, 8.4788), (1.7918, 9.8876), (1.9459, 11.4406), (2.0794, 12.3071)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!