自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(38)
  • 资源 (5)
  • 收藏
  • 关注

原创 python scipy.optimize curve_fit拟合非线性函数

# -*- coding: utf-8 -*-"""Created on Wed Dec 1 23:27:21 2021@author: Machi"""import matplotlib.pyplot as pltimport numpy as npfrom scipy.optimize import curve_fitimport seaborn as snssns.set(color_codes=True)np.random.seed(20211201)e = np.r

2021-12-01 23:36:34 533

原创 python scipy.optimize least_squares实现最小二乘法

Least-squares minimization (least_squares)The code below implements least-squares estimation of and finally plots the original data and the fitted model function:X

2021-12-04 22:56:52 122

原创 R语言时间序列分析(AR模型)

先用R一键导入数据(需要数据的私信我)第一步画出时序图,进行平稳性检验和纯随机性检验x<-ts(data$x,start = c(1900),frequency = 1)#生成时间序列plot(x,type = 'o')#画时序图adf.test(x)b = Box.test(x,lag = 6,type = "Ljung-Box")c = Box.test(x,lag = 12,type = "Ljung-Box")ADF检验Augmented Dickey-Fuller Test

2021-11-27 21:51:05 36

原创 用python进行时间序列分析

import pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport seaborn as sns from statsmodels.graphics.tsaplots import plot_acf from statsmodels.tsa.stattools import adfuller as ADF from statsmodels.graphics.tsaplots import plot_pa

2021-11-20 11:33:06 1000

原创 用python画散点图

# -*- coding: utf-8 -*-"""Created on Tue Nov 16 20:38:41 2021@author: Machi"""import numpy as npimport matplotlib.pyplot as plt# Fixing random state for reproducibility%config InlineBackend.figure_format = 'retina'np.random.seed(19680801)N =

2021-11-16 20:41:12 587

原创 利用python,使用直方图绘制累积分布图

import numpy as npimport matplotlib.pyplot as plt%config InlineBackend.figure_format = 'retina'np.random.seed(190801)mu = 200sigma = 25n_bins = 50x = np.random.normal(mu, sigma, size=100)fig, ax = plt.subplots(figsize=(8, 4))# plot the cumulat

2021-11-16 20:34:34 45

原创 用python进行方差分析(简单版)

from scipy.stats import f_onewayimport numpy as npx = np.random.normal(10, 5, 20)y = np.random.normal(10, 5, 20)result = f_oneway(x,y)print(result)F_onewayResult(statistic=0.05215619706951725, pvalue=0.8205774635543236)

2021-11-16 12:52:37 701

原创 利用python的matplotlib库进行简单的绘图

# -*- coding: utf-8 -*-"""Created on Mon Nov 15 21:19:53 2021@author: Machi"""import matplotlib.pyplot as pltimport numpy as np%config InlineBackend.figure_format = 'retina'x = np.linspace(0, 2, 100)# Note that even in the OO-style, we use `.py

2021-11-15 21:30:28 558

原创 用python进行方差分析

# -*- coding: utf-8 -*-"""Created on Sun Nov 14 11:09:44 2021@author: Machi"""import numpy as npimport pandas as pdimport seaborn as snsimport matplotlib.pyplot as pltfrom statsmodels.formula.api import olsfrom statsmodels.stats.anova import an

2021-11-14 12:52:15 373

原创 用r语言进行方差分析

a = rnorm(200)b = rnorm(200)table = data.frame( x = c(a), y = c(b) )aov.manu <- aov(y ~ x, data=table)summary(aov.manu)

2021-11-14 00:08:56 301

原创 用python实现牛顿法,求解非线性方程的解

# -*- coding: utf-8 -*-"""Created on Sat Nov 13 09:29:27 2021@author: Machi"""import sympy as spx = sp.symbols('x')def f(x): return x**3 - xdef df_value(x,x_value): dy = sp.diff(f(x),x) y_value = float(dy.evalf(

2021-11-13 10:25:10 512

原创 r语言拟合MA模型,及时序图,自相关图,偏自相关图

e<-rnorm(100)x1<-filter(e,filter = c(1,-0.5),method = "convolution",circular = T)plot(x1)acf(x1)pacf(x1)

2021-11-11 22:52:06 347

原创 用python求导

# -*- coding: utf-8 -*-"""Created on Mon Nov 8 21:36:35 2021@author: Machi"""import sympy as spx, y, z = sp.symbols('x y z')func = z * sp.sin(2 * sp.pi ** x + x ** y / 5)func_x = sp.diff(func, x)func_y = sp.diff(func, y)func_z = sp.diff(func,

2021-11-08 21:41:33 500

原创 用python求cdf和分位数

