我正在写论文,真的很想做出一些像图片中所示的方程式,但不知道如何做。非常感谢您的帮助。
图片取自:https://towardsdatascience.com/particle-swarm-optimization-visually-explained-46289eeb2e14
答案1
这是我的尝试tikz
:
\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{amsmath}
\tikzset{mystyle/.style={minimum height=2cm,rounded corners=3mm,anchor=base,
label={[anchor=south]south:{\scriptsize\bfseries\textsf{#1}}}}}
\begin{document}
\[
\begin{aligned}
P_i^{t+1} &= P_i^t+V_i^{t+1}\\
V_i^{t+1} &=
\tikz[baseline]{
\node[fill=gray!20,mystyle=Inertia\strut] (t1)
{$w V_i^t$}} +
\tikz[baseline]{
\node[fill=magenta!20,mystyle=Cognitive(Personal)] (t2)
{$c_1 r_1\left(P_{best(i)}^t - P_i^t\right)$}} +
\tikz[baseline]{
\node[fill=teal!20,mystyle=Social(Global)] (t3)
{$c_2 r_2\left(P_{bestglobal}^t-P_i^t\right)$}}
\end{aligned}
\]
\end{document}