diff --git a/docs/build/html/_modules/data.html b/docs/build/html/_modules/data.html
index f562ec7..3eb5069 100644
--- a/docs/build/html/_modules/data.html
+++ b/docs/build/html/_modules/data.html
@@ -45,7 +45,6 @@
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>"""
-from__future__importprint_functionimportmathimportpickle
@@ -79,7 +78,6 @@
y=[]forrowinfile:fields=re.split(r'\s+',row.strip())
- #print(filds)x.append(float(fields[x_column]))y.append(float(fields[y_column]))file.close()
@@ -192,7 +190,6 @@
exponent=max(start_exp,step_exp)# no stop because it is an open boundn=int(math.ceil((stop-start)/float(step)))
- #n = int((stop - start)/float(step)) # in py3 math.ceil returns intlst=[]ifn>0:lst=[round(start+step*i,exponent)foriinrange(n)]
@@ -227,7 +224,7 @@
:returns: full id :rtype: str or int """
- # we know it is a unique ending
+ # take first element, because we know it is a unique endingreturn[idiforidiinidsifidi.endswith(uide)][0]
diff --git a/docs/build/html/_modules/date.html b/docs/build/html/_modules/date.html
index 54d8410..a4598bc 100644
--- a/docs/build/html/_modules/date.html
+++ b/docs/build/html/_modules/date.html
@@ -45,7 +45,6 @@
.. moduleauthor:: Daniel Weschke <daniel.weschke@directbox.de>"""
-from__future__importdivision,print_function,unicode_literals
[docs]defsine_wave(A=1,k=1,f=1,phi=0,D=0,degree=False):
+ r"""A sine wave or sinusoid is a mathematical curve that describes a
+ smooth periodic oscillation.
+
+ :param A: amplitude
+ :type A: float or int
+ :param k: (angular) wave number
+ :type k: float or int
+ :param f: ordinary frequency
+ :type f: float or int
+ :param phi: phase
+ :type phi: float or int
+ :param D: non-zero center amplitude
+ :type D: float or int
+ :param degree: boolean to switch between radians and degree. If
+ False phi is interpreted in radians and if True then phi is
+ interpreted in degrees.
+
+ In general, the function is:
+
+ .. math::
+ y(x,t) = A\sin(kx + 2\pi f t + \varphi) + D \\
+ y(x,t) = A\sin(kx + \omega t + \varphi) + D
+
+ where:
+
+ * A, amplitude, the peak deviation of the function from zero.
+ * f, ordinary frequency, the number of oscillations (cycles) that
+ occur each second of time.
+ * ω = 2πf, angular frequency, the rate of change of the function
+ argument in units of radians per second. If ω < 0 the wave is
+ moving to the right, if ω > 0 the wave is moving to the left.
+ * φ, phase, specifies (in radians) where in its cycle the
+ oscillation is at t = 0.
+ * x, spatial variable that represents the position on the
+ dimension on which the wave propagates.
+ * k, characteristic parameter called wave number (or angular wave
+ number), which represents the proportionality between the
+ angular frequency ω and the linear speed (speed of propagation)
+ ν.
+ * D, non-zero center amplitude.
+
+ The wavenumber is related to the angular frequency by:
+
+ .. math::
+ k={\omega \over v}={2\pi f \over v}={2\pi \over \lambda }
+
+ where λ (lambda) is the wavelength, f is the frequency, and v is the
+ linear speed.
+
+ .. seealso::
+ :meth:`function_cosine_wave_degree`
+ """
+ ifdegree:
+ phi=math.radians(phi)
+ returnlambdax,t=0:A*math.sin(k*x+2*math.pi*f*t+phi)+D
+
+
[docs]defcosine_wave(A=1,k=1,f=1,phi=0,D=0,degree=False):
+ r"""A cosine wave is said to be sinusoidal, because,
+ :math:`\cos(x) = \sin(x + \pi/2)`, which is also a sine wave with a
+ phase-shift of π/2 radians. Because of this head start, it is often
+ said that the cosine function leads the sine function or the sine
+ lags the cosine.
+
+ :param A: amplitude
+ :type A: float or int
+ :param k: (angular) wave number
+ :type k: float or int
+ :param f: ordinary frequency
+ :type f: float or int
+ :param phi: phase
+ :type phi: float or int
+ :param D: non-zero center amplitude
+ :type D: float or int
+ :param degree: boolean to switch between radians and degree. If
+ False phi is interpreted in radians and if True then phi is
+ interpreted in degrees.
+
+ .. seealso::
+ :meth:`function_sine_wave_degree`
+ """
+ ifdegree:
+ phi=phi+90
+ else:
+ phi=phi+math.pi/2
+ returnsine_wave(A=A,k=k,f=f,phi=phi,D=D,degree=degree)
A cosine wave is said to be sinusoidal, because,
+\(\cos(x) = \sin(x + \pi/2)\), which is also a sine wave with a
+phase-shift of π/2 radians. Because of this head start, it is often
+said that the cosine function leads the sine function or the sine
+lags the cosine.
+
+
Parameters
+
+
A (float or int) – amplitude
+
k (float or int) – (angular) wave number
+
f (float or int) – ordinary frequency
+
phi (float or int) – phase
+
D (float or int) – non-zero center amplitude
+
degree – boolean to switch between radians and degree. If
+False phi is interpreted in radians and if True then phi is
+interpreted in degrees.
A sine wave or sinusoid is a mathematical curve that describes a
+smooth periodic oscillation.
+
+
Parameters
+
+
A (float or int) – amplitude
+
k (float or int) – (angular) wave number
+
f (float or int) – ordinary frequency
+
phi (float or int) – phase
+
D (float or int) – non-zero center amplitude
+
degree – boolean to switch between radians and degree. If
+False phi is interpreted in radians and if True then phi is
+interpreted in degrees.
+
+
+
+
In general, the function is:
+
+\[\begin{split}y(x,t) = A\sin(kx + 2\pi f t + \varphi) + D \\
+y(x,t) = A\sin(kx + \omega t + \varphi) + D\end{split}\]
+
where:
+
+
+
A, amplitude, the peak deviation of the function from zero.
+
f, ordinary frequency, the number of oscillations (cycles) that
+occur each second of time.
+
ω = 2πf, angular frequency, the rate of change of the function
+argument in units of radians per second. If ω < 0 the wave is
+moving to the right, if ω > 0 the wave is moving to the left.
+
φ, phase, specifies (in radians) where in its cycle the
+oscillation is at t = 0.
+
x, spatial variable that represents the position on the
+dimension on which the wave propagates.
+
k, characteristic parameter called wave number (or angular wave
+number), which represents the proportionality between the
+angular frequency ω and the linear speed (speed of propagation)
+ν.
+
D, non-zero center amplitude.
+
+
+
The wavenumber is related to the angular frequency by:
+
+\[k={\omega \over v}={2\pi f \over v}={2\pi \over \lambda }\]
+
where λ (lambda) is the wavelength, f is the frequency, and v is the
+linear speed.
diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js
index c496d02..ddce9e0 100644
--- a/docs/build/html/searchindex.js
+++ b/docs/build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({docnames:["data","date","geometry","geometry_plot","index","modules","numerical","time_of_day"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["data.rst","date.rst","geometry.rst","geometry_plot.rst","index.rst","modules.rst","numerical.rst","time_of_day.rst"],objects:{"":{data:[0,0,0,"-"],date:[1,0,0,"-"],fit:[6,0,0,"-"],geometry:[2,0,0,"-"],geometry_plot:[3,0,0,"-"],integration:[6,0,0,"-"],numerical:[6,0,0,"-"],ode:[6,0,0,"-"],ode_model:[6,0,0,"-"],time_of_day:[7,0,0,"-"]},"numerical.fit":{gauss:[6,1,1,""],gauss_fit:[6,1,1,""]},"numerical.integration":{trapez:[6,1,1,""]},"numerical.ode":{e1:[6,1,1,""],e2:[6,1,1,""],e4:[6,1,1,""],fpi:[6,1,1,""],i1:[6,1,1,""],newmark_newtonraphson:[6,1,1,""],newmark_newtonraphson_rdk:[6,1,1,""]},"numerical.ode_model":{disk:[6,1,1,""],disk_nm:[6,1,1,""],disk_nmmdk:[6,1,1,""]},data:{fold_list:[0,1,1,""],get_id:[0,1,1,""],load:[0,1,1,""],read:[0,1,1,""],seq:[0,1,1,""],store:[0,1,1,""],unique_ending:[0,1,1,""],write:[0,1,1,""]},date:{"gau\u00dfsche_osterformel":[1,1,1,""],ascension_of_jesus:[1,1,1,""],easter_friday:[1,1,1,""],easter_monday:[1,1,1,""],easter_sunday:[1,1,1,""],pentecost:[1,1,1,""]},geometry:{angle:[2,1,1,""],cubic:[2,1,1,""],cubic_deg:[2,1,1,""],cubics:[2,1,1,""],distance:[2,1,1,""],interpolate_hermite:[2,1,1,""],line:[2,1,1,""],lines:[2,1,1,""],rectangle:[2,1,1,""],rotate:[2,1,1,""],rotate_deg:[2,1,1,""],rotate_xy:[2,1,1,""],square:[2,1,1,""],translate:[2,1,1,""],translate_xy:[2,1,1,""]},geometry_plot:{plot_cubic_lines:[3,1,1,""],plot_lines:[3,1,1,""]},numerical:{fit:[6,0,0,"-"],integration:[6,0,0,"-"],ode:[6,0,0,"-"],ode_model:[6,0,0,"-"]},time_of_day:{days:[7,1,1,""],days_norm:[7,1,1,""],hours:[7,1,1,""],hours_norm:[7,1,1,""],in_seconds:[7,1,1,""],minutes:[7,1,1,""],minutes_norm:[7,1,1,""],seconds:[7,1,1,""],seconds_norm:[7,1,1,""],transform:[7,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:function"},terms:{"1st":6,"2nd":6,"4th":6,"9fsche_osterformel":1,"case":6,"char":0,"default":[0,2,6,7],"f\u00fcr":1,"float":[0,2,6,7],"fr\u00fchling":1,"function":6,"gau\u00dfsch":1,"gau\u00dfsche_osterformel":1,"int":[0,1,2,6],"korrekturgr\u00f6\u00df":1,"m\u00e4rz":1,"m\u00e4rzdatum":1,"new":7,"return":[0,1,2,6,7],"s\u00e4kular":1,"s\u00e4kularzahl":1,"vorw\u00e4rt":6,Das:1,The:[0,2,6,7],absolut:2,addit:2,against:6,algorithmu:1,als:1,amplitud:6,analyt:6,angl:2,angle1:2,angle2:2,approx:6,approxim:6,april:1,area:6,argument:2,arithmet:0,around:2,arrai:0,ascens:1,ascension_of_jesu:1,ascii:0,assum:2,averag:7,backward:6,base:6,becom:6,begin:6,beta:6,between:[0,2],binari:0,bmatrix:6,bool:[0,6],bottom:2,bound:0,boundari:2,build:2,calcul:[1,6,7],cauchi:6,cdot:6,center:2,chang:2,choos:6,close:0,column:0,common:0,composit:6,condit:[2,6],consecut:0,constant:0,content:5,convert:[0,7],coordin:2,counterclockwis:2,creat:0,cubic:2,cubic_deg:2,dai:[1,7],data:[5,6],date:[0,2,3,5,6,7],datetim:1,datum:1,days_norm:7,ddot:6,decid:2,defin:2,definit:6,deflect:2,deform:2,degener:0,degre:2,den:1,der:1,derform:2,deriv:6,des:1,describ:6,deviat:6,diamet:6,die:1,differ:[0,6],differenti:6,dimension:0,dimenson:0,direct:2,disk:6,disk_nm:6,disk_nmmdk:6,displac:[2,6],distanc:2,distribut:6,divid:6,doe:2,dot:6,each:2,easter:1,easter_fridai:1,easter_mondai:1,easter_sundai:1,eccentr:6,edg:2,either:2,element:[0,2],empti:0,emptyset:0,end:[0,2,6],endpoint:2,entfernung:1,equal:6,equalii:6,equat:6,error:6,ersten:1,euler:6,everi:6,exampl:[2,6],expect:6,explicit:6,explizit:6,f_n:6,factor:2,fail:0,fals:[0,6],fassregel:6,file:0,file_nam:0,filenam:0,first:[0,2,6],fit:5,fix:6,float64:6,fnm:6,fold_list:0,follow:0,foral:6,forward:6,fourth:6,fpi:6,frac:[2,6],fridai:1,from:[0,6],full:[0,6],fwhm:6,gamma:6,gau:1,gauss:6,gauss_fit:6,geometri:[3,5],geometry_plot:[2,5],get:0,get_id:0,gilt:1,given:[0,2,6],global:[2,6],global_deform:2,govern:6,gregorian:7,gregorianischen:1,half:6,has:[0,6],height:2,hermit:2,horizont:2,hour:7,hours_norm:7,http:1,ids:0,implicit:6,in_second:7,inc:2,incid:2,index:[0,2,4],index_offset:2,inform:[0,6],initi:6,integr:5,integrand:6,interpol:2,interpolate_hermit:2,interpret:0,interv:6,iter:6,jahr:1,jesu:1,johann:6,kalend:1,kalendarisch:1,keim:1,kepler:6,keplersch:6,keyword:2,kutta:6,kwarg:[2,3],kx1:0,lambda:6,ldot:6,left:[0,2,6],leftrightarrow:6,length:[0,2,7],leq:6,lhd:2,limit:6,limits_:6,limits_a:6,line:2,list:[0,2,6],lns:3,load:0,local:6,lower:[0,6],lst:0,lvd:2,lvert:6,manipul:0,march:1,mathmat:6,mathrm:6,matplotlib:3,max_iter:6,maximum:6,mean:6,method:6,minumum:0,minut:7,minutes_norm:7,model:6,modul:[4,5],mondai:1,mondparamet:1,mondschaltung:1,mxn:0,ndarrai:6,necessari:6,necessarili:6,newmark:6,newmark_newtonraphson:6,newmark_newtonraphson_rdk:6,node:2,none:[0,2,6],normal:7,number:[2,6],numer:5,numerisch:6,numpi:6,object:[0,2],object_data:0,ode:5,ode_model:5,offset:[6,7],one:[0,2,6],onli:0,open:0,option:2,order:[2,6],ordinari:6,org:1,origin:2,osterentfernung:1,osterformel:1,ostergrenz:1,ostersonntag:1,other:2,otherwis:2,packag:5,page:4,paramet:[0,1,2,6,7],pentecost:1,per:6,plane:2,plot:2,plot_cubic_lin:3,plot_lin:[2,3],plotter:3,point1:2,point1_i:2,point1_x:2,point2:2,point2_i:2,point2_x:2,point3:2,point4:2,point:[2,6],point_i:2,point_x:2,points1_i:2,polygon:2,polygonzugverfahren:6,popt:6,posit:6,position_norm:7,print:[2,6],problem:6,program:0,proport:6,pts:2,pylab:3,quad:6,quadratur:6,radian:2,rang:7,read:0,rectangl:2,residuum:6,rhd:2,right:[0,2,6],roation:2,rotat:[2,6],rotate_deg:2,rotate_xi:2,rotation_plan:2,rule:6,rung:6,rvd:2,rvert:6,same:0,sampl:2,sample_point1_x:2,sample_point2_i:2,sample_point2_x:2,sample_points1_i:2,save_valu:6,scale_i:2,scale_x:2,sche:6,search:4,second:[0,2,6,7],seconds_norm:7,segment:6,seq:0,sequenc:0,set:6,should:2,side:6,sigma:6,simpson:6,simpsonregel:6,size:[0,2,6],slope:2,solid:2,solut:6,solv:6,solver:6,sonnenschaltung:1,sonntag:1,sourc:[0,1,2,3,6,7],space:6,spacial:1,special:6,specifi:6,sqrt:6,squar:[2,6],stabl:6,standard:6,start:[0,2],step:[0,6],stop:0,store:0,str:0,straight:2,string:2,struct_tim:7,structur:0,subinterv:6,submodul:5,sum:6,sundai:1,system:[2,6],t_0:6,t_i:6,tabl:2,tagen:1,term:0,text:6,than:[0,2],therefor:6,thi:2,thick:6,thoma:6,ti1:6,time:[6,7],time_norm:7,time_of_dai:5,tol:6,toler:6,top:2,torqu:6,transform:7,translat:2,translate_xi:2,trapez:6,trapezium:6,trapezoid:6,trapezregel:6,tupl:[0,2,6],two:[0,2,6],type:[0,1,2,6,7],uid:0,uniqu:0,unique_end:0,upper:[0,6],used:6,using:[3,6],usw:1,valu:[6,7],varepsilon:6,variabl:[1,6],varianc:6,vec:2,vector:2,veloc:6,verbos:[0,6],verfahren:6,vert_0:6,vert_a:6,vertcal:2,vertic:[2,6],vollmond:1,von:1,what:2,where:6,which:6,width:[2,6],wiki:1,wikipedia:1,wise:2,write:0,x_0:6,x_1:[2,6],x_2:[2,6],x_column:0,x_fit:6,x_i:6,x_n:6,xp0:6,xpn:6,xpp0:6,xppn:6,y_1:2,y_2:2,y_column:0,y_fit:6,year:[1,7]},titles:["data module","date module","geometry module","geometry_plot module","Welcome to pylib\u2019s documentation!","pylib","numerical package","time_of_day module"],titleterms:{content:6,data:0,date:1,document:4,fit:6,geometri:2,geometry_plot:3,indic:4,integr:6,modul:[0,1,2,3,6,7],numer:6,ode:6,ode_model:6,packag:6,pylib:[4,5],submodul:6,tabl:4,time_of_dai:7,welcom:4}})
\ No newline at end of file
+Search.setIndex({docnames:["data","date","function","geometry","geometry_plot","index","modules","numerical","time_of_day"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["data.rst","date.rst","function.rst","geometry.rst","geometry_plot.rst","index.rst","modules.rst","numerical.rst","time_of_day.rst"],objects:{"":{"function":[2,0,0,"-"],data:[0,0,0,"-"],date:[1,0,0,"-"],fit:[7,0,0,"-"],geometry:[3,0,0,"-"],geometry_plot:[4,0,0,"-"],integration:[7,0,0,"-"],numerical:[7,0,0,"-"],ode:[7,0,0,"-"],ode_model:[7,0,0,"-"],time_of_day:[8,0,0,"-"]},"function":{cosine_wave:[2,1,1,""],sine_wave:[2,1,1,""]},"numerical.fit":{gauss:[7,1,1,""],gauss_fit:[7,1,1,""]},"numerical.integration":{trapez:[7,1,1,""]},"numerical.ode":{e1:[7,1,1,""],e2:[7,1,1,""],e4:[7,1,1,""],fpi:[7,1,1,""],i1:[7,1,1,""],newmark_newtonraphson:[7,1,1,""],newmark_newtonraphson_rdk:[7,1,1,""]},"numerical.ode_model":{disk:[7,1,1,""],disk_nm:[7,1,1,""],disk_nmmdk:[7,1,1,""]},data:{fold_list:[0,1,1,""],get_id:[0,1,1,""],load:[0,1,1,""],read:[0,1,1,""],seq:[0,1,1,""],store:[0,1,1,""],unique_ending:[0,1,1,""],write:[0,1,1,""]},date:{"gau\u00dfsche_osterformel":[1,1,1,""],ascension_of_jesus:[1,1,1,""],easter_friday:[1,1,1,""],easter_monday:[1,1,1,""],easter_sunday:[1,1,1,""],pentecost:[1,1,1,""]},geometry:{angle:[3,1,1,""],cubic:[3,1,1,""],cubic_deg:[3,1,1,""],cubics:[3,1,1,""],distance:[3,1,1,""],interpolate_hermite:[3,1,1,""],line:[3,1,1,""],lines:[3,1,1,""],rectangle:[3,1,1,""],rotate:[3,1,1,""],rotate_deg:[3,1,1,""],rotate_xy:[3,1,1,""],square:[3,1,1,""],translate:[3,1,1,""],translate_xy:[3,1,1,""]},geometry_plot:{plot_cubic_lines:[4,1,1,""],plot_lines:[4,1,1,""]},numerical:{fit:[7,0,0,"-"],integration:[7,0,0,"-"],ode:[7,0,0,"-"],ode_model:[7,0,0,"-"]},time_of_day:{days:[8,1,1,""],days_norm:[8,1,1,""],hours:[8,1,1,""],hours_norm:[8,1,1,""],in_seconds:[8,1,1,""],minutes:[8,1,1,""],minutes_norm:[8,1,1,""],seconds:[8,1,1,""],seconds_norm:[8,1,1,""],transform:[8,1,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:function"},terms:{"1st":7,"2\u03c0f":2,"2nd":7,"4th":7,"9fsche_osterformel":1,"\u03bb":2,"\u03bd":2,"\u03c0":2,"\u03c6":2,"\u03c9":2,"boolean":2,"case":7,"char":0,"default":[0,3,7,8],"f\u00fcr":1,"float":[0,2,3,7,8],"fr\u00fchling":1,"function":[6,7],"gau\u00dfsch":1,"gau\u00dfsche_osterformel":1,"int":[0,1,2,3,7],"korrekturgr\u00f6\u00df":1,"m\u00e4rz":1,"m\u00e4rzdatum":1,"new":8,"return":[0,1,3,7,8],"s\u00e4kular":1,"s\u00e4kularzahl":1,"switch":2,"true":2,"vorw\u00e4rt":7,Das:1,The:[0,2,3,7,8],absolut:3,addit:3,against:7,algorithmu:1,als:1,also:2,amplitud:[2,7],analyt:7,angl:3,angle1:3,angle2:3,angular:2,approx:7,approxim:7,april:1,area:7,argument:[2,3],arithmet:0,around:3,arrai:0,ascens:1,ascension_of_jesu:1,ascii:0,assum:3,averag:8,backward:7,base:7,becaus:2,becom:7,begin:7,beta:7,between:[0,2,3],binari:0,bmatrix:7,bool:[0,7],bottom:3,bound:0,boundari:3,build:3,calcul:[1,7,8],call:2,cauchi:7,cdot:7,center:[2,3],chang:[2,3],characterist:2,choos:7,close:0,column:0,common:0,composit:7,condit:[3,7],consecut:0,constant:0,content:6,convert:[0,8],coordin:3,cos:2,cosin:2,cosine_wav:2,cosine_wave_degre:[],counterclockwis:3,creat:0,cubic:3,cubic_deg:3,curv:2,cycl:2,dai:[1,8],data:[6,7],date:[0,2,3,4,6,7,8],datetim:1,datum:1,days_norm:8,ddot:7,decid:3,defin:3,definit:7,deflect:3,deform:3,degener:0,degre:[2,3],den:1,der:1,derform:3,deriv:7,des:1,describ:[2,7],deviat:[2,7],diamet:7,die:1,differ:[0,7],differenti:7,dimens:2,dimension:0,dimenson:0,direct:3,disk:7,disk_nm:7,disk_nmmdk:7,displac:[3,7],distanc:3,distribut:7,divid:7,doe:3,dot:7,each:[2,3],easter:1,easter_fridai:1,easter_mondai:1,easter_sundai:1,eccentr:7,edg:3,either:3,element:[0,3],empti:0,emptyset:0,end:[0,3,7],endpoint:3,entfernung:1,equal:7,equalii:7,equat:7,error:7,ersten:1,euler:7,everi:7,exampl:[3,7],expect:7,explicit:7,explizit:7,f_n:7,factor:3,fail:0,fals:[0,2,7],fassregel:7,file:0,file_nam:0,filenam:0,first:[0,3,7],fit:6,fix:7,float64:7,fnm:7,fold_list:0,follow:0,foral:7,forward:7,fourth:7,fpi:7,frac:[3,7],frequenc:2,fridai:1,from:[0,2,7],full:[0,7],function_cosine_wave_degre:2,function_sine_wave_degre:2,fwhm:7,gamma:7,gau:1,gauss:7,gauss_fit:7,gener:2,geometri:[4,6],geometry_plot:[3,6],get:0,get_id:0,gilt:1,given:[0,3,7],global:[3,7],global_deform:3,govern:7,gregorian:8,gregorianischen:1,half:7,has:[0,7],head:2,height:3,hermit:3,horizont:3,hour:8,hours_norm:8,http:1,ids:0,implicit:7,in_second:8,inc:3,incid:3,index:[0,3,5],index_offset:3,inform:[0,7],initi:7,integr:6,integrand:7,interpol:3,interpolate_hermit:3,interpret:[0,2],interv:7,iter:7,its:2,jahr:1,jesu:1,johann:7,kalend:1,kalendarisch:1,keim:1,kepler:7,keplersch:7,keyword:3,kutta:7,kwarg:[3,4],kx1:0,lag:2,lambda:[2,7],ldot:7,lead:2,left:[0,2,3,7],leftrightarrow:7,length:[0,3,8],leq:7,lhd:3,limit:7,limits_:7,limits_a:7,line:3,linear:2,list:[0,3,7],lns:4,load:0,local:7,lower:[0,7],lst:0,lvd:3,lvert:7,manipul:0,march:1,mathemat:2,mathmat:7,mathrm:7,matplotlib:4,max_iter:7,maximum:7,mean:7,method:7,minumum:0,minut:8,minutes_norm:8,model:7,modul:[5,6],mondai:1,mondparamet:1,mondschaltung:1,move:2,mxn:0,ndarrai:7,necessari:7,necessarili:7,newmark:7,newmark_newtonraphson:7,newmark_newtonraphson_rdk:7,node:3,non:2,none:[0,3,7],normal:8,number:[2,3,7],numer:6,numerisch:7,numpi:7,object:[0,3],object_data:0,occur:2,ode:6,ode_model:6,offset:[7,8],often:2,omega:2,one:[0,3,7],onli:0,open:0,option:3,order:[3,7],ordinari:[2,7],org:1,origin:3,oscil:2,osterentfernung:1,osterformel:1,ostergrenz:1,ostersonntag:1,other:3,otherwis:3,over:2,packag:6,page:5,paramet:[0,1,2,3,7,8],peak:2,pentecost:1,per:[2,7],period:2,phase:2,phi:2,plane:3,plot:3,plot_cubic_lin:4,plot_lin:[3,4],plotter:4,point1:3,point1_i:3,point1_x:3,point2:3,point2_i:3,point2_x:3,point3:3,point4:3,point:[3,7],point_i:3,point_x:3,points1_i:3,polygon:3,polygonzugverfahren:7,popt:7,posit:[2,7],position_norm:8,print:[3,7],problem:7,program:0,propag:2,proport:7,proportion:2,pts:3,pylab:4,quad:7,quadratur:7,radian:[2,3],rang:8,rate:2,read:0,rectangl:3,relat:2,repres:2,residuum:7,rhd:3,right:[0,2,3,7],roation:3,rotat:[3,7],rotate_deg:3,rotate_xi:3,rotation_plan:3,rule:7,rung:7,rvd:3,rvert:7,said:2,same:0,sampl:3,sample_point1_x:3,sample_point2_i:3,sample_point2_x:3,sample_points1_i:3,save_valu:7,scale_i:3,scale_x:3,sche:7,search:5,second:[0,2,3,7,8],seconds_norm:8,segment:7,seq:0,sequenc:0,set:7,shift:2,should:3,side:7,sigma:7,simpson:7,simpsonregel:7,sin:2,sine:2,sine_wav:2,sine_wave_degre:[],sinusoid:2,size:[0,3,7],slope:3,smooth:2,solid:3,solut:7,solv:7,solver:7,sonnenschaltung:1,sonntag:1,sourc:[0,1,2,3,4,7,8],space:7,spacial:1,spatial:2,special:7,specifi:[2,7],speed:2,sqrt:7,squar:[3,7],stabl:7,standard:7,start:[0,2,3],step:[0,7],stop:0,store:0,str:0,straight:3,string:3,struct_tim:8,structur:0,subinterv:7,submodul:6,sum:7,sundai:1,system:[3,7],t_0:7,t_i:7,tabl:3,tagen:1,term:0,text:7,than:[0,3],therefor:7,thi:[2,3],thick:7,thoma:7,ti1:7,time:[2,7,8],time_norm:8,time_of_dai:6,tol:7,toler:7,top:3,torqu:7,transform:8,translat:3,translate_xi:3,trapez:7,trapezium:7,trapezoid:7,trapezregel:7,tupl:[0,3,7],two:[0,3,7],type:[0,1,3,7,8],uid:0,uniqu:0,unique_end:0,unit:2,upper:[0,7],used:7,using:[4,7],usw:1,valu:[7,8],varepsilon:7,variabl:[1,2,7],varianc:7,varphi:2,vec:3,vector:3,veloc:7,verbos:[0,7],verfahren:7,vert_0:7,vert_a:7,vertcal:3,vertic:[3,7],vollmond:1,von:1,wave:2,wavelength:2,wavenumb:2,what:3,where:[2,7],which:[2,7],width:[3,7],wiki:1,wikipedia:1,wise:3,write:0,x_0:7,x_1:[3,7],x_2:[3,7],x_column:0,x_fit:7,x_i:7,x_n:7,xp0:7,xpn:7,xpp0:7,xppn:7,y_1:3,y_2:3,y_column:0,y_fit:7,year:[1,8],zero:2},titles:["data module","date module","function module","geometry module","geometry_plot module","Welcome to pylib\u2019s documentation!","pylib","numerical package","time_of_day module"],titleterms:{"function":2,content:7,data:0,date:1,document:5,fit:7,geometri:3,geometry_plot:4,indic:5,integr:7,modul:[0,1,2,3,4,7,8],numer:7,ode:7,ode_model:7,packag:7,pylib:[5,6],submodul:7,tabl:5,time_of_dai:8,welcom:5}})
\ No newline at end of file
diff --git a/docs/source/function.rst b/docs/source/function.rst
new file mode 100644
index 0000000..0e0123f
--- /dev/null
+++ b/docs/source/function.rst
@@ -0,0 +1,7 @@
+function module
+===============
+
+.. automodule:: function
+ :members:
+ :undoc-members:
+ :show-inheritance:
diff --git a/docs/source/modules.rst b/docs/source/modules.rst
index cc2cd40..31ce243 100644
--- a/docs/source/modules.rst
+++ b/docs/source/modules.rst
@@ -6,6 +6,7 @@ pylib
data
date
+ function
geometry
geometry_plot
numerical
diff --git a/pylib/function.py b/pylib/function.py
new file mode 100644
index 0000000..343c240
--- /dev/null
+++ b/pylib/function.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""Mathematical functions.
+
+:Date: 2019-10-27
+
+.. module:: function
+ :platform: *nix, Windows
+ :synopsis: Mathematical functions.
+
+.. moduleauthor:: Daniel Weschke
+"""
+import math
+
+def sine_wave(A=1, k=1, f=1, phi=0, D=0, degree=False):
+ r"""A sine wave or sinusoid is a mathematical curve that describes a
+ smooth periodic oscillation.
+
+ :param A: amplitude
+ :type A: float or int
+ :param k: (angular) wave number
+ :type k: float or int
+ :param f: ordinary frequency
+ :type f: float or int
+ :param phi: phase
+ :type phi: float or int
+ :param D: non-zero center amplitude
+ :type D: float or int
+ :param degree: boolean to switch between radians and degree. If
+ False phi is interpreted in radians and if True then phi is
+ interpreted in degrees.
+
+ In general, the function is:
+
+ .. math::
+ y(x,t) = A\sin(kx + 2\pi f t + \varphi) + D \\
+ y(x,t) = A\sin(kx + \omega t + \varphi) + D
+
+ where:
+
+ * A, amplitude, the peak deviation of the function from zero.
+ * f, ordinary frequency, the number of oscillations (cycles) that
+ occur each second of time.
+ * ω = 2πf, angular frequency, the rate of change of the function
+ argument in units of radians per second. If ω < 0 the wave is
+ moving to the right, if ω > 0 the wave is moving to the left.
+ * φ, phase, specifies (in radians) where in its cycle the
+ oscillation is at t = 0.
+ * x, spatial variable that represents the position on the
+ dimension on which the wave propagates.
+ * k, characteristic parameter called wave number (or angular wave
+ number), which represents the proportionality between the
+ angular frequency ω and the linear speed (speed of propagation)
+ ν.
+ * D, non-zero center amplitude.
+
+ The wavenumber is related to the angular frequency by:
+
+ .. math::
+ k={\omega \over v}={2\pi f \over v}={2\pi \over \lambda }
+
+ where λ (lambda) is the wavelength, f is the frequency, and v is the
+ linear speed.
+
+ .. seealso::
+ :meth:`function_cosine_wave_degree`
+ """
+ if degree:
+ phi = math.radians(phi)
+ return lambda x, t=0: A*math.sin(k*x + 2*math.pi*f*t + phi) + D
+
+def cosine_wave(A=1, k=1, f=1, phi=0, D=0, degree=False):
+ r"""A cosine wave is said to be sinusoidal, because,
+ :math:`\cos(x) = \sin(x + \pi/2)`, which is also a sine wave with a
+ phase-shift of π/2 radians. Because of this head start, it is often
+ said that the cosine function leads the sine function or the sine
+ lags the cosine.
+
+ :param A: amplitude
+ :type A: float or int
+ :param k: (angular) wave number
+ :type k: float or int
+ :param f: ordinary frequency
+ :type f: float or int
+ :param phi: phase
+ :type phi: float or int
+ :param D: non-zero center amplitude
+ :type D: float or int
+ :param degree: boolean to switch between radians and degree. If
+ False phi is interpreted in radians and if True then phi is
+ interpreted in degrees.
+
+ .. seealso::
+ :meth:`function_sine_wave_degree`
+ """
+ if degree:
+ phi = phi + 90
+ else:
+ phi = phi + math.pi/2
+ return sine_wave(A=A, k=k, f=f, phi=phi, D=D, degree=degree)
diff --git a/pylib/numerical/fit.py b/pylib/numerical/fit.py
index 40304d7..7b9d66a 100644
--- a/pylib/numerical/fit.py
+++ b/pylib/numerical/fit.py
@@ -2,6 +2,8 @@
# -*- coding: utf-8 -*-
"""Function and approximation.
+:Date: 2019-10-15
+
.. module:: fit
:platform: *nix, Windows
:synopsis: Function and approximation.
@@ -22,7 +24,7 @@ def gauss(x, *p):
:type x: int or float or list or numpy.ndarray
:param p: gauss parameters [a, b, c, d]:
- * a -- amplitude (:math:`\int y \\,\\mathrm{d}x=1 \Leftrightarrow a=1/(c\\sqrt{2\\pi})` )
+ * a -- amplitude (:math:`\\int y \\,\\mathrm{d}x=1 \\Leftrightarrow a=1/(c\\sqrt{2\\pi})` )
* b -- expected value :math:`\\mu` (position of maximum, default = 0)
* c -- standard deviation :math:`\\sigma` (variance :math:`\\sigma^2=c^2`)
* d -- vertical offset (default = 0)
@@ -92,4 +94,4 @@ def gauss_fit(x, y, e=None, x_fit=None, verbose=False):
return y_fit, popt, FWHM
if __name__ == "__main__":
- True
+ pass
diff --git a/pylib/numerical/integration.py b/pylib/numerical/integration.py
index b7a768a..eefe983 100644
--- a/pylib/numerical/integration.py
+++ b/pylib/numerical/integration.py
@@ -16,7 +16,7 @@ from __future__ import division
from numpy import linspace, trapz, zeros
def trapez(f, a=0, b=1, N=10, x=None, verbose=False,
- save_values=False):
+ save_values=False):
r"""
Integration of :math:`f(x)` using the trapezoidal rule
(Simpson's rule, Kepler's rule).
@@ -87,14 +87,14 @@ def trapez(f, a=0, b=1, N=10, x=None, verbose=False,
f(x) &= x^2 \\
a &= 0 \\
b &= 1
-
+
analytical solution
.. math::
I = \int\limits_{0}^{1} x^2 \,\mathrm{d}x
= \left. \frac{1}{3} x^3 \right\vert_0^1
= \frac{1}{3}
-
+
numerical solution
>>> f = lambda(x): x**2
@@ -107,30 +107,30 @@ def trapez(f, a=0, b=1, N=10, x=None, verbose=False,
"""
N = int(N)
# f is function or list
- if hasattr(f, '__call__'):
- # h width of each subinterval
- h = (b-a)/N
+ if callable(f):
+ # h width of each subinterval
+ h = (b-a)/N
- # x variable of integration
- x = linspace(a, b, N+1)
- if save_values:
- # ff contribution from the points
- ff = zeros((N+1))
- for n in linspace(0, N, N+1):
- ff[n] = f(x[n])
- T = (ff[0]/2.+sum(ff[1:N])+ff[N]/2.)*h
- else:
- TL = f(x[0])
- TR = f(x[N])
- TI = 0
- for n in range(1, N):
- TI = TI + f(x[n])
- T = (TL/2.+TI+TR/2.)*h
+ # x variable of integration
+ x = linspace(a, b, N+1)
+ if save_values:
+ # ff contribution from the points
+ ff = zeros((N+1))
+ for n in linspace(0, N, N+1):
+ ff[n] = f(x[n])
+ T = (ff[0]/2.+sum(ff[1:N])+ff[N]/2.)*h
+ else:
+ TL = f(x[0])
+ TR = f(x[N])
+ TI = 0
+ for n in range(1, N):
+ TI = TI + f(x[n])
+ T = (TL/2.+TI+TR/2.)*h
else:
- N = len(f)-1
- T = 0
- for n in range(N):
- T = T + (x[n+1]-x[n])/2*(f[n+1]+f[n])
+ N = len(f)-1
+ T = 0
+ for n in range(N):
+ T = T + (x[n+1]-x[n])/2*(f[n+1]+f[n])
if verbose:
print(T)
@@ -143,9 +143,9 @@ if __name__ == '__main__':
trapez(func, 0, 1, 1e6, verbose=True)
#print(trapz(func, linspace(0,1,10)))
- trapez([0,1,4,9], x=[0,1,2,3], verbose=True)
+ trapez([0, 1, 4, 9], x=[0, 1, 2, 3], verbose=True)
#print(trapz([0,1,4,9]))
- trapez([2,2], x=[-1,1], verbose=True)
+ trapez([2, 2], x=[-1, 1], verbose=True)
- trapez([-1,1,1,-1], x=[-1,-1,1,1], verbose=True)
+ trapez([-1, 1, 1, -1], x=[-1, -1, 1, 1], verbose=True)