Mathjax语法总结

前端通过MathJax显示数学公式(vue+MathJax) 文章目录一、关于MathJax二、应用场景三、遇到的问题问题1(没有渲染效果)问题2(行间公式不被渲染)四、未来的方向 一、关于MathJax 官方网址:MathJax使用文档 简介:MathJax支持使用LaTeX,MathML或AsciiMath语法在网页中渲染数学公式。我们常用的语法为LaTex,比如该论坛支持的也是LaTex 。 二、应用场景     想实现在用户选择文件后能够直接在前... 阅读详情
AI摘要

本文提供了一个全面的MathJax数学公式指南,涵盖了从基本语法到特殊符号的多种应用场景,包括行内与文内公式的展示方式、希腊字母、括号、分式、根式、特殊函数等内容。

1.基本语法

1.1呈现位置

  • 行内公式:使用$…$定义,此时公式在一行内显示
  • 语句为:
    $\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t$
  • 显示为: ∑ i = 0 N ∫ a b g ( t , i ) d t \sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t ∑i=0N​∫ab​g(t,i)dt
  • 文内公式:使用$$…$$定义,此时公式居中放大显示
  • 语句为:
    $$\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t$$
  • 显示为: ∑ i = 0 N ∫ a b g ( t , i ) d t \sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t i=0∑N​∫ab​g(t,i)dt
  • 行内公式也可显示为文内公式的样子,需要在前面加上\displaystyle,如\displaystyle\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t显示为 ∑ i = 0 N ∫ a b g ( t , i ) d t \displaystyle\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t i=0∑N​∫ab​g(t,i)dt
  • 下列语句如非特殊说明均省略**$**

1.2字母与杂项

1.2.1希腊字母

显示命令显示命令
α \alpha α\alpha β \beta β\beta
γ \gamma γ\gamma δ \delta δ\delta
ϵ \epsilon ϵ\epsilon ζ \zeta ζ\zeta
η \eta η\eta θ \theta θ\theta
ι \iota ι\iota κ \kappa κ\kappa
λ \lambda λ\lambda μ \mu μ\mu
ν \nu ν\nu ξ \xi ξ\xi
π \pi π\pi ρ \rho ρ\rho
σ \sigma σ\sigma τ \tau τ\tau
υ \upsilon υ\upsilon ϕ \phi ϕ\phi
χ \chi χ\chi ψ \psi ψ\psi
ω \omega ω\omega——
  • 如果要大写希腊字母,则首字母大写即可,如\Gamma显示为 Γ \Gamma Γ
  • 如果要使希腊字母显示为斜体,则前面添加var即可,如\varGamma显示为 Γ \varGamma Γ

1.2.2字母修饰

a.上下标
  • 上标:^
  • 下标:_
  • 举例:C_n^2显示为 C n 2 C_n^2 Cn2​
b.矢量
  • 单字母向量:
  • \vec a显示为 a ⃗ \vec a a
  • \overrightarrow a显示为 a → \overrightarrow a a
  • 多字母向量:
  • \vec {ab}显示为 a b ⃗ \vec {ab} ab
  • \overrightarrow {ab}显示为 a b → \overrightarrow {ab} ab
c.特殊修饰
  • 字母上^:\hat a显示为 a ^ \hat a a^
  • 平均数(上划线):\overline a显示为 a ‾ \overline a a
  • 下划线:\underline a显示为 a ‾ \underline a a​
