import numpy as np
import matplotlib.pyplot as plt

# generate sample data
x_data = np.linspace(-5, 5, 20)
y_data = np.random.normal(0.0, 1.0, x_data.size)

plt.plot(x_data, y_data, 'o')
plt.show()

import math
import numpy as np
import matplotlib.pyplot as plt

# generate sample data
x_data = np.linspace(-math.pi, math.pi, 30)
y_data = np.sin(x_data) + np.random.normal(0.0, 0.1, x_data.size)

plt.plot(x_data, y_data, 'o')
plt.show()


Change to sin() function with noise
Change to sin() function with noise

+ import math
  import numpy as np
  import matplotlib.pyplot as plt
  
  # generate sample data
- x_data = np.linspace(-5, 5, 20)
+ x_data = np.linspace(-math.pi, math.pi, 30)
- y_data = np.random.normal(0.0, 1.0, x_data.size)
+ y_data = np.sin(x_data) + np.random.normal(0.0, 0.1, x_data.size)
  
  plt.plot(x_data, y_data, 'o')
  plt.show()
  
+ 
Change to sin() function with noise
## Code Before:
import numpy as np
import matplotlib.pyplot as plt

# generate sample data
x_data = np.linspace(-5, 5, 20)
y_data = np.random.normal(0.0, 1.0, x_data.size)

plt.plot(x_data, y_data, 'o')
plt.show()

## Instruction:
Change to sin() function with noise
## Code After:
import math
import numpy as np
import matplotlib.pyplot as plt

# generate sample data
x_data = np.linspace(-math.pi, math.pi, 30)
y_data = np.sin(x_data) + np.random.normal(0.0, 0.1, x_data.size)

plt.plot(x_data, y_data, 'o')
plt.show()