# -*- coding: utf-8 -*-"""Created on Fri Nov 5 21:44:19 2021@author: Machi"""from scipy.stats import normq = norm.cdf(0,0,1) print(q)print(norm.ppf(q,0,1)) 0.50.0

2021-11-05 21:47:31 463

原创 正态性检验(偏度和峰度)python

# -*- coding: utf-8 -*-"""Created on Mon Nov 1 20:20:05 2021@author: 86158"""import numpy as npfrom scipy.stats import normaltestv = np.random.normal(size=100)print(normaltest(v))结果:NormaltestResult(statistic=0.2786470828038562, pvalue=0.86

2021-11-01 20:26:03 61

原创 用python求方程的解

# -*- coding: utf-8 -*-"""Created on Mon Nov 1 20:20:05 2021@author: Machi"""from scipy.optimize import rootfrom math import cosdef f(x): return x + cos(x+4)myroot = root(f, 0)print(myroot.x)# 查看更多信息print(myroot)[0.35232971]fjac: array

2021-11-01 20:23:21 32

原创 Python 输出指定范围内的素数

# -*- coding: utf-8 -*-"""Created on Sun Oct 31 22:56:48 2021@author: Machi"""# take input from the userlower = int(input("输入区间最小值: "))upper = int(input("输入区间最大值: "))for num in range(lower,upper + 1): # 素数大于 1 if num > 1: for i in range(2

2021-10-31 22:59:35 34

原创 用python实现牛顿-柯特斯公式

import numpy as npimport mathfrom scipy import integratedef f(x): return math.exp(-x**2)def g(x): return math.exp(-x**2)def func(a,b,n,g): x = np.linspace(a,b,n+1) sum = 0 h =(b-a)/n for i in range(n):

2021-10-30 13:59:36 95

原创 python求行列式的值

# -*- coding: utf-8 -*-"""Created on Thu Oct 28 16:36:24 2021@author: 86158"""import numpy as npfrom scipy import linalgarr = np.array([[2, 2],[3, 4]])print(arr)a = linalg.det(arr)print(a)输出[[2 2][3 4]]2.0

2021-10-28 16:41:40 48

原创 python安装 和更新所有包的方法

#Install a packagepip install xxxx#View information about installed packagespip list#View packages that can be updatedpip --outdate#The command for pip to update a single package is as followspip install --upgrade xxxxx#Use another plug-in to u

2021-10-28 11:15:04 28

原创 用python计算定积分

# -*- coding: utf-8 -*-"""Created on Tue Oct 26 20:43:46 2021@author: Machi"""from sympy import *x = symbols('x')a = integrate(x**2,(x,0,1))print(a)1/3

2021-10-26 21:09:47 58

原创 用python求积分

from scipy import integratedef f(x): return xvalue, error = integrate.quad(f,-0, 1)print (value,error)0.5 5.551115123125783e-15

2021-10-26 20:58:37 32

原创 用python对数据进行正态性检验(Q-Q检验,KS检验,W检验,偏峰检验)

# -*- coding: utf-8 -*-"""Created on Fri Oct 22 18:07:52 2021@author: Machi"""import numpy as npfrom scipy import statsimport matplotlib.pyplot as pltimport seaborn as snsimport statsmodels.api as sm#Used to display Chinese labelsplt.rcParams

2021-10-22 18:31:36 66

原创 用python画概率分布图

# -*- coding: utf-8 -*-"""Created on Thu Oct 21 10:07:55 2021@author: Machi"""import pandas as pdimport seaborn as snsdf = pd.read_csv('BSdata.csv')sns.distplot(df['身高'],kde = True, bins = 20,rug = True)

2021-10-21 10:16:10 168

原创 用python绘制椭圆图

# -*- coding: utf-8 -*-"""Created on Wed Oct 20 21:16:48 2021@author: 86158"""import numpy as npimport mathimport matplotlib.pyplot as plt%config InlineBackend.figure_format = 'retina't = np.linspace(0, 2*math.pi)x = 2*np.sin(t)y = 3*np.cos(

2021-10-20 21:30:24 46

原创 R 数据框Data frame

Data frame can be understood as what we often call “table”.Data frame is the data structure of R language and a special two-dimensional list.Each column of the data frame has a unique column name with equal length. The data types of the same column need

2021-10-16 13:21:28 19

原创 用python创建一个DataFrame

Dataframe is one of the important data structures of pandas and one of the most commonly used structures in the process of using pandas for data analysis. It can be said that if you master the usage of dataframe, you will have the basic ability to learn da

2021-10-16 09:55:29 32

原创 用python处理csv文件的重复值