d.字体
  • TypeWriter:\mathtt {A}显示为
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathtt {ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Blackboard blod:\mathbb {A}显示为
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathbb {ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Sans Serif:\mathsf {A}显示为
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \mathsf {ABCDEFGHIJKLMNOPQRSTUVWXYZ} ABCDEFGHIJKLMNOPQRSTUVWXYZ
e.空格
  • 语法本身忽略空格,ab和a b都显示为 a b a b ab
  • 小空格:a\ b显示为 a   b a\ b a b
  • 4格空格:a\quad b显示为 a b a\quad b ab

1.2.3分组

  • 使用{}将同一级的括在一起,成组处理
  • 举例:x_i^2显示为 x i 2 x_i^2 xi2​,而x_{i^2}显示为 x i 2 x_{i^2} xi2​
    ###1.2.4括号
  • 小括号:(...)显示为 ( . . . ) (...) (...)
  • 中括号:[...]显示为 [ . . . ] [...] [...]
  • 大括号:\{...\}1显示为 { . . . } \{...\} {...}
  • 尖括号:\langle ... \rangle显示为 ⟨ . . . ⟩ \langle ... \rangle ⟨...⟩
  • 绝对值:\vert ... \vert显示为 ∣ . . . ∣ \vert ... \vert ∣...∣
  • 双竖线:\Vert ... \Vert显示为 ∥ . . . ∥ \Vert ... \Vert ∥...∥
  • 使用\left和\right)使符号大小与邻近的公式相适应,该语句适用于所有括号类型
  • 例如:\{\frac{(x+y)}{[\alpha+\beta]}\}显示为 { ( x + y ) [ α + β ] } \{\frac{(x+y)}{[\alpha+\beta]}\} {[α+β](x+y)​}
  • 而:\left\{\frac{(x+y)}{[\alpha+\beta]}\right\}显示为 { ( x + y ) [ α + β ] } \left\{\frac{(x+y)}{[\alpha+\beta]}\right\} {[α+β](x+y)​}

1.2.5常用数学运算符

**注:**想要表达非的概念只需前加\not,会添加删除斜线,如:\not=显示为 ̸ = \not= ̸​=,\not\in显示为 ̸ ∈ \not\in ̸​∈

a.基础符号
运算符说明应用举例命令
+加 x + y x+y x+yx+y
-减 x − y x-y x−yx-y
\times叉乘 x × y x \times y x×yx \times y
\cdot点乘 x ⋅ y x \cdot y x⋅yx \cdot y
\ast(*)星乘 x ∗ y x * y x∗yx \ast y(x * y)
\div除 x ÷ y x \div y x÷yx \div y
\pm加减 x ± y x \pm y x±yx \pm y
\mp减加 x ∓ y x \mp y x∓yx \mp y
=等于 x = y x=y x=yx=y
\leq小于等于 x ≤ y x \leq y x≤yx \leq y
\geq大于等于 x ≥ y x \geq y x≥yx \geq y
\approx约等于 x ≈ y x \approx y x≈yx \approx y
\equiv恒等于 x ≡ y x \equiv y x≡yx \equiv y
\bigodot定义运算符 x ⨀ y x \bigodot y x⨀yx \bigodot y
\bigtimes定义运算符 x ⨂ y x \bigotimes y x⨂yx \bigotimes
b.集合符号
运算符说明应用举例命令
\in属于 x ∈ y x \in y x∈yx \in y
\subset子集 x ⊂ y x \subset y x⊂yx \subset y
\subseteq真子集 x ⊆ y x \subseteq y x⊆yx \subseteq y
\supset超集 x ⊃ y x \supset y x⊃yx \supset y
\supseteq超集 x ⊇ y x \supseteq y x⊇yx \supseteq y
\varnothing空集 ∅ \varnothing ∅\varnothing
\cup并 x ∪ y x \cup y x∪yx \cup y
\cap交 x ∩ y x \cap y x∩yx \cap y
c.字母修饰
运算符说明应用举例命令
\overline平均数(上划线) a ‾ \overline a a\overline a
\underline下划线 a ‾ \underline a a​\underline a
\overbrace上大括号 a + b + c ⎵ 1.0 + d ⏞ 2.0 \overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0} a+1.0 b+c​​+d ​2.0​\overbrace{a+\underbrace{b+c}_{1.0}+d}^{2.0}
\underbrace下大括号 a + d ⎵ 3 \underbrace{a+d}_3 3 a+d​​\underbrace{a+d}_3
d.杂项
运算符说明应用举例命令
\partial偏导数 ∂ z ∂ x \frac{\partial z}{\partial x} ∂x∂z​\frac{\partial z}{\partial x}
\ldots底端对齐的省略号 1 , 2 , … , n 1,2,\ldots,n 1,2,…,n1,2,\ldots,n
\cdots中线对齐的省略号 1 , 2 , ⋯   , n 1,2,\cdots,n 1,2,⋯,n1,2,\cdots,n
\uparrow上箭头 ↑ \uparrow ↑\uparrow
\Uparrow双上箭头 ⇑ \Uparrow ⇑\Uparrow
\downarrow下箭头 ↓ \downarrow ↓\downarrow
\Downarrow双下箭头 ⇓ \Downarrow ⇓\Downarrow
\leftarrow左箭头 ← \leftarrow ←\leftarrow
\Leftarrow双左箭头 ⇐ \Leftarrow ⇐\Leftarrow
\rightarrow右箭头 → \rightarrow →\rightarrow
\Rightarrow双右箭头 ⇒ \Rightarrow ⇒\Rightarrow

