اولین بار است که به اینجا می‌آیید؟ راهنمای سایت را بخوانید!
+1 رای
1.3k بازدید

سلام، چگونه میتوان شکلهای مانند فایل پیوست برای تعریف انتگرال معین رسم کرد؟ من مثالهای زیر را دیدم و به دنبال مثالی برای رسم این شکل هستم.
http://www.texample.net/tikz/examples/area/mathematics/

آیا مثالی در این زمینه وجود داره؟ یا باید با ترکیب دستورات شکل را ایجاد کرد؟
مشکل من در ایجاد مستطیل ها و اعداد روی شکل هست.

فایل(های) پیوست:
Area.JPG

1 پاسخ

+2 رای
 
بهترین پاسخ

سلام.
امیدوارم کد زیر براتون مفید باشه:

\documentclass[10pt]{report}
\usepackage[utf8]{inputenc} 
\usepackage{amsmath}
\usepackage{color}
\usepackage{tikz}
\usepackage{pgf}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\begin{document}
\begin{center}
\begin{tikzpicture}[x={(0:4)},y={(90:4)}]
% Here is your definitions...
\newcommand{\txtsize}{\tiny}% one of the following may be used here:
%\tiny  \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge
\newcommand{\func}[1]{1-(#1^2)}
%\def\n{4} % Number of splits.
\newcommand{\n}{4}
\newcommand{\numOfGrids}{4}
\pgfmathsetmacro{\gridStep}{1/\numOfGrids}
% Draw your background here...
	\path[use as bounding box] (-0.2,-0.2) rectangle (1.2,1.2);
	\path[fill=gray!20, opacity=0.3] (0,0) rectangle (1,1);
	\draw[step=\gridStep , loosely dotted] (0,0) grid (1,1);
% Draw your lines, plots, texts and so on, here...
% Here is axes...
	\draw[->] (-0.1,0) -- (1.1,0) node[right] {$x$};
	\draw[->] (0,-0.1) -- (0,1.1) node[above] {$y$};
% Here is the numbers of X and Y ...
	\foreach \i in {1,2,3,4}{
		\pgfmathsetmacro{\num}{\i*\gridStep}
		\draw (0.01,\num)--(-0.01,\num)node[left] {\txtsize$\pgfmathprintnumber[fixed, precision=2]{\num}$};
	}
% Here is the main plot $y=1-x^2$ (for this example)...
	\draw[fill=blue!10,opacity=0.1, domain=0:1,smooth, variable=\x,blue](0,0)--(0,1) plot ({\x},{1-(\x*\x)})--(0,0);
	\draw[domain=0:1,smooth, variable=\x,blue] plot ({\x},{\func{\x}});
	\node[above, blue] at (0.5,1.2) {\small $y=1-x^2$};
% Draw  your rectangles...
\pgfmathsetmacro{\nth}{1/\n}
\def\xSecond{0}
\foreach \i in {1,2,...,\n}{
	\def\xFirst{\i*\nth-\nth}
	\pgfmathsetmacro{\xSecond}{\i*\nth}
	\pgfmathsetmacro{\ySecond}{\func{\xSecond}}
	\draw[fill=red!20,opacity=0.6](\xFirst,0) rectangle(\xSecond,\ySecond);
	\draw[line width=0.5pt,draw=red](\xFirst,0) rectangle(\xSecond,\ySecond);
	\filldraw[black] (\xSecond,\ySecond)node[black, above right]{\txtsize$(\pgfmathprintnumber[fixed, precision=2]{\xSecond},\pgfmathprintnumber[fixed, precision=2]{\ySecond})$} circle(1pt);
	\draw (\xSecond,0.01)--(\xSecond,-0.01)node
%	[left , rotate=90] % USE this command instead of the above one if \n is large enough
		[below] 
	{\txtsize$\pgfmathprintnumber[fixed, precision=2]{\xSecond}$};
}
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[x={(0:4)},y={(90:4)}]
% Here is your definitions...
\newcommand{\txtsize}{\tiny}% one of the following may be used here:
%\tiny  \scriptsize \footnotesize \small \normalsize \large \Large \LARGE \huge \Huge
\newcommand{\func}[1]{1-(#1^2)}
%\def\n{4} % Number of splits.
\newcommand{\n}{6}
\newcommand{\numOfGrids}{4}
\pgfmathsetmacro{\gridStep}{1/\numOfGrids}
% Draw your background here...
\path[use as bounding box] (-0.2,-0.2) rectangle (1.2,1.2);
\path[fill=gray!20, opacity=0.3] (0,0) rectangle (1,1);
\draw[step=\gridStep , loosely dotted] (0,0) grid (1,1);
% Draw your lines, plots, texts and so on, here...
% Here is axes...
\draw[->] (-0.1,0) -- (1.1,0) node[right] {$x$};
\draw[->] (0,-0.1) -- (0,1.1) node[above] {$y$};
% Here is the numbers of X and Y ...
\foreach \i in {1,2,3,4}{
	\pgfmathsetmacro{\num}{\i*\gridStep}
	\draw (0.01,\num)--(-0.01,\num)node[left] {\txtsize$\pgfmathprintnumber[fixed, precision=2]{\num}$};

}
% Here is the main plot $y=1-x^2$ (for this example)...
\draw[fill=blue!30,opacity=0.2, domain=0:1,smooth, variable=\x,blue](0,0)--(0,1) plot ({\x},{1-(\x*\x)})--(0,0);
\draw[domain=0:1,smooth, variable=\x,blue] plot ({\x},{\func{\x}});
\node[above, blue] at (0.5,1.2) {\small $y=1-x^2$};
% Draw  your rectangles...
\pgfmathsetmacro{\nth}{1/\n}
\def\xSecond{0}
\foreach \i in {1,2,...,\n}{
	\def\xFirst{\i*\nth-\nth}
	\pgfmathsetmacro{\xSecond}{\i*\nth}
	\pgfmathsetmacro{\xMid}{(\xFirst+\xSecond)/2}
	\pgfmathsetmacro{\ySecond}{\func{\xMid}}
	\draw[fill=red!20,opacity=0.6](\xFirst,0) rectangle(\xSecond,\ySecond);
	\draw[line width=0.5pt,draw=red](\xFirst,0) rectangle(\xSecond,\ySecond);
	\draw[dashed, color=red, line width=0.5 pt](\xMid,0)--(\xMid,\ySecond)node[black, above right=-0.02 ]{\txtsize$(\pgfmathprintnumber[fixed, precision=2]{\xMid},\pgfmathprintnumber[fixed, precision=2]{\ySecond})$};
	\filldraw[black] (\xMid,\ySecond) circle(1pt);
	\draw (\xMid,0)--(\xMid,-0.08)node
	[left , rotate=90]
%	[below]
	{\txtsize$\pgfmathprintnumber[fixed, precision=3]{\xMid}$};
	\draw (\xSecond,0.01)--(\xSecond,-0.01)node
		[left , rotate=90]
	%	[below] % USE this command instead of the above one if \n is small
	 {\txtsize$\pgfmathprintnumber[fixed, precision=2]{\xSecond}$};
}
\end{tikzpicture}
\end{center}
\end{document}

خروجی:
enter image description here
چند پارامتر در این کد وجود دارند (مانند n یا numOfGrid یا ...) که با تغییر هریک به شکلی متناسب با آن پارامتر خواهید رسید.
پیروز و پاینده باشید.

پرسیدن سوال
وب‌سایت پرسش و پاسخ پارسی‌لاتک جایی برای پرسش و پاسخ درباره سیستم حروف‌چینی لاتک و بسته زی‌پرشین است. در اینجا می‌توانید سوال‌های خود را بپرسید و به سوال‌های دیگران پاسخ دهید.

7.1k پرسش

6.6k پاسخ

23.5k نظر

7.2k کاربر

محبوب‌ترین برچسب‌ها

رفع خطا جدول xepersian مراجع ریاضی‌نویسی شکل bidi فونت فهرست مطالب شماره‌گذاری منابع پانویس بیب‌تک tikz parsilatex تک‌لایو بیمر اسلاید زی‌پرشین پاورقی bibtex سربرگ نماد رسم شکل فرمول‌نویسی ارجاع‌دهی biditexmaker هدر ویرایشگر قالب beamer واژه‌نامه اندازه فونت texstudio عنوان فصل ماتریس اعمال نشدن تغییرات در پی‌دی‌اف رسم جدول شماره صفحه bidipresentation حاشیه رنگ عنوان شکل اسلاید فارسی محیط قضیه گراف مکان شکل tikzpicture enumerate حروف‌چینی کد شماره فصل tabriz_thesis نمایه align زیرنویس شکل کادر itemize فهرست اشکال الگوریتم عدم اجرا listings نیم‌فاصله متن لاتین و فارسی بسته فاصله بین خطوط قالب پایان‌نامه فرمول نصب تک‌لایو فارسی‌تک hyperref شماره فرمول glossaries کپشن نمودار خروجی لاتک حروف‌چینی چندستونی فونت فارسی و انگلیسی ماکرونویسی biditools شماره پاورقی پیوست‌ سوال امتحانی فاصله‌گذاری فرمول چندضابطه‌ای extrafootnotefeatures subfigure biditufte-book header texmaker pdf خطا tex longtable تصویر شمارنده زیرنویس texlive2015 دیاگرام رسم نمودار شماره‌گذاری صفحات پایان نامه فهرست جداول میک‌تک texlive2016 تنظیم جدول آکولاد شعر kashida بولد تورفتگی texworks caption اندیس اعداد فارسی lollipop iust-thesis multicol فصل‌نویسی سوال چهارگزینه‌ای فاصله عمودی pgfplots xindy چپ‌چینی اوبونتو میکروسافت ورد قاب geometry xelatex texlive fancyhdr وسط‌چینی تک لایو 2015 tcolorbox عنوان بخش شماره گذاری به‌روزرسانی بسته aimc46 صفر توخالی فرمول طولانی بیرون‌زدگی کاما پوستر فاصله سطرها نوشتافت شکست خط tex-programming فونت اعداد قرآن tabriz-thesis
...