Forgot password?
 Register account
View 240|Reply 0

tikz求和

[Copy link]

3158

Threads

7933

Posts

45

Reputation

Show all posts

hbghlyj posted 2022-5-16 00:14 |Read mode
In:=
     Sum[(i - 0.5)^2, {i, 0, 1, 0.2}]
Out:=
     0.7

在tikz中,
  1. \documentclass[tikz]{standalone}
  2. \begin{document}
  3. \begin{tikzpicture}
  4. \def\err{0}
  5. \newcounter{i};
  6. \loop
  7. \pgfmathsetmacro{\err}{\err+(0.1*\value{i}-0.5)^2}
  8. \ifnum \value{i}<9
  9. \addtocounter{i}{2};
  10. \repeat
  11. \node at(0,0){\err};
  12. \end{tikzpicture}
  13. \end{document}
Copy the Code
输出0.70006

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | 快速注册

$\LaTeX$ formula tutorial

Mobile version

2025-6-8 06:44 GMT+8

Powered by Discuz!

Processed in 0.023014 second(s), 23 queries

× Quick Reply To Top Edit