Пример #1
0
# -*- coding: utf-8 -*-
"""
Created on Mon Jun  4 17:34:03 2018

@author: Yangyang Fu
@email: [email protected]
"""

import numpy as np
import linsolver as lin

A = np.array([[1, 2], [1, 1]])
b = np.array([[3], [2]])
tStart = 0
tEnd = 1200
dt = 60
x0 = np.array([[0], [0]])

equation = lin.solveDynamic(A, b, tStart=tStart, tEnd=tEnd, dt=dt, x0=x0)

equation.solve()
Пример #2
0
    equation = lin.solveDynamic(A,b,b0,num,x0=x0)
    equation.Dysolve()
    result = result + equation.result

"""
#reinitialization
tab2 = pd.read_csv('b.csv')
b = np.array([[tab2['b4'].iloc[0], tab2['b5'].iloc[0]]])
x0 = np.array([initial['t4'].iloc[0], initial['t5'].iloc[0]])
for i in range(1, len(tab2)):
    temp = np.array([[tab2['b4'].iloc[i], tab2['b5'].iloc[i]]])
    #print temp
    b = np.concatenate((b, temp))

num = len(tab2)
equation2 = lin.solveDynamic(A, b, b0, num, x0=x0)

equation2.Dysolve()
result = result + equation2.result

f = open('result.csv', 'w')
f.writelines(result)
f.close()


# RMSE
# plotting the results
def rmse(x, y):
    sum = 0
    for i in range(len(x) - 1):
        sum = sum + (x[i] - y[i]) * (x[i] - y[i])