# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# Allow multiple displays per cell
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"

# +
# # !pip install matplotlib

# +
import math

def basic_sigmoid(x):
    s = 1/(1+math.exp(-x))
    return s


# -

basic_sigmoid(-100)

-1e3


# +
# x = [1, 2, 3]
# print(basic_sigmoid(x))
#relies on the function
# -

[basic_sigmoid(x) for x in [1,4,7] ]

# +
import numpy as np

def sigmoid(x):
    s = 1/(1+np.exp(-x)) 
    return s


# -

MyVariable = np.array([3, 2, 1, 8])
print(sigmoid(MyVariable))



values = plt.linspace(-10,10,7)
values
sigmoid(values)

# +
from matplotlib import pylab
import pylab as plt
import numpy as np

def sigmoid(x):
    s = 1/(1+np.exp(-x))   
    return s

def sigmoid_derivative(x):
    s = sigmoid(x)
    ds = s*(1-s)
    return ds

# linespace generate an array from start and stop value, 100 elements
values = plt.linspace(-10,10,100)

# prepare the plot, associate the color r(ed) or b(lue) and the label 
plt.plot(values, sigmoid(values), 'r')
plt.plot(values, sigmoid_derivative(values), 'b')

# Draw the grid line in background.
plt.grid()

# Title & Subtitle
plt.title('Sigmoid and Sigmoid derivative functions')

# plt.plot(x)
plt.xlabel('X Axis')
plt.ylabel('Y Axis')

# create the graph
plt.show()


# +
def our_function(x, a, b, c):
    s = a*np.power(x, 2) + b*x + c
    return s


x1 = np.arange(7)
myA= 4
myB= 2
myC= 1

x1
our_function(x1, myA, myB, myC)


# +
def our_function(x, a, b, c):
    s = a*np.power(x, 2) + b*x + c
    return s



# linespace generate an array from start and stop value, 100 elements
xvalues = plt.linspace(-10,10,100)

# prepare the plot, associate the color r(ed) or b(lue) and the label 
plt.plot(values, our_function(xvalues, myA, myB, myC), 'r')


# Draw the grid line in background.
plt.grid()

# Title & Subtitle
plt.title('Quadratic functions')

# plt.plot(x)
plt.xlabel('X Axis')
plt.ylabel('Y Axis')

# create the graph
plt.show()

# +
# linespace generate an array from start and stop value, 100 elements
xvalues = np.arange(1,2,3)

# prepare the plot, associate the color r(ed) or b(lue) and the label 
plt.plot(values, our_function(xvalues, myA, myB, myC), 'r')


# Draw the grid line in background.
plt.grid()

# Title & Subtitle
plt.title('Quadratic functions')

# plt.plot(x)
plt.xlabel('X Axis')
plt.ylabel('Y Axis')

# create the graph
plt.show()

StarcoderdataJupyterScriptsDedupFiltered