# Tag Info

26

Here is a PGF solution. Responding to your request for plotting multiple functions of the form y^4 - y^2 = x - n, I've added a \foreach loop. Updated with axis labels \documentclass[border=0.5cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{tikzpicture} \begin{axis}[ xmin=-5, xmax=5, ymin=-2, ymax=2, axis lines=...

19

This answer can be a possible solution for to draw $y^4 - y^2 = x$. \documentclass[10pt]{article} \usepackage{pstricks-add} \usepackage{pst-func} \begin{document} \psset{xunit=1.0cm,yunit=1.0cm,algebraic=true,dimen=middle,dotstyle=o,dotsize=5pt 0,linewidth=1pt,arrowsize=3pt 2,arrowinset=0.15} \begin{pspicture*}(-1,-2)(4,3) \...

13

As @percusse suggested, here is the Asymptote version: // // yx.asy // // run // asy yx.asy // // to get yx.pdf // settings.tex="pdflatex"; import graph; import math; import palette; size(12cm); import fontsize;defaultpen(fontsize(8pt)); real xmin=-3.6, xmax=5; real ymax=1.6, ymin=-ymax; real dxmin=0, dxmax=0.1; real dymin=0.1, dymax=dymin; xaxis("$x$"...

8

Just a cleaner code. \documentclass[pstricks,border=12pt]{standalone} \usepackage{pst-plot,pst-node} \psset{algebraic} \def\f(#1){(#1+1)*(#1-5)*#1/35*(#1-7)} \def\Left#1{% \begin{pspicture}(-3,-1)(6,4) \psplot{-2}{5}{\f(x)} \psset{linecolor=red,showpoints} \curvepnodes[plotpoints=#1]{-1.8}{4.8}{t|\f(t)}{A} \multido{\il=0+1,\ir=1+1}{\...

7

Admittedly, pstricks is more efficient for this sort of thing since it can write postscript code for the functions directly, while TikZ/pgf spins its wheels at compile-time computing coordinates for all the points. But nonetheless, a solution in plain TikZ: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture}[samples=400,...

6

Here's an example using Asymptote to create a background image that has exactly the same width as the page. (If the page had different dimensions, the height would be shrunk instead, as the code is currently written.) Since C++ seems to be your language of choice, you may appreciate that the Asymptote syntax is similar, especially compared to something like \...

5

Refactoring Sebastiano's answer. \documentclass[pstricks]{standalone} \usepackage{pst-func} \begin{document} \begin{pspicture}(-1.5,-2.5)(6,3) \psaxes{->}(0,0)(-1,-2)(5.5,2.5)[$x$,-90][$y$,180] \psplotImp[linecolor=red,stepFactor=.1,algebraic](-2,-2)(5,2){y^4-y^2-x} \rput[tl](1,2){$y^4 - y^2 = x$} \end{pspicture} \end{document} Edit You can also use ...

5

You can use the option stepFactor=0.1 to decrease the pixels of your first image. See the pag. 70 of the new manual of Herbert Voss of the May 17, 2019: http://mirrors.ibiblio.org/CTAN/graphics/pstricks/contrib/pst-func/doc/pst-func-doc.pdf \documentclass[border=10pt,pstricks]{standalone} \usepackage{pst-func} \begin{document} \pspicture(-2,-1)(2,1) \...

4

A solution with PGFPlots. I made the parameters similar to Paul's post, the differences are I showed \pgfplotsinvokeforeach which is capable of expanding it's argument, not needed here but good to know for the case \foreach would not work \addplot instead of plot directly working with radian instead of multiplying a 180/pi factor, a new feature of pgfplots ...

3

\psplotImp draws the contour of F(x,y)=0 by checking each point of a rectangular grid of points whether it is on or nearly on the contour. As the dots are not connected by lines or curves, the output looks like a bitmap image (of course it is a vector graphic of dots). It is not zoom in friendly. You can increase the resolution but it will take more time to ...

3

Edited to show no axes. How does this work for you? \documentclass{article} % Declare initial packages \usepackage{pgfplots} % Normal distribution macro \pgfmathdeclarefunction{gauss}{2}{% \pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}% } \begin{document} \begin{tikzpicture} \begin{axis}[ hide x axis, hide y axis, no ...

3

I'm not sure, what the actual problem in your document is, but the chapter about \psImpPlot in the pst-func documentation contains an example how to draw these stream lines. Here the adapted version for a circle with radius 2: \documentclass[pstricks, margin=5pt]{standalone} \usepackage{pst-func} \begin{document} \begin{pspicture*}(-5,-3.2)(5.5,4.5) \...

2

This is a small cheat with TikZ's library shading. I don't know how to rotate rainbow's colors. % with Nguyen Quang Dung \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{shadings} \begin{document} \begin{tikzpicture} % decorations \def\a{1.1} \def\b{.03} \draw[gray,nodes={black,scale=.5}] (0,-\a) node[below]{$0$} node[below=4mm]{$x$} (1,-1-\b)--(...

2

Compute the function value at 2-adic fractions. You can do this by the following: f(1/2) = a do induction on n: for 0 ≤ k < 2^{n-1}: f(k/2^n) = f(k/2^{n-1})*a for 2^{n-1} ≤ k < 2^n: f(k/2^n) = f((k-2^{n-1})/2^{n-1})*(1-a)+a So you got the following tex code. The \pgfkeys here acts as data array. The \pgfpath part plot the data ...

2

Here's a solution using the sagetex package, which gives you access to a computer algebra system and Python programming. \documentclass{article} \usepackage{sagetex} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{pgfplots} \pgfplotsset{compat=1.15} \begin{document} \begin{sagesilent} def LSF(binexp): a = .6666 L = [0] U = [1] M = [1] ...

2

Same problem here. Use the identical curve defined as an ellipse: \documentclass[pstricks,border=10pt]{standalone} \usepackage{pstricks-add} \begin{document} \begin{pspicture}(-1,-1)(8,8) \psaxes[showorigin=false]{->}(0,0)(-.5,-.5)(8,8)[$x$,-90][$y$,0] \psclip{\psellipse[rot=-45,linestyle=dashed](3,2)(2.85,1.65)} \pspolygon[linestyle=none,...

2

You cannot use \pstPlotImp, the line isn't a function. That are only single dots. However, \psellipse[rot=-45](3,2)(2.85,1.65) is the same curve. \documentclass[pstricks,border=10pt]{standalone} \usepackage{pstricks-add} \begin{document} \begin{pspicture}(-1,-1)(8,8) \psaxes[showorigin=false]{->}(0,0)(-.5,-.5)(8,8)[$x$,-90][$y$,0] \psclip{\psellipse[...

1

You have to control the exponent, PostScript knows only single precision for floating point operations. For example e^100 is not possible. The check is easier on PostScript level, the reason why I do not use the algebraic option. \documentclass[border=10pt,pstricks]{standalone} \usepackage{pst-plot,pst-func} \begin{document} \begin{pspicture*}(-2.9,-2.9)(2....

1

Documents with PSTricks graphics to be animated inside the animateinline environment must be built the standard way, that is, along the sequence of commands: latex mydoc latex mydoc dvips mydoc ps2pdf mydoc.ps xelatex usually does not produce the desired result.

Only top voted, non community-wiki answers of a minimum length are eligible