-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain6f.py
50 lines (45 loc) · 1.94 KB
/
main6f.py
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
41
42
43
44
45
46
47
48
49
50
import pandas as pandas
import numpy as numpy
import matplotlib.pyplot as pyplot
def printFunctionData(matrix, functionMatrix, plotColor, plotMarker, plot_xlabel, plot_ylabel):
numberOfRows, numberOfColumns = functionMatrix.shape
for i in range(numberOfRows):
for j in range(numberOfColumns):
space = ' '
if(functionMatrix[i][j] < 0):
space = ''
print(space + format(numpy.round(functionMatrix[i][j], 2)), end = "\t")
print(" ")
pyplot.plot(matrix, functionMatrix, color = plotColor, marker = plotMarker)
pyplot.xlabel(plot_xlabel)
pyplot.ylabel(plot_ylabel)
pyplot.show()
def getExponentialFunctionData(matrix):
exponentialFunctionMatrix = numpy.exp(matrix)
print("Exponential Function Data")
printFunctionData(matrix, exponentialFunctionMatrix, "green", "*", "Matrix Data", "Exponential Function Data");
def getSineFunctionData(matrix):
sineFunctionMatrix = numpy.sin(matrix)
print("Sine Function Data")
printFunctionData(matrix, sineFunctionMatrix, "blue", "*", "Matrix Data", "Sine Function Data");
def getSigmoidFunctionData(matrix):
sigmoidFunctionMatrix = 1 / (1 + numpy.exp(-matrix))
print("Sigmoid Function Data")
printFunctionData(matrix, sigmoidFunctionMatrix, "red", "*", "Matrix Data", "Sigmoid Function Data");
matrixA = numpy.array(pandas.read_csv("MatrixA.csv", sep =',', header = None, index_col = False))#.astype("float")
numberOfRows_MatrixA, numberOfColumns_MatrixA = matrixA.shape
print("Matrix A")
for i in range(numberOfRows_MatrixA):
for j in range(numberOfColumns_MatrixA):
space = ' '
if(matrixA[i][j] < 0):
space = ''
print(space + format(numpy.round(matrixA[i][j], 2)), end = "\t")
print(" ")
print(" ")
getExponentialFunctionData(matrixA)
print(" ")
getSineFunctionData(matrixA)
print(" ")
getSigmoidFunctionData(matrixA)
print(" ")