Is there a way to plot this curve


using TikZ or PGFPlots using exaclty the equation given in order to have something like that?

enter image description here

  • Shouldn't tikz or pgfplots support that kind of equation, you can tell tikz to compute the points with gnuplot and then plot the result. – gigabytes Jan 5 '17 at 8:51
  • 1
    You already asked that kind of question tex.stackexchange.com/q/312675/95441. Where is the difference to your old question? – Stefan Pinnow Jan 5 '17 at 8:53
  • There is no the answere that I need today. I need to plot the curve with 1 equation. – Andrea Leo Jan 5 '17 at 9:02
  • why can't you separate as two equations for y and plot the two curves on the same axis, I don't know whether pgfplots can do that but why does it matter if it can't you can do it by hand or with other software before plotting. – David Carlisle Jan 5 '17 at 9:33
  • Is tex.stackexchange.com/questions/18359/… helpful? – Torbjørn T. Jan 5 '17 at 10:02

As I already mentioned in the comment below the question I don't see anything new here compared to your other question. And as David already mentioned in his comment below the question what should be so bad to just draw two \addplots? If this would be an option, you could do the following. (I think adding the shaded areas should not be a problem for you.)

Please have a look at the comments in the code for more details.

            % set some appropriate y min and max values
            % increase the number of samples so the corresponding calculated y values
            % are at minimum in the given y range AND the value at x = 0 is calculated
            % just to be sure, plot the lines smoothly
            axis lines=middle,
            % we don't need any x ticks
            % draw horizontal lines for asymptotes ...
            % https://www.wolframalpha.com/input/?i=asymptotes+x%5E2y%5E2-x%5E2-3xy%2B2%3D0
            % ... but we don't need any labels at them
            % print x and y labels
            % move the y label to "the other side" so it is not overlapping
            % with the plots
            ylabel style={
                anchor=north east,
            % to filter away the zero values
            unbounded coords=jump,
            x filter/.expression={x==0 ? NaN : x},
            % solve the equation x^2y^2-x^2-3xy+2=0 with Wolfram Alpha ...
            % https://www.wolframalpha.com/input/?i=Solve%5Bx%5E2y%5E2-x%5E2-3xy%2B2%3D0,+y%5D
            % ... and draw them in the same style
            \addplot [red] {(3*x - sqrt(4*x^4 + x^2))/(2*x^2)};
            \addplot [red] {(3*x + sqrt(4*x^4 + x^2))/(2*x^2)};

            % find the values for y = 0 and add some nodes
            % https://www.wolframalpha.com/input/?i=Solve%5Bx%5E2y%5E2-x%5E2-3xy%2B2%3D0,+y%3D0%5D
            \addplot [only marks] coordinates {(-sqrt(2),0) (sqrt(2),0)}
                node [at start,above right] {$A_1$}
                node [at end,below left]    {$A_2$}

image showing the result of above code

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.