[pstricks] Automate a line drawing routine
Juergen Gilg
gilg at acrotex.net
Mon Dec 29 22:54:06 CET 2008
Dear David,
thanks for your explanations:
Here an approach with psplot -- however only working for positive slopes
\geq 1. I am not clever enough to put in some if/else commands.
slope > 1 _CHECKED_,
0< slope <1 {X-RANGE -5 ... 5}
and for negative
slope < -1
-1 < slope < 0 {X-RANGE -5 ... 5}
Maybe there is someone cleverer out there to refine this approach:
\documentclass{article}
\usepackage{pstricks,pstricks-add}
\begin{document}
\pagestyle{empty}
\newcommand{\DaveArnold}[4]{%
\psset{unit=0.5}
\begin{pspicture}(-6,-6)(6,6)
\psgrid[gridcolor=lightgray,gridlabels=0pt,subgriddiv=1](0,0)(-5,-5)(5,5)
\psaxes[labels=none,ticks=none]{->}(0,0)(-5.5,-5.5)(5.5,5.5)
\Cnode[radius=0.1cm,fillstyle=solid,fillcolor=blue,linecolor=blue](#1,#2){A}
\Cnode[radius=0.1cm,fillstyle=solid,fillcolor=blue,linecolor=blue](#3,#4){B}
\psclip{\psframe[linestyle=none](-5,-5)(5,5)}
%\ncline[nodesep=10cm,linecolor=blue]{<->}{A}{B}
\psplot[arrows=<->,linecolor=blue]{5 neg #2 sub #3 #1 sub #4 #2 sub div
mul #1 add}{5 #2 sub #3 #1 sub #4 #2 sub div mul #1 add}{#4 #2 sub #3 #1
sub div x #1 sub mul #2 add}
\endpsclip
\uput[0](5.5,0){$x$}
\uput[90](0,5.5){$y$}
\end{pspicture}
\resetOptions
}
\DaveArnold{-4}{-2}{-3}{4}
%First Argument x-Koordinate Point A
%Second Argument y-Koordinate Point A
%Third Argument x-Koordinate Point B
%Fourth Argument y-Koordinate Point B
\DaveArnold{-1}{-2}{3}{3} \DaveArnold{-4}{-4}{1}{2}
\DaveArnold{0}{0}{2}{1} \DaveArnold{-4}{4}{1}{2}
\end{document}
Regards,
Juergen
David Arnold wrote:
> Jurgen et al,
>
> I would not pick points P and Q that lie on the boundary. So I would
> want the arrows at the end of the lines where the lines exit on a
> boundary of the grid.
>
> When I teach, I tell the students that the arrow has the same meaning
> as the ellipses at the end of this sequence:
>
> 1, 3, 5, 7, ...
>
> They mean "etcetera." The arrow at the end of the line means much the
> same thing. Enough of the pattern has been established so that you can
> intuit the rest of the behavior of the function. For example, it moves
> up and to the right indefinitely.
>
> This type of instruction comes in handy when discussing the domain and
> range of functions from a graphical viewpoint with the students. We do
> a number of examples where we have segments, rays, and lines, and they
> have different effects on the domain (or range).
>
> For example, see the discussion on Domain and Range in the
> Intermediate Algebra Text we wrote for our students:
>
> http://msenux.redwoods.edu/IntAlgText/chapter2/section3.pdf
>
> D.
>
>
> On Dec 29, 2008, at 12:17 PM, Juergen Gilg wrote:
>
>> Dear Arnold,
>>
>> where should appear the arrowheads, if the line ends in: (-5,-5),
>> (-5,5), (5,-5), (-5,5) in the 4 CORNERS of your grid???
>> Inmidst of the circlepoint = not visible, due to the radius of the
>> circle...
>>
>> Just a general question: Why do you like to have arrowheads in a
>> functionplot? Any didactial aspects? I am definitely not used to
>> that. To show that the line does not end at that point?
>>
>> I always imagine when having an arrowhead, that there is a
>> DIRECTION... Just to widen my horizon of didactics.
>>
>> Regard,
>>
>> Juergen
>>
>>
>> David Arnold wrote:
>>> Jurgen,
>>>
>>> Good ideas here. I would not thought of this solution.
>>>
>>> One point: At my end, the lines don't have arrows at each end.
>>> They're line segments.
>>>
>>> Is there a fix for this?
>>>
>>> D.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> On Dec 29, 2008, at 11:55 AM, Juergen Gilg wrote:
>>>
>>>> Dear David,
>>>>
>>>> couldn't solve the problem with 2 arrowhead at the end of the lines
>>>> drawn, however the rest should work fine.
>>>>> Looking for ideas.
>>>>>
>>>> \documentclass{article}
>>>> \usepackage{pstricks,pstricks-add}
>>>> \begin{document}
>>>> \pagestyle{empty}
>>>>
>>>> \newcommand{\DaveArnold}[4]{%
>>>> \psset{unit=0.5}
>>>> \begin{pspicture}(-6,-6)(6,6)
>>>> \psgrid[gridcolor=lightgray,gridlabels=0pt,subgriddiv=1](0,0)(-5,-5)(5,5)
>>>> \psaxes[labels=none,ticks=none]{->}(0,0)(-5.5,-5.5)(5.5,5.5)
>>>> \Cnode[radius=0.1cm,fillstyle=solid,fillcolor=blue,linecolor=blue](#1,#2){A}
>>>> \Cnode[radius=0.1cm,fillstyle=solid,fillcolor=blue,linecolor=blue](#3,#4){B}
>>>> \psclip{\psframe[linestyle=none](-5,-5)(5,5)}
>>>> \ncline[nodesep=10cm,linecolor=blue]{<->}{A}{B}
>>>> \endpsclip
>>>> \uput[0](5.5,0){$x$}
>>>> \uput[90](0,5.5){$y$}
>>>> \end{pspicture}
>>>> \resetOptions
>>>> }
>>>>
>>>> \DaveArnold{1}{2}{-3}{5}
>>>> %First Argument x-Koordinate Point A
>>>> %Second Argument y-Koordinate Point A
>>>> %Third Argument x-Koordinate Point B
>>>> %Fourth Argument y-Koordinate Point B
>>>>
>>>> \DaveArnold{-1}{-2}{3}{3}
>>>>
>>>> \DaveArnold{-5}{-5}{1}{2}
>>>>
>>>> %NO PROBLEM to so produce vertical and horizontal lines as well.
>>>> \end{document}
>>>>
>>>>
>>>> Regards,
>>>>
>>>> Juergen
>>>> _______________________________________________
>>>> PSTricks mailing list
>>>> PSTricks at tug.org <mailto:PSTricks at tug.org>
>>>> http://tug.org/mailman/listinfo/pstricks
>>>
>>> ------------------------------------------------------------------------
>>> _______________________________________________
>>> PSTricks mailing list
>>> PSTricks at tug.org
>>> http://tug.org/mailman/listinfo/pstricks
>>>
>>
>> --
>> Jürgen Gilg
>> Austr. 59
>> 70376 Stuttgart
>> -------------------------------------
>> Tel 0711.59 27 88
>> e-Mail gilg at acrotex.net
>> Websites www.acrotex.net
>> www.brueckenkurs-physik.de
>> www.gilligan-online.de
>>
>> _______________________________________________
>> PSTricks mailing list
>> PSTricks at tug.org <mailto:PSTricks at tug.org>
>> http://tug.org/mailman/listinfo/pstricks
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
--
Jürgen Gilg
Austr. 59
70376 Stuttgart
-------------------------------------
Tel 0711.59 27 88
e-Mail gilg at acrotex.net
Websites www.acrotex.net
www.brueckenkurs-physik.de
www.gilligan-online.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://tug.org/pipermail/pstricks/attachments/20081229/f3b6dfd1/attachment-0001.html
More information about the PSTricks
mailing list