How to raster area bounded by two functions?
up vote
4
down vote
favorite
This code works normally:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linestyle=none]{0}{6.5}{x*(3-x)/2}}
psplot[linecolor=blue,fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot{0}{4.5}{x*(3-x)/2}}
psplot[linecolor=blue]{.5}{5}{x*(x-6)+6}
rput[bl](1.8,1.2){$y=dfrac{-x^2+3x}{2}$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
but the following code is not working:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linecolor=blue,]{-1}{5}{-1*x+2}}
psplot[fillstyle=hlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt]{.5}{5}{x*(x-6)+6}
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
pstricks pst-plot
add a comment |
up vote
4
down vote
favorite
This code works normally:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linestyle=none]{0}{6.5}{x*(3-x)/2}}
psplot[linecolor=blue,fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot{0}{4.5}{x*(3-x)/2}}
psplot[linecolor=blue]{.5}{5}{x*(x-6)+6}
rput[bl](1.8,1.2){$y=dfrac{-x^2+3x}{2}$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
but the following code is not working:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linecolor=blue,]{-1}{5}{-1*x+2}}
psplot[fillstyle=hlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt]{.5}{5}{x*(x-6)+6}
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
pstricks pst-plot
2
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with adocumentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
– Andrew
Nov 20 at 8:30
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,amsmath
, a lot of the PSTricks packages,graphicx
– Herbert
Nov 20 at 9:22
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
1
linestyle=curve
should beplotstyle=curve
– Herbert
Nov 20 at 10:57
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
This code works normally:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linestyle=none]{0}{6.5}{x*(3-x)/2}}
psplot[linecolor=blue,fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot{0}{4.5}{x*(3-x)/2}}
psplot[linecolor=blue]{.5}{5}{x*(x-6)+6}
rput[bl](1.8,1.2){$y=dfrac{-x^2+3x}{2}$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
but the following code is not working:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linecolor=blue,]{-1}{5}{-1*x+2}}
psplot[fillstyle=hlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt]{.5}{5}{x*(x-6)+6}
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
pstricks pst-plot
This code works normally:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linestyle=none]{0}{6.5}{x*(3-x)/2}}
psplot[linecolor=blue,fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot{0}{4.5}{x*(3-x)/2}}
psplot[linecolor=blue]{.5}{5}{x*(x-6)+6}
rput[bl](1.8,1.2){$y=dfrac{-x^2+3x}{2}$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
but the following code is not working:
documentclass[pstricks]{standalone}
usepackage{pst-plot}
%usepackage{auto-pst-pdf}% only for pdflatex
begin{pspicture}[algebraic,linestyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{%
psplot[linecolor=blue,]{-1}{5}{-1*x+2}}
psplot[fillstyle=hlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt]{.5}{5}{x*(x-6)+6}
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
pstricks pst-plot
pstricks pst-plot
edited Nov 24 at 4:42
asked Nov 20 at 8:19
chishimotoji
29810
29810
2
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with adocumentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
– Andrew
Nov 20 at 8:30
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,amsmath
, a lot of the PSTricks packages,graphicx
– Herbert
Nov 20 at 9:22
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
1
linestyle=curve
should beplotstyle=curve
– Herbert
Nov 20 at 10:57
add a comment |
2
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with adocumentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.
– Andrew
Nov 20 at 8:30
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,amsmath
, a lot of the PSTricks packages,graphicx
– Herbert
Nov 20 at 9:22
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
1
linestyle=curve
should beplotstyle=curve
– Herbert
Nov 20 at 10:57
2
2
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a
documentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.– Andrew
Nov 20 at 8:30
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a
documentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.– Andrew
Nov 20 at 8:30
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,
amsmath
, a lot of the PSTricks packages, graphicx
– Herbert
Nov 20 at 9:22
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,
amsmath
, a lot of the PSTricks packages, graphicx
– Herbert
Nov 20 at 9:22
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
1
1
linestyle=curve
should be plotstyle=curve
– Herbert
Nov 20 at 10:57
linestyle=curve
should be plotstyle=curve
– Herbert
Nov 20 at 10:57
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
You have to define an area which will then be clipped. The area is build with connecting the first point with the last one. For a line you simply get an area of zero, and from this area nothing can be clipped!
With psline(0,2)(5,-3)(0,-3)
I define a triangle. It is automatically a closed area becasue it draws a line from (0,-3)
to (0,2)
.
And from that area the curve with {x*(x-6)+6}
is clipping a part which will be filled.
documentclass[pstricks]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}[algebraic,plotstyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{psline[linestyle=none](0,2)(5,-3)(0,-3)}
psplot[fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt,linecolor=blue]{.5}{5}{x*(x-6)+6}
psline[linewidth=1.5pt](0,2)(5,-3)
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
As an alternative you can calculate the intersectionpoints (needs package pst-intersect
) and using pscustom
%%usepackage{pst-intersect} in the preamble
begin{pspicture}[algebraic](-2,-6)(6,6)
pssavepath[linewidth=1.5pt]{Curve}{psplot{.5}{5}{x*(x-6)+6}}
pssavepath[linewidth=1.5pt]{Line}{psplot{0}{5}{-x+2}}
psintersect[name=C]{Curve}{Line}
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
pscustom[fillcolor=red,fillstyle=solid,opacity=0.4]{%
psplot{psGetNodeCenter{C1}C1.x}{psGetNodeCenter{C2}C2.x}{x*(x-6)+6}%
}
end{pspicture}
However, that one with pst-intersect
works not with xelatex
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
add a comment |
up vote
2
down vote
Generic Template
Proposed features:
- functions are defined globally so you can change easily.
- intersection points are calculated at "runtime" as opposed to statically hard coded.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-eucl,pst-plot}
deff(#1){((#1)^2-6*(#1)+6)}
defg(#1){(2-(#1))}
begin{document}
begin{pspicture}[algebraic,saveNodeCoors,PointSymbol=none,PointName=none](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pstInterFF{f(x)}{g(x)}{0}{A}
pstInterFF{f(x)}{g(x)}{5}{B}
pscustom*[linecolor=yellow!50]{%
psplot{N-A.x}{N-B.x}{f(x)}
psplot{N-B.x}{N-A.x}{g(x)}
closepath
}
psset{linewidth=2pt,linecolor=cyan}
psplot{.5}{5}{f(x)}
psplot{-.5}{5}{g(x)}
uput[-90](*5 {g(x)}){$y=-x+2$}
uput[45](*.7 {f(x)}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Statically hard-coded Version
Cons: you have to calculate the intersection points in advance by hands.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{x^2-6*x+6}
defg{2-x}
begin{document}
begin{pspicture}[algebraic](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pscustom[fillstyle=vlines,hatchcolor=red,hatchsep=0.8pt]{psplot{1}{4}{f}psplot{4}{1}{g}}
psset{linewidth=2pt,linecolor=blue}
psplot{.5}{5}{f}
psplot{-.5}{5}{g}
uput[-90](*5 {g}){$y=-x+2$}
uput[45](*.7 {f}){$y=x^2-6x+6$}
end{pspicture}
end{document}
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
You have to define an area which will then be clipped. The area is build with connecting the first point with the last one. For a line you simply get an area of zero, and from this area nothing can be clipped!
With psline(0,2)(5,-3)(0,-3)
I define a triangle. It is automatically a closed area becasue it draws a line from (0,-3)
to (0,2)
.
And from that area the curve with {x*(x-6)+6}
is clipping a part which will be filled.
documentclass[pstricks]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}[algebraic,plotstyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{psline[linestyle=none](0,2)(5,-3)(0,-3)}
psplot[fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt,linecolor=blue]{.5}{5}{x*(x-6)+6}
psline[linewidth=1.5pt](0,2)(5,-3)
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
As an alternative you can calculate the intersectionpoints (needs package pst-intersect
) and using pscustom
%%usepackage{pst-intersect} in the preamble
begin{pspicture}[algebraic](-2,-6)(6,6)
pssavepath[linewidth=1.5pt]{Curve}{psplot{.5}{5}{x*(x-6)+6}}
pssavepath[linewidth=1.5pt]{Line}{psplot{0}{5}{-x+2}}
psintersect[name=C]{Curve}{Line}
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
pscustom[fillcolor=red,fillstyle=solid,opacity=0.4]{%
psplot{psGetNodeCenter{C1}C1.x}{psGetNodeCenter{C2}C2.x}{x*(x-6)+6}%
}
end{pspicture}
However, that one with pst-intersect
works not with xelatex
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
add a comment |
up vote
3
down vote
accepted
You have to define an area which will then be clipped. The area is build with connecting the first point with the last one. For a line you simply get an area of zero, and from this area nothing can be clipped!
With psline(0,2)(5,-3)(0,-3)
I define a triangle. It is automatically a closed area becasue it draws a line from (0,-3)
to (0,2)
.
And from that area the curve with {x*(x-6)+6}
is clipping a part which will be filled.
documentclass[pstricks]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}[algebraic,plotstyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{psline[linestyle=none](0,2)(5,-3)(0,-3)}
psplot[fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt,linecolor=blue]{.5}{5}{x*(x-6)+6}
psline[linewidth=1.5pt](0,2)(5,-3)
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
As an alternative you can calculate the intersectionpoints (needs package pst-intersect
) and using pscustom
%%usepackage{pst-intersect} in the preamble
begin{pspicture}[algebraic](-2,-6)(6,6)
pssavepath[linewidth=1.5pt]{Curve}{psplot{.5}{5}{x*(x-6)+6}}
pssavepath[linewidth=1.5pt]{Line}{psplot{0}{5}{-x+2}}
psintersect[name=C]{Curve}{Line}
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
pscustom[fillcolor=red,fillstyle=solid,opacity=0.4]{%
psplot{psGetNodeCenter{C1}C1.x}{psGetNodeCenter{C2}C2.x}{x*(x-6)+6}%
}
end{pspicture}
However, that one with pst-intersect
works not with xelatex
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
You have to define an area which will then be clipped. The area is build with connecting the first point with the last one. For a line you simply get an area of zero, and from this area nothing can be clipped!
With psline(0,2)(5,-3)(0,-3)
I define a triangle. It is automatically a closed area becasue it draws a line from (0,-3)
to (0,2)
.
And from that area the curve with {x*(x-6)+6}
is clipping a part which will be filled.
documentclass[pstricks]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}[algebraic,plotstyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{psline[linestyle=none](0,2)(5,-3)(0,-3)}
psplot[fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt,linecolor=blue]{.5}{5}{x*(x-6)+6}
psline[linewidth=1.5pt](0,2)(5,-3)
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
As an alternative you can calculate the intersectionpoints (needs package pst-intersect
) and using pscustom
%%usepackage{pst-intersect} in the preamble
begin{pspicture}[algebraic](-2,-6)(6,6)
pssavepath[linewidth=1.5pt]{Curve}{psplot{.5}{5}{x*(x-6)+6}}
pssavepath[linewidth=1.5pt]{Line}{psplot{0}{5}{-x+2}}
psintersect[name=C]{Curve}{Line}
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
pscustom[fillcolor=red,fillstyle=solid,opacity=0.4]{%
psplot{psGetNodeCenter{C1}C1.x}{psGetNodeCenter{C2}C2.x}{x*(x-6)+6}%
}
end{pspicture}
However, that one with pst-intersect
works not with xelatex
You have to define an area which will then be clipped. The area is build with connecting the first point with the last one. For a line you simply get an area of zero, and from this area nothing can be clipped!
With psline(0,2)(5,-3)(0,-3)
I define a triangle. It is automatically a closed area becasue it draws a line from (0,-3)
to (0,2)
.
And from that area the curve with {x*(x-6)+6}
is clipping a part which will be filled.
documentclass[pstricks]{standalone}
usepackage{pst-plot}
begin{document}
begin{pspicture}[algebraic,plotstyle=curve](-2,-6)(6,6)
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
psclip{psline[linestyle=none](0,2)(5,-3)(0,-3)}
psplot[fillstyle=vlines]{.5}{5}{x*(x-6)+6}
endpsclip
psplot[linewidth=1.5pt,linecolor=blue]{.5}{5}{x*(x-6)+6}
psline[linewidth=1.5pt](0,2)(5,-3)
rput[bl](1.5,1){$y=-x+2$}
rput[t](2,-3.1){$y=x^2-6x+6$}
end{pspicture}
end{document}
As an alternative you can calculate the intersectionpoints (needs package pst-intersect
) and using pscustom
%%usepackage{pst-intersect} in the preamble
begin{pspicture}[algebraic](-2,-6)(6,6)
pssavepath[linewidth=1.5pt]{Curve}{psplot{.5}{5}{x*(x-6)+6}}
pssavepath[linewidth=1.5pt]{Line}{psplot{0}{5}{-x+2}}
psintersect[name=C]{Curve}{Line}
psaxes{->}(0,0)(-2,-4)(5.5,4)[$x$,0][$y$,90]
pscustom[fillcolor=red,fillstyle=solid,opacity=0.4]{%
psplot{psGetNodeCenter{C1}C1.x}{psGetNodeCenter{C2}C2.x}{x*(x-6)+6}%
}
end{pspicture}
However, that one with pst-intersect
works not with xelatex
edited Nov 20 at 9:41
answered Nov 20 at 9:05
Herbert
266k23404714
266k23404714
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
add a comment |
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
I understanded what you directing. And together Artificial Stupidity's anwser, I have more knowledge myseft.
– chishimotoji
Nov 20 at 9:23
add a comment |
up vote
2
down vote
Generic Template
Proposed features:
- functions are defined globally so you can change easily.
- intersection points are calculated at "runtime" as opposed to statically hard coded.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-eucl,pst-plot}
deff(#1){((#1)^2-6*(#1)+6)}
defg(#1){(2-(#1))}
begin{document}
begin{pspicture}[algebraic,saveNodeCoors,PointSymbol=none,PointName=none](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pstInterFF{f(x)}{g(x)}{0}{A}
pstInterFF{f(x)}{g(x)}{5}{B}
pscustom*[linecolor=yellow!50]{%
psplot{N-A.x}{N-B.x}{f(x)}
psplot{N-B.x}{N-A.x}{g(x)}
closepath
}
psset{linewidth=2pt,linecolor=cyan}
psplot{.5}{5}{f(x)}
psplot{-.5}{5}{g(x)}
uput[-90](*5 {g(x)}){$y=-x+2$}
uput[45](*.7 {f(x)}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Statically hard-coded Version
Cons: you have to calculate the intersection points in advance by hands.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{x^2-6*x+6}
defg{2-x}
begin{document}
begin{pspicture}[algebraic](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pscustom[fillstyle=vlines,hatchcolor=red,hatchsep=0.8pt]{psplot{1}{4}{f}psplot{4}{1}{g}}
psset{linewidth=2pt,linecolor=blue}
psplot{.5}{5}{f}
psplot{-.5}{5}{g}
uput[-90](*5 {g}){$y=-x+2$}
uput[45](*.7 {f}){$y=x^2-6x+6$}
end{pspicture}
end{document}
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
add a comment |
up vote
2
down vote
Generic Template
Proposed features:
- functions are defined globally so you can change easily.
- intersection points are calculated at "runtime" as opposed to statically hard coded.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-eucl,pst-plot}
deff(#1){((#1)^2-6*(#1)+6)}
defg(#1){(2-(#1))}
begin{document}
begin{pspicture}[algebraic,saveNodeCoors,PointSymbol=none,PointName=none](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pstInterFF{f(x)}{g(x)}{0}{A}
pstInterFF{f(x)}{g(x)}{5}{B}
pscustom*[linecolor=yellow!50]{%
psplot{N-A.x}{N-B.x}{f(x)}
psplot{N-B.x}{N-A.x}{g(x)}
closepath
}
psset{linewidth=2pt,linecolor=cyan}
psplot{.5}{5}{f(x)}
psplot{-.5}{5}{g(x)}
uput[-90](*5 {g(x)}){$y=-x+2$}
uput[45](*.7 {f(x)}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Statically hard-coded Version
Cons: you have to calculate the intersection points in advance by hands.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{x^2-6*x+6}
defg{2-x}
begin{document}
begin{pspicture}[algebraic](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pscustom[fillstyle=vlines,hatchcolor=red,hatchsep=0.8pt]{psplot{1}{4}{f}psplot{4}{1}{g}}
psset{linewidth=2pt,linecolor=blue}
psplot{.5}{5}{f}
psplot{-.5}{5}{g}
uput[-90](*5 {g}){$y=-x+2$}
uput[45](*.7 {f}){$y=x^2-6x+6$}
end{pspicture}
end{document}
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
add a comment |
up vote
2
down vote
up vote
2
down vote
Generic Template
Proposed features:
- functions are defined globally so you can change easily.
- intersection points are calculated at "runtime" as opposed to statically hard coded.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-eucl,pst-plot}
deff(#1){((#1)^2-6*(#1)+6)}
defg(#1){(2-(#1))}
begin{document}
begin{pspicture}[algebraic,saveNodeCoors,PointSymbol=none,PointName=none](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pstInterFF{f(x)}{g(x)}{0}{A}
pstInterFF{f(x)}{g(x)}{5}{B}
pscustom*[linecolor=yellow!50]{%
psplot{N-A.x}{N-B.x}{f(x)}
psplot{N-B.x}{N-A.x}{g(x)}
closepath
}
psset{linewidth=2pt,linecolor=cyan}
psplot{.5}{5}{f(x)}
psplot{-.5}{5}{g(x)}
uput[-90](*5 {g(x)}){$y=-x+2$}
uput[45](*.7 {f(x)}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Statically hard-coded Version
Cons: you have to calculate the intersection points in advance by hands.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{x^2-6*x+6}
defg{2-x}
begin{document}
begin{pspicture}[algebraic](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pscustom[fillstyle=vlines,hatchcolor=red,hatchsep=0.8pt]{psplot{1}{4}{f}psplot{4}{1}{g}}
psset{linewidth=2pt,linecolor=blue}
psplot{.5}{5}{f}
psplot{-.5}{5}{g}
uput[-90](*5 {g}){$y=-x+2$}
uput[45](*.7 {f}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Generic Template
Proposed features:
- functions are defined globally so you can change easily.
- intersection points are calculated at "runtime" as opposed to statically hard coded.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-eucl,pst-plot}
deff(#1){((#1)^2-6*(#1)+6)}
defg(#1){(2-(#1))}
begin{document}
begin{pspicture}[algebraic,saveNodeCoors,PointSymbol=none,PointName=none](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pstInterFF{f(x)}{g(x)}{0}{A}
pstInterFF{f(x)}{g(x)}{5}{B}
pscustom*[linecolor=yellow!50]{%
psplot{N-A.x}{N-B.x}{f(x)}
psplot{N-B.x}{N-A.x}{g(x)}
closepath
}
psset{linewidth=2pt,linecolor=cyan}
psplot{.5}{5}{f(x)}
psplot{-.5}{5}{g(x)}
uput[-90](*5 {g(x)}){$y=-x+2$}
uput[45](*.7 {f(x)}){$y=x^2-6x+6$}
end{pspicture}
end{document}
Statically hard-coded Version
Cons: you have to calculate the intersection points in advance by hands.
documentclass[pstricks,border=12pt]{standalone}
usepackage{pst-plot}
deff{x^2-6*x+6}
defg{2-x}
begin{document}
begin{pspicture}[algebraic](-1,-3.5)(6,4)
psaxes{->}(0,0)(-.5,-3.5)(5.5,3.5)[$x$,0][$y$,90]
pscustom[fillstyle=vlines,hatchcolor=red,hatchsep=0.8pt]{psplot{1}{4}{f}psplot{4}{1}{g}}
psset{linewidth=2pt,linecolor=blue}
psplot{.5}{5}{f}
psplot{-.5}{5}{g}
uput[-90](*5 {g}){$y=-x+2$}
uput[45](*.7 {f}){$y=x^2-6x+6$}
end{pspicture}
end{document}
edited Nov 20 at 9:21
answered Nov 20 at 8:55
Artificial Stupidity
4,53811034
4,53811034
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
add a comment |
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
:((, Sadly, a long answer.
– chishimotoji
Nov 20 at 8:57
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Anyhow, big thanks. However, can you edit the above code? :-)). I am not enough knowledge to write the code like YOU! :))
– chishimotoji
Nov 20 at 9:03
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
Your anwser is very good but I will vote Herbert's anwser. Sympathize for me( gg translate) :-))
– chishimotoji
Nov 20 at 9:26
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460890%2fhow-to-raster-area-bounded-by-two-functions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a
documentclass
command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what packages etc you are using before we can compile your code.– Andrew
Nov 20 at 8:30
Thank you for your remind.
– chishimotoji
Nov 20 at 8:40
You should remove everything from the example code which is not important for the problem, e.g. the margin setting,
amsmath
, a lot of the PSTricks packages,graphicx
– Herbert
Nov 20 at 9:22
@Herbert: I do so since I hope while compiling not having error.
– chishimotoji
Nov 20 at 9:30
1
linestyle=curve
should beplotstyle=curve
– Herbert
Nov 20 at 10:57