首页 > 其他分享 >8.4 (学号:3025)

8.4 (学号:3025)

时间:2024-11-18 16:58:55浏览次数:1  
标签:plt 8.4 3025 ax fig rcParams import tt

import numpy as np
import pandas as pd
import sympy as sp
sp.init_printing(use_latex=True)
from scipy.integrate import odeint
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['Times New Roman + SimSun + WFM Sans SC']
plt.rcParams['mathtext.fontset']='stix'

Times New Roman + SimSun + WFM Sans SC

simsum宋体, times new roman -*, simhei黑体, kaiti楷体,

dengxian等线, fangsong仿宋, Microsoft Yahei微软雅黑

plt.rcParams['axes.unicode_minus']=False
plt.rcParams['figure.dpi'] = 200

plt.rcParams['figure.figsize'] = [4, 3]

plt.rcParams['font.size'] = 12

plt.rcParams['xtick.direction']='in'
plt.rcParams['ytick.direction']='in'
def rhs(f, t):
x, y = f
return [
-x3 - y,
x - y
3,
]
tt = np.linspace(0, 30, 301)
ns = odeint(rhs, [1, 0.5], tt)
xx, yy = ns[:,0], ns[:,1]

fig = plt.figure(figsize=(6,3))
ax = fig.add_subplot(121)
ax.plot(tt, xx, label='$x(t)$')
ax.plot(tt, yy, label='$y(t)$')
ax.legend()

ax1 = fig.add_subplot(122)
ax1.plot(xx, yy)

fig.show()

标签:plt,8.4,3025,ax,fig,rcParams,import,tt
From: https://www.cnblogs.com/tjs200461/p/18553109

相关文章

  • 8.4 8.5
    8.4点击查看代码importnumpyasnpimportmatplotlib.pyplotaspltfromscipy.integrateimportsolve_ivpdefsystem(t,state):x,y=statedxdt=-x*3-ydydt=x-y*3return[dxdt,dydt]t_span=(0,30)y0=[1,0.5]sol=solve_ivp(......
  • 习题8.4
    1.代码实现点击查看代码importnumpyasnpfromscipy.integrateimportodeintimportmatplotlib.pyplotasplt#定义微分方程组defsystem(state,t):x,y=statedxdt=-x**3-ydydt=x-y**3return[dxdt,dydt]#初始条件x0=1y......
  • 数学建模习题8.4
    `importnumpyasnpimportmatplotlib.pyplotaspltfromscipy.integrateimportsolve_ivp定义微分方程系统defsystem(t,state):x,y=statedxdt=-x-ydydt=x-y**3return[dxdt,dydt]定义时间跨度和初始条件t_span=(0,30)y0=[1,0.5]解微分方程so......
  • 8.4
    importnumpyasnpfromscipy.integrateimportsolve_ivpimportmatplotlib.pyplotaspltdefdifferential_equations(t,z):x,y=zdx_dt=-x**3-ydy_dt=x-y**3return[dx_dt,dy_dt]z0=[1,0.5]t_span=(0,30)sol=solve_ivp(differential_eq......
  • 详解连接 MySQL8.4 出现 Client does not support authentication protocol requested
    文章目录项目场景问题描述原因分析解决方案方案一(不推荐)方案二(推荐)总结项目场景在开发过程中,我们在Node.js项目中使用MySQL数据库,并且通过typeorm和mysql库进行数据库连接。然而,在项目启动时,遇到了数据库连接失败的问题,导致项目无法正常运行。问题描述......
  • 8.4
    importnumpyasnpimportpandasaspdimportsympyasspsp.init_printing(use_latex=True)fromscipy.integrateimportodeintimportmatplotlib.pyplotaspltplt.rcParams['font.sans-serif']=['TimesNewRoman+SimSun+WFMSansSC']pl......
  • 8.4 求微分方程组的数值解 x'=-x^3-y,x(0)=1,y'=x-y^3,y(0)=0.5,0<=t<=30,要求画出x(t)和
    importnumpyasnpimportmatplotlib.pyplotaspltfromscipy.integrateimportsolve_ivpdefsystem(t,state):x,y=statedxdt=-x3-ydydt=x-y3return[dxdt,dydt]t_span=(0,30)y0=[1,0.5]sol=solve_ivp(system,t_span,y0,t_eval=np.linsp......
  • 基于Centos7.X部署mysql8.4集群(主备)
    1、目标    将在主库的数据变更同步到从库,从而保证主库和从库的数据一致。2、原理    2.1主库会把数据变更记录在二进制日志文件Binlog中    2.2从库连接主库,读取binlog日志,并写入自身中继日志relaylog    2.3slave重做中继日志,将改变......
  • mysql 8.4 主从复制
    master节点my.cnfserver-id=1log-bin=mysql-binbinlog-do-db=repl#需要同步的数据库,如果没有本行表示同步所有的数据库binlog-ignore-db=mysql创建复制用户CREATEUSER'repluser'@'192.168.4.222'IDENTIFIEDWITHcaching_sha2_passwordBYRANDOMPASSWORD;+----—......
  • ubuntu 24.04 部署 mysql 8.4.3 LTS
    安装依赖apt-yinstalllibaio1t64ln-sv/usr/lib/x86_64-linux-gnu/libaio.so.1t64.0.2/usr/lib/x86_64-linux-gnu/libaio.so.1创建用户groupadd-g28-o-rmysql&&useradd-M-N-gmysql-o-r-d/data/mysql-s/bin/false-c"MySQLServer"-u28......