# -*- coding: utf-8 -*-
"""
Created on Tue Oct 26 17:53:54 2021

@author: virgi
"""
import numpy as np
import math as ma
len_seq = 10
def creation_sin_RNN(len_seq,tmin,tmax,n,w,a=1,b=0):
    
    
    Datax, Datay = [], []
    
    t = np.linspace(tmin,tmax,n)
    x =a* np.sin(2*ma.pi*w*t)+b
    for i in range(len(x)-len_seq):
        Datax.append([x[i:i+len_seq]])
        Datay.append([x[i+1:i+len_seq+1]])    
    Datax = np.array(Datax)
    Datay = np.array(Datay)
    
    
    return(Datax,Datay)




def creation_x_sin_RNN(len_seq,tmin,tmax,n,w,a=1,b=1,c=0):
    
    
    Datax, Datay = [], []
    
    t = np.linspace(tmin,tmax,n)
    x=[]
    for i in t:
        x.append(a*i+b* np.sin(2*ma.pi*w*i)+c)
    for i in range(len(x)-len_seq):
        Datax.append([x[i:i+len_seq]])
        Datay.append([x[i+1:i+len_seq+1]])    
    Datax = np.array(Datax)
    Datay = np.array(Datay)
    
    
    return(Datax,Datay)

def creation_x_sin2_RNN(len_seq,tmin,tmax,n,w,a=1,b=1,c=0):
    
    
    Datax, Datay = [], []
    
    t = np.linspace(tmin,tmax,n)
    x=[]
    for i in t:
        x.append(a*i+b*np.sin(2*ma.pi*w*i)*np.sin(2*ma.pi*w*i)+c)
    for i in range(len(x)-len_seq):
        Datax.append([x[i:i+len_seq]])
        Datay.append([x[i+1:i+len_seq+1]])    
    Datax = np.array(Datax)
    Datay = np.array(Datay)
    
    
    return(Datax,Datay)




def creation_sin(tmin,tmax,n,w,a=1,c=0):
    Lx=[]
    t = np.linspace(tmin,tmax,n)
    for i in t:
        Lx.append(a*np.sin(w*i)+c)
        
    Lx=np.array(Lx)
    return(t,Lx)

def creation_x_sin(tmin,tmax,n,w,a=1,b=0,c=0):
    Lx=[]
    t = np.linspace(tmin,tmax,n)
    for i in t:
        Lx.append(a*i+b* np.sin(2*ma.pi*w*i)+c)
    Lx=np.array(Lx)
    return(t,Lx)

def creation_x_sin2(tmin,tmax,n,w,a=1,b=1,c=0):
    Lx=[]
    t = np.linspace(tmin,tmax,n)
    for i in t:
        Lx.append(a*i+b*np.sin(2*ma.pi*w*i)*np.sin(2*ma.pi*w*i)+c)
    Lx=np.array(Lx)
    return(t,Lx)