1.3求和、极限与积分

1.3.1求和

  • 求和符号\sum显示为 ∑ \sum ∑
  • 举例:\sum_{i=0}^n显示为 ∑ i = 0 n \sum_{i=0}^n ∑i=0n​
  • 举例:\displaystyle\sum_{i=0}^n2显示为 ∑ i = 0 n \displaystyle\sum_{i=0}^n i=0∑n​

1.3.2极限

  • 极限符号\lim显示为 lim ⁡ \lim lim
  • 举例:\lim_{x\to\infty}显示为 lim ⁡ x → ∞ \lim_{x\to\infty} limx→∞​
  • 举例:\displaystyle\lim_{x\to\infty}显示为 lim ⁡ x → ∞ \displaystyle\lim_{x\to\infty} x→∞lim​

1.3.3积分

  • 积分符号:
命令显示
\int ∫ \int ∫
\iint ∬ \iint ∬
\iiint ∭ \iiint ∭
\oint ∮ \oint ∮
  • 举例:\int_0^\infty{fxdx}显示为 ∫ 0 ∞ f x d x \int_0^\infty{fxdx} ∫0∞​fxdx

1.4分式与根式

1.4.1分式

  • \frac{公式1}{公式2}显示为 公 式 1 公 式 2 \frac{公式1}{公式2} 公式2公式1​
  • 举例: b i 2 a i 2 \frac{b_i^2}{a_i^2} ai2​bi2​​

1.4.2根式

  • \sqrt[x]{y}显示为 y x \sqrt[x]{y} xy ​

1.5 特殊函数

  • \函数名
  • 举例:\sin x,\ln x,\log_n^2 5,\max(A,B,C)显示为 sin ⁡ x \sin x sinx, ln ⁡ x \ln x lnx, log ⁡ n 2 5 \log_n^2 5 logn2​5, max ⁡ ( A , B , C ) \max(A,B,C) max(A,B,C)

1.6特殊符号

命令显示命令显示
\infty ∞ \infty ∞\partial ∂ \partial ∂
\nabla ∇ \nabla ∇\triangle △ \triangle △
\forall ∀ \forall ∀\exists ∃ \exists ∃
\lnot ¬ \lnot ¬

1.7矩阵

1.7.1基本语法

  • 起始标记:\begin{matrix},结束标记:\end{matrix}
  • 每一行末尾标记\\,行间元素之间以&分隔
  • 举例:
$$\begin{matrix}
1&0&0\\
0&1&0\\
0&0&1\\
\end{matrix}$$

显示为:
1 0 0 0 1 0 0 0 1 \begin{matrix} 1&0&0\\ 0&1&0\\ 0&0&1\\ \end{matrix} 100​010​001​

1.7.3矩阵边框

  • 在起始、结束标记处用下列词替换matrix
类型命令矩阵边框显示效果
小括号边框pmatrix ( 1 0 0 0 1 0 0 0 1 ) \begin{pmatrix}1&0&0\\0&1&0\\0&0&1\\\end{pmatrix} ⎝⎛​100​010​001​⎠⎞​
中括号边框bmatrix [ 1 0 0 0 1 0 0 0 1 ] \begin{bmatrix}1&0&0\\0&1&0\\0&0&1\\\end{bmatrix} ⎣⎡​100​010​001​⎦⎤​
大括号边框Bmatrix { 1 0 0 0 1 0 0 0 1 } \begin{Bmatrix}1&0&0\\0&1&0\\0&0&1\\\end{Bmatrix} ⎩⎨⎧​100​010​001​⎭⎬⎫​
单竖线边框vmatrix ∣ 1 0 0 0 1 0 0 0 1 ∣ \begin{vmatrix}1&0&0\\0&1&0\\0&0&1\\\end{vmatrix} ∣∣∣∣∣∣​100​010​001​∣∣∣∣∣∣​
双竖线边框Vmatrix ∥ 1 0 0 0 1 0 0 0 1 ∥ \begin{Vmatrix}1&0&0\\0&1&0\\0&0&1\\\end{Vmatrix} ∥∥∥∥∥∥​100​010​001​∥∥∥∥∥∥​

