Problem 6) Fit the curve Find the best least square parameter of fitting the given data with y = a tan(x)+bsin(x) + c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 xs = np.array([0. , 0.01010101, 0.02020202, 0.03030303, 0.04040404, 0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909, 0.1010101, 0.11111111, 0.12121212, 0.13131313, 0.14141414, 0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919, 0.2020202, 0.21212121, 0.22222222, 0.23232323, 0.24242424, 0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929, 0.3030303, 0.31313131, 0.32323232, 0.33333333, 0.34343434, 0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939, 0.4040404, 0.41414141, 0.42424242, 0.43434343, 0.44444444, 0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949, 0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455, 0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596, 0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465, 0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697, 0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475, 0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798, 0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485, 0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899, 0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495, 0.95959596, 0.96969697, 0.97979798, 0.98989899, 1. ]) ys = np.array([ 0.75004691, 1.09732679, 1.18820555, 0.83595282, 1.01159677, 0.8471369 , 0.71757455, 0.38847743, 0.49385348, 0.51215564, 0.29910594, 0.40747048, 0.13363289, 0.34384035, 0.24535638, 0.02051088, -0.13402503, 0.10929007, -0.25287898, -0.4572011, 0.0223008, -0.06078721, -0.48673349, -0.6717129, -0.53279064, -0.44832883, -0.55515997, -0.49420894, -0.89645461, -0.88426652, -0.91460546, -1.31088225, -1.23611328, -0.98358701, -1.05823519, -1.36035132, -1.09144663, -1.72705462, -1.7191017, -1.75250907, -1.67239883, -1.75390137, -1.67480566, -1.85408143, -1.52597043, -2.18614414, -2.0889476, -1.8726768, -2.31789522, -1.7511221, -2.33201325, -2.25253818, -2.3777861, -2.4015338, -2.2593009, 3 -2.22356644, -2.54052913, -2.16001698, -2.46650313, -2.6680098, -2.70468768, -2.561615 -2.55350647, -2.63278273, -2.99566547, -2.90908344, -2.60789384, -2.61206141, -2.58122084, -3.09880765, -3.20479182, -2.78589743, -2.94636619, -3.03703566, -2.50969056, -3.04236388, -2.79587639, -3.21919484, -2.85153809, -3.19638226, -2.84318555, -2.84740744, -3.29947507, -2.80420132, -2.82612326, -2.89048869, -2.94608334, -2.95131326, -3.05914746, -3.16689036, -3.24891406, -2.81161468, -2.48474534, -2.90682385, -2.43308443, -2.76340895, -2.74012884, -2.68126473, -2.67225112, -3.08175939]) 41 plt.plot(xs, ys, '.') Python [6] ✓ 0.0s [zmatplotlib linos Line? at Av22c56d0Ahhasi 1 -1- -2 -3- 0.0 0.2 0.4 0.6 0.8 1.0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

%matplotlib inline
import numpy as np
from matplotlib import pyplot as plt
import math

xs = np.array([0.        , 0.01010101, 0.02020202, 0.03030303, 0.04040404,
       0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909,
       0.1010101 , 0.11111111, 0.12121212, 0.13131313, 0.14141414,
       0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919,
       0.2020202 , 0.21212121, 0.22222222, 0.23232323, 0.24242424,
       0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929,
       0.3030303 , 0.31313131, 0.32323232, 0.33333333, 0.34343434,
       0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939,
       0.4040404 , 0.41414141, 0.42424242, 0.43434343, 0.44444444,
       0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949,
       0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455,
       0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596 ,
       0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465,
       0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697 ,
       0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475,
       0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798 ,
       0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485,
       0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899 ,
       0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495,
       0.95959596, 0.96969697, 0.97979798, 0.98989899, 1.        ])
ys = np.array([ 0.75004691,  1.09732679,  1.18820555,  0.83595282,  1.01159677,
        0.8471369 ,  0.71757455,  0.38847743,  0.49385348,  0.51215564,
        0.29910594,  0.40747048,  0.13363289,  0.34384035,  0.24535638,
        0.02051088, -0.13402503,  0.10929007, -0.25287898, -0.4572011 ,
        0.0223008 , -0.06078721, -0.48673349, -0.6717129 , -0.53279064,
       -0.44832883, -0.55515997, -0.49420894, -0.89645461, -0.88426652,
       -0.91460546, -1.31088225, -1.23611328, -0.98358701, -1.05823519,
       -1.36035132, -1.09144663, -1.72705462, -1.7191017 , -1.75250907,
       -1.67239883, -1.75390137, -1.67480566, -1.85408143, -1.52597043,
       -2.18614414, -2.0889476 , -1.8726768 , -2.31789522, -1.7511221 ,
       -2.33201325, -2.25253818, -2.3777861 , -2.4015338 , -2.2593009 ,
       -2.22356644, -2.54052913, -2.16001698, -2.46650313, -2.6680098 ,
       -2.70468768, -2.561615  , -2.55350647, -2.63278273, -2.99566547,
       -2.90908344, -2.60789384, -2.61206141, -2.58122084, -3.09880765,
       -3.20479182, -2.78589743, -2.94636619, -3.03703566, -2.50969056,
       -3.04236388, -2.79587639, -3.21919484, -2.85153809, -3.19638226,
       -2.84318555, -2.84740744, -3.29947507, -2.80420132, -2.82612326,
       -2.89048869, -2.94608334, -2.95131326, -3.05914746, -3.16689036,
       -3.24891406, -2.81161468, -2.48474534, -2.90682385, -2.43308443,
       -2.76340895, -2.74012884, -2.68126473, -2.67225112, -3.08175939])
plt.plot(xs, ys, '.')
Problem 6) Fit the curve
Find the best least square parameter of fitting the given data with
y = a tan(x)+bsin(x) + c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
xs = np.array([0.
, 0.01010101, 0.02020202, 0.03030303, 0.04040404,
0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909,
0.1010101, 0.11111111, 0.12121212, 0.13131313, 0.14141414,
0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919,
0.2020202, 0.21212121, 0.22222222, 0.23232323, 0.24242424,
0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929,
0.3030303, 0.31313131, 0.32323232, 0.33333333, 0.34343434,
0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939,
0.4040404, 0.41414141, 0.42424242, 0.43434343, 0.44444444,
0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949,
0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455,
0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596,
0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465,
0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697,
0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475,
0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798,
0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485,
0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899,
0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495,
0.95959596, 0.96969697, 0.97979798, 0.98989899, 1.
])
ys = np.array([ 0.75004691, 1.09732679, 1.18820555, 0.83595282, 1.01159677,
0.8471369 , 0.71757455, 0.38847743, 0.49385348, 0.51215564,
0.29910594, 0.40747048, 0.13363289, 0.34384035, 0.24535638,
0.02051088, -0.13402503, 0.10929007, -0.25287898, -0.4572011,
0.0223008, -0.06078721, -0.48673349, -0.6717129, -0.53279064,
-0.44832883, -0.55515997, -0.49420894, -0.89645461, -0.88426652,
-0.91460546, -1.31088225, -1.23611328, -0.98358701, -1.05823519,
-1.36035132, -1.09144663, -1.72705462, -1.7191017, -1.75250907,
-1.67239883, -1.75390137, -1.67480566, -1.85408143, -1.52597043,
-2.18614414, -2.0889476, -1.8726768, -2.31789522, -1.7511221,
-2.33201325, -2.25253818, -2.3777861, -2.4015338, -2.2593009,
3
-2.22356644, -2.54052913, -2.16001698, -2.46650313, -2.6680098,
-2.70468768, -2.561615 -2.55350647, -2.63278273, -2.99566547,
-2.90908344, -2.60789384, -2.61206141, -2.58122084, -3.09880765,
-3.20479182, -2.78589743, -2.94636619, -3.03703566, -2.50969056,
-3.04236388, -2.79587639, -3.21919484, -2.85153809, -3.19638226,
-2.84318555, -2.84740744, -3.29947507, -2.80420132, -2.82612326,
-2.89048869, -2.94608334, -2.95131326, -3.05914746, -3.16689036,
-3.24891406, -2.81161468, -2.48474534, -2.90682385, -2.43308443,
-2.76340895, -2.74012884, -2.68126473, -2.67225112, -3.08175939])
41 plt.plot(xs, ys, '.')
Python
[6]
✓ 0.0s
[zmatplotlib linos Line? at Av22c56d0Ahhasi
Transcribed Image Text:Problem 6) Fit the curve Find the best least square parameter of fitting the given data with y = a tan(x)+bsin(x) + c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 xs = np.array([0. , 0.01010101, 0.02020202, 0.03030303, 0.04040404, 0.05050505, 0.06060606, 0.07070707, 0.08080808, 0.09090909, 0.1010101, 0.11111111, 0.12121212, 0.13131313, 0.14141414, 0.15151515, 0.16161616, 0.17171717, 0.18181818, 0.19191919, 0.2020202, 0.21212121, 0.22222222, 0.23232323, 0.24242424, 0.25252525, 0.26262626, 0.27272727, 0.28282828, 0.29292929, 0.3030303, 0.31313131, 0.32323232, 0.33333333, 0.34343434, 0.35353535, 0.36363636, 0.37373737, 0.38383838, 0.39393939, 0.4040404, 0.41414141, 0.42424242, 0.43434343, 0.44444444, 0.45454545, 0.46464646, 0.47474747, 0.48484848, 0.49494949, 0.50505051, 0.51515152, 0.52525253, 0.53535354, 0.54545455, 0.55555556, 0.56565657, 0.57575758, 0.58585859, 0.5959596, 0.60606061, 0.61616162, 0.62626263, 0.63636364, 0.64646465, 0.65656566, 0.66666667, 0.67676768, 0.68686869, 0.6969697, 0.70707071, 0.71717172, 0.72727273, 0.73737374, 0.74747475, 0.75757576, 0.76767677, 0.77777778, 0.78787879, 0.7979798, 0.80808081, 0.81818182, 0.82828283, 0.83838384, 0.84848485, 0.85858586, 0.86868687, 0.87878788, 0.88888889, 0.8989899, 0.90909091, 0.91919192, 0.92929293, 0.93939394, 0.94949495, 0.95959596, 0.96969697, 0.97979798, 0.98989899, 1. ]) ys = np.array([ 0.75004691, 1.09732679, 1.18820555, 0.83595282, 1.01159677, 0.8471369 , 0.71757455, 0.38847743, 0.49385348, 0.51215564, 0.29910594, 0.40747048, 0.13363289, 0.34384035, 0.24535638, 0.02051088, -0.13402503, 0.10929007, -0.25287898, -0.4572011, 0.0223008, -0.06078721, -0.48673349, -0.6717129, -0.53279064, -0.44832883, -0.55515997, -0.49420894, -0.89645461, -0.88426652, -0.91460546, -1.31088225, -1.23611328, -0.98358701, -1.05823519, -1.36035132, -1.09144663, -1.72705462, -1.7191017, -1.75250907, -1.67239883, -1.75390137, -1.67480566, -1.85408143, -1.52597043, -2.18614414, -2.0889476, -1.8726768, -2.31789522, -1.7511221, -2.33201325, -2.25253818, -2.3777861, -2.4015338, -2.2593009, 3 -2.22356644, -2.54052913, -2.16001698, -2.46650313, -2.6680098, -2.70468768, -2.561615 -2.55350647, -2.63278273, -2.99566547, -2.90908344, -2.60789384, -2.61206141, -2.58122084, -3.09880765, -3.20479182, -2.78589743, -2.94636619, -3.03703566, -2.50969056, -3.04236388, -2.79587639, -3.21919484, -2.85153809, -3.19638226, -2.84318555, -2.84740744, -3.29947507, -2.80420132, -2.82612326, -2.89048869, -2.94608334, -2.95131326, -3.05914746, -3.16689036, -3.24891406, -2.81161468, -2.48474534, -2.90682385, -2.43308443, -2.76340895, -2.74012884, -2.68126473, -2.67225112, -3.08175939]) 41 plt.plot(xs, ys, '.') Python [6] ✓ 0.0s [zmatplotlib linos Line? at Av22c56d0Ahhasi
1
-1-
-2
-3-
0.0
0.2
0.4
0.6
0.8
1.0
Transcribed Image Text:1 -1- -2 -3- 0.0 0.2 0.4 0.6 0.8 1.0
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education