如何填充笛卡尔叶上的区域,如下所示:
这是我的代码:
\documentclass[10pt]{article}
\usepackage{pstricks-add}
\usepackage{pst-func}
\pagestyle{empty}
\begin{document}
\begin{figure}[!ht]
\centering
\psset{algebraic=true,dimen=middle,dotstyle=o,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25,unit=4}
\begin{pspicture*}(-.5,-.5)(2,2)
\psaxes[linecolor=gray,xAxis=true,yAxis=true,labels=none,ticks=none]{->}(0,0)(-.5,-.5)(2,2)
\psplotImp[linecolor=blue,linewidth=1.5pt,plotpoints=500](0,0)(2,2){y^3-3*x*y+x^3}
\end{pspicture*}
\caption{Folium Descartes}
\end{figure}
\end{document}
答案1
您可以填写,如果您使用\parametricplot
:
\documentclass[10pt,x11names]{article}
\usepackage{pstricks-add}
\usepackage{auto-pst-pdf}
\pagestyle{empty}
\begin{document}
\begin{figure}[!ht]
\centering
\psset{algebraic=true,dimen=middle,dotstyle=o,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25,unit=3,plotpoints=2000}
\begin{pspicture*}(-2,-2)(2,2)
\psset{linecolor=SteelBlue4, linewidth=1.2pt}
\pscustom[fillstyle=solid, fillcolor=lightgray!25!LightSteelBlue2!10!]{
\parametricplot{-0.99}{0}{3*t/(1 + t^3) | 3*t^2/(1 + t^3)}
\parametricplot{-600}{-1.01}{3*t/(1 + t^3) | 3*t^2/(1 + t^3)}
}
\pscustom[fillstyle=solid, fillcolor=LightSteelBlue2!25! ]{
\parametricplot{0}{200}{3*t/(1 + t^3) | 3*t^2/(1 + t^3)}
}
\psline[linewidth=0.4pt, linecolor=black](-2.5; 45)(2.5 ; 45)
\psline[linewidth=0.4pt, linecolor=black](-2,1)(2,-3)
\psaxes[linecolor=gray,xAxis=true,yAxis=true,labels=none,ticks=none]{->}(0,0)(-2,-2)(2,2)
\end{pspicture*}
\caption{Folium of Descartes}
\end{figure}
\end{document}
答案2
完成mfpic
,MetaPost 的 LaTeX 接口。要绘制叶面,您可以直接使用笛卡尔形式,这要归功于\levelcurve
此包的便捷命令,只要您将其写成不等式并提供一个验证此不等式的点(此处为 (1, 1))。生成的曲线使用命令填充,\gfill
并可选择所需的颜色。
\documentclass{standalone}
\usepackage[metapost]{mfpic}
\setlength{\mfpicunit}{1cm}
\opengraphsfile{\jobname}
\begin{document}
\begin{mfpic}[2]{-0.5}{2}{-0.5}{2}
\draw\gfill[blue+green]\levelcurve{(1, 1), 0.01}{y**3 - 3x*y + x**3 < 0}
\doaxes{xy}
\end{mfpic}
\closegraphsfile
\end{document}
先用(PDF)LaTeX编译,再用MetaPost编译,最后用(PDF)LaTeX编译,结果如下:
答案3
参数形式的笛卡尔叶Asymptote
(双关语):
// file fod.asy
//
// to get fod.pdf, run `asy -f pdf fod.asy`
//
size(8cm);
import graph;
import fontsize;
defaultpen(fontsize(9pt));
texpreamble("\usepackage{lmodern}");
pen curvepen=darkblue+0.8bp;
pen linepen=darkred+0.8bp;
pen fillpen=orange+opacity(0.5);
real
xmin=-20, xmax=-xmin,
ymin=-20, ymax=-ymin;
xaxis(xmin,xmax,RightTicks(Step=10,step=5,OmitTick(0)));
yaxis(ymin,ymax, LeftTicks(Step=10,step=5,OmitTick(0)));
real a=10;
real r(real t){return 3*a*sin(t)*cos(t)/(sin(t)^3+cos(t)^3);};
real tmin=-0.16pi, tmax=pi/2-tmin;
guide
loop=polargraph(r,0,pi/2)--cycle,
curve=polargraph(r,tmin,tmax);
fill(loop, fillpen);
draw(curve,curvepen);
pair
p=point(curve,0),
q=point(curve,length(curve));
draw((p.x,-p.x-a)--(-q.y-a,q.y),linepen);
更高级一点的例子:
// file fodsp.asy
//
// to get fodsp.pdf, run `asy -f pdf fodsp.asy`
//
size(8cm);
import graph;
import fontsize; defaultpen(fontsize(9pt));
texpreamble("\usepackage{lmodern}");
pen[] fillpen={
red, orange, yellow, green, lightblue, blue, darkblue
};
real
xmin=0, xmax=20,
ymin=0, ymax=20;
xaxis(xmin,xmax,RightTicks(Step=10,step=5));
yaxis(ymin,ymax, LeftTicks(Step=10,step=5));
real ra(real t, real a){return 3*a*sin(t)*cos(t)/(sin(t)^3+cos(t)^3);};
real r(real);
guide loop;
real a, a0=10, da=1;
int n=fillpen.length;
real t; pair p;
a=a0;
for(int i=0;i<n;++i){
r=new real(real t){return ra(t,a);};
loop =polargraph(r,0,pi/2)--cycle;
filldraw(loop, 0.7fillpen[i]+0.3white,fillpen[i]);
t=atan(2^(1/3));
p=r(t)*(cos(t),sin(t));
unfill(circle(p,0.7));
label("$"+string(a)+"$",p);
a-=da;
}
label("$r(\theta)=\displaystyle"
+"\frac{3 a \sin\theta\cos\theta}{\sin^3\theta+\cos^3\theta}$, "
+"$\theta=[0,\frac\pi2]$, "
+"$a="+string(a0-(n-1)*da)+"$--$"+string(a0)+"$"
,((xmin+xmax)/2,ymax),S);
shipout(bbox(paleyellow,Fill));
答案4
在元帖子,您可以将叶状体设为封闭路径并填充它。
我使用了下面方程的(相当简单的)极坐标形式。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(1);
u := 2cm;
path xx, yy, folium;
xx = (1/2 left -- 2 right) scaled u;
yy = (1/2 down -- 2 up) scaled u;
drawarrow xx withcolor .4 white;
drawarrow yy withcolor .4 white;
folium = (origin
for theta=1 step 1 until 89:
-- (3*sind(theta)*cosd(theta)/(sind(theta)**3+cosd(theta)**3),0) rotated theta
endfor
-- cycle) scaled u;
fill folium withcolor .9[blue,white];
draw folium withcolor .67 blue;
endfig;
end.
这是一个更完整的版本,其中方程式移至函数,并展示如何扩展叶层并挑选出循环作为它的子路径。
prologues := 3;
outputtemplate := "%j%c.eps";
beginfig(2);
u := 2cm;
path xx, yy, folium, loop, asymptote;
xx = (2 left -- 2 right) scaled u;
yy = (2 down -- 2 up) scaled u;
drawarrow xx withcolor .4 white;
drawarrow yy withcolor .4 white;
% "a" is the scale factor
a = 1;
vardef r(expr t) = right scaled (3*a*sind(t)*cosd(t)/(sind(t)**3+cosd(t)**3))
rotated t enddef;
% define the folium with some wings
b = 30; % should be less than 45
folium = (r(-b) for theta=1-b step 1 until 89+b: -- r(theta) endfor -- r(90+b)) scaled u;
% define the loop to be the part from theta=0 to theta=90
loop = subpath(b,b+89) of folium -- cycle;
% define an appropriate segment of the asymptote
asymptote = ( xpart point 0 of folium, -xpart point 0 of folium-a*u)
-- (-ypart point infinity of folium-a*u, ypart point infinity of folium );
% now draw them
fill loop withcolor .9[blue,white];
draw folium withcolor .67 blue;
draw asymptote dashed evenly;
endfig;
end.