1.7.4省略元素

  • 横省略号:\cdots
  • 竖省略号:\vdots
  • 斜省略号:\ddots
  • 举例:
$$\begin{bmatrix}
{a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\
{a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\
{\vdots}&{\vdots}&{\ddots}&{\vdots}\\
{a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\
\end{bmatrix}$$

显示为:
[ a 11 a 12 ⋯ a 1 n a 21 a 22 ⋯ a 2 n ⋮ ⋮ ⋱ ⋮ a m 1 a m 2 ⋯ a m n ] \begin{bmatrix} {a_{11}}&{a_{12}}&{\cdots}&{a_{1n}}\\ {a_{21}}&{a_{22}}&{\cdots}&{a_{2n}}\\ {\vdots}&{\vdots}&{\ddots}&{\vdots}\\ {a_{m1}}&{a_{m2}}&{\cdots}&{a_{mn}}\\ \end{bmatrix} ⎣⎢⎢⎢⎡​a11​a21​⋮am1​​a12​a22​⋮am2​​⋯⋯⋱⋯​a1n​a2n​⋮amn​​⎦⎥⎥⎥⎤​

1.8阵列

  • 需要array环境:起始、结束处以{array}声明
  • 对齐方式:在{array}后以{}逐行统一声明
  • 左对齐:l;居中:c;右对齐:r
  • 竖直线:在声明对齐方式时,插入|建立竖直线
  • 插入水平线:\hline
  • 举例:
$$\begin{array}{c|lll}
{↓}&{a}&{b}&{c}\\
\hline
{R_1}&{c}&{b}&{a}\\
{R_2}&{b}&{c}&{c}\\
\end{array}$$

显示为:
↓ a b c R 1 c b a R 2 b c c \begin{array}{c|lll} {↓}&{a}&{b}&{c}\\ \hline {R_1}&{c}&{b}&{a}\\ {R_2}&{b}&{c}&{c}\\ \end{array} ↓R1​R2​​acb​bbc​cac​​

1.9方程组

  • 需要cases环境:起始、结束处以{cases}声明
  • 举例:
$$\begin{cases}
a_1x+b_1y+c_1z=d_1\\
a_2x+b_2y+c_2z=d_2\\
a_3x+b_3y+c_3z=d_3\\
\end{cases}
$$

显示为:
{ a 1 x + b 1 y + c 1 z = d 1 a 2 x + b 2 y + c 2 z = d 2 a 3 x + b 3 y + c 3 z = d 3 \begin{cases} a_1x+b_1y+c_1z=d_1\\ a_2x+b_2y+c_2z=d_2\\ a_3x+b_3y+c_3z=d_3\\ \end{cases} ⎩⎪⎨⎪⎧​a1​x+b1​y+c1​z=d1​a2​x+b2​y+c2​z=d2​a3​x+b3​y+c3​z=d3​​

参考:
Markdown之列表&MathJax
MathJax: LaTeX Basic Tutorial und Referenz (Deutsch)
基本数学公式语法(of MathJax)


  1. 这里使用转义字符,因为{}有分组的功能. ↩︎

  2. 这里的\displaystyle是为了显示成文内公式的模样. ↩︎

MathJax 基础 (1):基础语法 MathJax基础教程 阅读详情

相关推荐

MathJax和相关的Latex语法。

本文从math.stackexchange.com上名为MathJax basic tutorial and quick reference的问题翻译而来,并有所改动。主要讲述了如何使用MathJax和相关的Latex语法。 MathJax简介 MathJax是一款运行在浏览器中的开源数学符号渲染引擎,使用MathJax可以方便的在浏览器中显示数学公式,不需要使用图片。目前,MathJax可以...

ACmeinan的博客 2284

MathJax的基本使用

MathJax引擎是一个开源的JavaScript库,它允许Web开发者在网页中嵌入高质量的数学公式。通过利用Web的最新技术,MathJax引擎可以解析LaTeX、MathML和AsciiMath等数学标记语言,并将其渲染为可视化的数学公式,这些公式可以在各种浏览器和操作系统上流畅地显示。使用MathJax引擎,网页作者可以轻松地编写包含数学内容的文档,而无需担心用户的浏览器或操作系统是否能够正确显示这些数学公式。

不负光阴不负自己,不负被爱不负所爱 ​ 8625

DC-DC BUCK电路 PCB 布局布线 5 要点:以 XL4015 12V转5V 为例解析噪声控制

本文以XL4015 12V转5V降压电路为例,详细解析DC-DC BUCK电路PCB布局布线的5个关键要点,重点探讨噪声控制策略。通过功率回路最小化、热管理与接地优化、电感电容布局、反馈网络防干扰设计以及实测验证技巧,帮助工程师实现高效稳定的电源设计,显著降低输出纹波和电磁干扰。

weixin_29165725的博客 369

MathJax基本的使用方式

本文介绍了MathJax的基本使用方法,包括如何插入公式,如何使用不同的字体,如何进行分组和使用空间,希腊字母、数学符号、表格、矩阵等的使用方法。

温润如玉的博客 4758

天池长期赛:二手车价格预测(422方案分享)

本次比赛是一次很好的锻炼数据挖掘能力的入门赛,从EDA-数据清洗-特征工程-模型调参-模型融合,能够完整的学习到大数据的分析和挖掘,值得历练。

weixin_46685991的博客 1万+

MAX31865三线PT100测温实战:配置、接线与代码全解析

本文详细解析MAX31865三线PT100测温的配置、接线与代码实现。通过实战经验分享,介绍如何利用MAX31865芯片实现高精度温度测量,重点讲解三线制接法的自动误差补偿功能,并提供完整的寄存器配置、SPI通信和温度转换算法,帮助开发者快速解决工业测温中的常见问题。

ss78901的博客 757

数学公式语法(Mathjax语法)

数学公式语法、Mathjax语法

小匠的Blog 2603

ArcMap 10.7/10.8启动加载界面后闪退?可能是这个隐藏的Normal.mxt模板文件在搞鬼

本文深入分析了ArcMap 10.7/10.8启动加载界面后闪退的问题,指出Normal.mxt模板文件损坏是常见原因。提供了从定位、删除模板文件到系统级修复的完整解决方案,帮助GIS工程师快速恢复工作流程。

weixin_28523493的博客 330

MathJax语法

MathJax语法—win7本地markdown 在win7下使用MathJax行间公式无法正常显示,找了挺多资料,最终livepreview还是无法显示,只能在浏览器显示,特将该方法以及本地使用的语法做个记录,语法主要转自MathJax语法。针对本地MathJax的行间公式做了修改:$ $改为\\( \\)(本来应该是\( \),但是由于语法原因,需要使用转义符\\来表示\,因此改为\\( \...

luyaxige的博客 3615

PE启动盘结合360杀毒离线版:深度清除顽固病毒实战指南

在系统安全维护领域,离线查杀是一种在独立于宿主操作系统的环境下进行病毒扫描和清除的核心技术。其原理是通过一个预启动环境(如PE)加载杀毒软件,从而绕过可能已被感染或受保护的系统核心,直接访问和扫描磁盘文件。这项技术的核心价值在于能够彻底处理那些在正常系统运行时难以清除的深度隐藏病毒、Rootkit和驱动级木马。典型的应用场景包括应对勒索软件、顽固感染型病毒以及系统启动项被劫持等情况。本文以“PE启动盘”和“360杀毒离线版”这一经典组合为例,详细解析了从工具选型、环境部署到深度查杀策略的全流程,为系统维护人

weixin_29741447的博客 408

基于STM32设计的智能水产养殖系统(2025)_359

本设计提出并实现了一种基于STM32F103RCT6微控制器的智能水产养殖控制系统,针对传统水产养殖中人工依赖高、环境参数监测滞后、控制手段单一等问题,集成了TDS水质检测、水温检测、水位监测、自动喂食、自动充氧、换水控制与加热保温等功能。系统采用ESP8266模块实现WIFI联网,通过MQTT协议将关键数据上传至华为云物联网平台,支持Android手机APP和Windows上位机远程监测与控制。同时,系统具备本地LCD数据显示与蜂鸣器异常报警功能,支持本地按键控制操作。整套系统功能完善,响应灵敏,运行稳定

624

MathJax语法简介

MathJax是一个开源的JavaScript显示引擎,专门用于在Web页面上高质量渲染数学公式,支持LaTeX、MathML和AsciiMath等多种数学标记语言,在现代浏览器中无需插件即可实现跨平台数学公式显示。优快云也支持MathJax。优快云支持富文本和Markdown编辑方式,推荐使用Markdown编辑方式。

weixin_54978309的博客 184

玩转大语言模型——使用华为官方MindIE-Server镜像方式部署DeepSeek模型

本文将详细介绍在国产Linux系统欧拉中使用华为官方MindIE-Server镜像方式部署DeepSeek模型。一般情况下华为昇腾800I服务器可以推理DeepSeek-R1-70B,4张300I-Duo服务器可以推理DeepSeek-R1-32B。在配置中尽量贴合官方文档,包含用到的一些其他的技术细节,便于零基础入门使用。

艾醒的博客 1289

MathJax 语法与小技巧

相对比较全的MathJax小技巧及语法 Here

Lemopig的博客 287

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

python mathjax_MathJax(Markdown中的公式)的基本使用语法

本文主要介绍MathJax公式的基本语法。插入公式如果是在文本中插入公式,则用$...$。如果公式自成段落,则使用$$...$$。字体使用\mathbb或\Bbb来显示黑板粗体字,$\mathbb{NQRZ}$使用\mathbf来显示粗体字,$\mathbf {ABCDabcd}$使用\mathtt来显示打印式字体,$\mathtt{ABCDabcd}$使用\mathrm来显示罗马字体,$\mat...

weixin_39529302的博客 835

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

MathJax基本语法(持续更新)

昨天给hexo装了mathjax 以后好直接写公式 基本语法 位置 公式插入在文档中的一句话 (有点像html 的display: inline) $(中间写正文)$ 公式直接占用一行 (有点像 html display: block) $$(中间写正文)$$ 希腊字母 这个直接照搬一位大佬的 显示 命令 显示 命令 α \alpha β ...

尘的博客 6551

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

MathJax 语法

MathJax basic tutorial and quick reference up vote1847down votefavorite 1508 To see how any formula was written in any question or answer, including this one

mucai1的专栏 724

mathjax语法

原文在此

sinat_16968575的专栏 837

MathJax使用LaTeX语法编写数学公式教程

MathJax是一款相当强悍的在网页显示数学公式的插件。本教程介绍MathJax如何使用LaTeX语法编写数学公式。 1.如何插入公式 LaTeX的数学公式有两种:行中公式和独立公式。行中公式放在文中与其它文字混编,独立公式单独成行。 行中公式可以用如下两种方法表示: \(数学公式\) 或 ¥数学公式¥(要把人民币符号换成美元符号) 独立公式可以用如下两种方法表示:

Mr.Phoebe的专栏 7426

介绍MathJax如何使用LaTeX语法编写数学公式

MathJax是一款相当强悍的在网页显示数学公式的插件。本教程介绍MathJax如何使用LaTeX语法编写数学公式。 1.如何插入公式 LaTeX的数学公式有两种:行中公式和独立公式。行中公式放在文中与其它文字混编,独立公式单独成行。 行中公式可以用如下两种方法表示: \(数学公式\) 或 ¥数学公式¥(要把人民币符号换成美元符号) 独立公式可以用如下两种方法表示:

LLXLQY的博客 1054

基本数学公式语法(of MathJax)

概述在Markdown中输入数学公式需要LaTeX语法的支持。基本语法呈现位置 正文(inline)中的LaTeX公式用$...$定义 语句为$\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t$ 显示为∑Ni=0∫bag(t,i)dt\sum_{i=0}^N\int_{a}^{b}g(t,i)\text{d}t 单独显示(display)的LaTeX公式用$$...$

树屋Treehouse 3万+

MathJax——markdown公式输入语法

官方文档: https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference 常用: https://www.jianshu.com/p/a0aa94ef8ab2

qq_43284141的博客 417
下一篇: static相关总结
ajacker
博客等级 码龄9年 9粉丝 12原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值