原始数据# -*- coding: utf-8 -*-"""Created on Thu Oct 14 22:09:50 2021@author: Machi"""import pandas as pddf = pd.read_csv('data.csv')df1 = df['x'].drop_duplicates()print(df)print()print(df1)运行结果

2021-10-14 22:18:16 72

原创 用r语言拟合平稳AR序列,并画出自相关图

Autoregressive model is a statistical method to deal with time series. It uses the same variable, such as the previous periods of X, that is, X1 to xt-1, to predict the performance of XT in this period, and assumes that they are a linear relationship.

2021-10-14 19:41:10 100

原创 用R语言生成服从正态分布的随机数,并画出直方图。

用R语言生成服从正态分布的随机数,并画出直方图。set.seed(567)x<-rnorm(1000000,0,1)hist(x)效果图

2021-10-14 10:16:33 931

原创 使用pandas库生成序列(Series)

# -*- coding: utf-8 -*-"""Created on Tue Oct 5 16:55:28 2021@author: Machi"""import pandas as pda = [1, 2, 3,5,7,3,4]aser = pd.Series(a)print(aser)print(aser[1])输出

2021-10-05 17:02:51 40

原创 用python进行多元线性回归,对数据进行中心化和标准化

原始数据# -*- coding: utf-8 -*-"""Created on Tue Oct 5 10:06:41 2021@author: Machi"""import pandas as pdimport statsmodels.formula.api as smfimport matplotlib.pyplot as pltfrom mpl_toolkits.mplot3d import Axes3Dfrom statsmodels.stats.api import an

2021-10-05 11:51:00 101

原创 用python计算方差,标准差和百分位数

方差是在概率论和统计方差衡量随机变量或一组数据时离散程度的度量。概率论中方差用来度量随机变量和其数学期望(即均值)之间的偏离程度。 标准差(Standard Deviation) ,是离均差平方的算术平均数(即:方差)的算术平方根,用σ表示。标准差也被称为标准偏差,或者实验标准差,在概率统计中最常使用作为统计分布程度上的测量依据。 百分位数,统计学术语,如果将一组数据从小到大排序,并计算相应的累计百分位,则某一百分位所对应数据的值就称为这一百分位的百分位数。可表示为:一组n个观测值按数值大...

2021-09-27 22:09:32 98

原创 用python计算平均数,中位数和众数

# -*- coding: utf-8 -*-"""Created on Sun Sep 26 22:06:52 2021@author: Machi"""import numpy as nyfrom scipy import statsx = [9,8,8,8,11,8,10,8,9,7,7,8,]#Calculate the average of the X listx_mean = ny.mean(x)#Use the function to find the media

2021-09-26 22:48:10 46

原创 用r语言画时序图和自相关图,并检验纯随机性

p<-ts(data$水位,start=c(1860),frequency=1)#Draw a sequence diagramplot(p,type = "o")#Draw autocorrelation diagramacf(p,lag.max = 25)#Check whether the sequence is a pure random sequenceBox.test(p,lag = 12,type = "Ljung-Box")效果图运行结果Box-Ljun

2021-09-25 09:11:13 462

原创 用python画散点图,建立一元线性回归模型。

原始数据xy15330203452536530405354454045045455import pandas as pdimport matplotlib.pyplot as pltimport statsmodels.formula.api as smf#read filedf = pd.read_csv('2.csv')print(df)#Draw a scatter diagramplt.figure(fi

2021-09-24 15:12:16 216

原创 用python读入csv文件

读入两列数据# -*- coding: utf-8 -*-"""Created on Mon Sep 20 14:59:36 2021@author: Machi"""import pandas as pd# Load datadf = pd.read_csv('1.1.csv')# Print allprint(df)# Print x columnsprint(df['x'])# Print y columnsprint(df['y'])看看效果图 这是打印.

2021-09-20 15:09:14 478

原创 用python计算排列组合数

使用scipy.special库即可# -*- coding: utf-8 -*-"""Created on Mon Sep 20 14:15:22 2021@author: Machi"""import scipy.special#Calculate permutation number a=scipy.special.perm(3,2) #Calculate the number of combinationsb=scipy.special.comb(3,2)

2021-09-20 14:26:09 56

matlab_math_zh_CN.pdf

matlab_math_zh_CN.pdf

2021-12-05

Matplotlib.pdf

Matplotlib官方使用文档

2021-11-15

2020年大湾区杯粤港澳金融数学建模竞赛题目.rar

2020年大湾区杯粤港澳金融数学建模竞赛题目.rar

2021-10-15

pandas库官方使用手册

pandas库官方使用手册

2021-10-23

numpy-user官方使用手册

numpy-user官方使用手册

2021-10-23

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人 TA的粉丝

提示
确定要删除当前文章?
取消 删除