2
$\begingroup$

There are two equations like this: $a=f(x,y)$ and $z=g(x,y)$, where $a$ is a constant. In principle, one can solve $a=f(x,y)$ for $y$ as $y=k(x)$ and substitute it into the second equation to obtain $z=g(x,k(x))=h(x)$. I want to plot the curves of $z=h(x)$. However, the first equation is too complicated to solve $y$ as function of $(x,a)$ and the second equation is also very complicated. In this case, how can I get the curves?

e.g. the first equation as

1=(-1 + 2 x^2 y)/((x + x^3 y) Sqrt[ 1 + y - Sqrt[1 + 1/(x y^2) + (2 x)/y] y]) 

and the second equation as

z=(-4 + x^2 (2 - Sqrt[1 + 1/(x y^2) + (2 x)/y]) y^2 + (x - x Sqrt[1 + 1/(x y^2) + (2 x)/y]) y^3 + y (-3 + 2 Sqrt[1 + 1/(x y^2) + (2 x)/y] + 2 x Sqrt[1 + 1/(x y^2) + (2 x)/ y] (1 - 2 Sqrt[1 + y - Sqrt[1 + 1/(x y^2) + (2 x)/y] y])))/(6 x Sqrt[1 + 1/(x y^2) + (2 x)/y] y Sqrt[1 + y - Sqrt[1 + 1/(x y^2) + (2 x)/y] y])`
$\endgroup$
  • 3
    $\begingroup$ Show us both equations, formatted as Mathematica code, so people can copy / paste them from your post. $\endgroup$ – MarcoB Oct 30 '15 at 12:06
  • 1
    $\begingroup$ It's not just that the first equation is "complicated", it's that it's impossible to solve it for y as a function of x! This implicit equation's graph is not the graph of such a function, as you would see if you evaluate ContourPlot[ 1 == (-1 + 2 x^2 y)/((x + x^3 y) Sqrt[ 1 + y - Sqrt[1 + 1/(x y^2) + (2 x)/y] y]), {x, -5, 5}, {y, -5, 5}, PlotPoints -> 50] . $\endgroup$ – murray Oct 30 '15 at 16:52
  • $\begingroup$ @murray well it is still possible to ask for the projection of the intersection curve of two surfaces given by the equations to the $(x,z)$ plane $\endgroup$ – მამუკა ჯიბლაძე Oct 30 '15 at 17:42
  • 1
    $\begingroup$ You can think of the two equations as surfaces $f(x,y)=a$ and $g(x,y)-z=0$ in $(x,y,z)$-space and then use the answer to this question: mathematica.stackexchange.com/q/5968/484 $\endgroup$ – Rahul Oct 30 '15 at 18:51
2
$\begingroup$

One possible approach. As murray points out in the comment, actually $y$ is not determined uniquely from $x$, so not to lose information it seems better to look at the whole thing in 3D. But first I believe it is necessary to get rid of radicals. Denoting Sqrt[1 + 1/(x y^2) + (2 x)/y] by $u$ and Sqrt[ 1 + y - Sqrt[1 + 1/(x y^2) + (2 x)/y] y] by $v$ one obtains algebraic equations $u^2 x y^2-2 x^2 y-x y^2=1$, $-u y+y+1=v^2$ for them, while the original ones become $(x+x^3y)v=2x^2y-1$ and $z=\frac{-4 u v x y-u x^2 y^2-u x y^3+2 u x y+2 u y+2 x^2 y^2+x y^3-3 y-4}{6 u v x y}$.

It is straightforward to then eliminate $u$ and $v$ obtaining $f(x,y)=1$ and $z=g(x,y)$ where $$ f(x,y)=2 x^{13} y^5-2 x^{12} y^5-x^{12} y^4+9 x^{11} y^4+8 x^{10} y^5-4 x^{10} y^3+16 x^9 y^3-8 x^8 y^4-4 x^8 y^3-6 x^8 y^2+14 x^7 y^2+26 x^6 y^3-14 x^6 y^2-4 x^6 y+6 x^5 y-28 x^4 y^2-6 x^4 y-x^4+x^3+10 x^2 y+2 x^2 $$ and \begin{align*} g&(x,y)=\\ &\left(x^{10} y^5-x^{10} y^4-x^9 y^5+2 x^9 y^4+2 x^9 y^3-2 x^8 y^4-13 x^8 y^3+4 x^7 y^5-3 x^7 y^4-2 x^7 y^3+6 x^7 y^2+12 x^6 y^3-21 x^6 y^2-3 x^5 y^3+6 x^5 y^2+6 x^5 y-53 x^4 y^2-7 x^4 y-3 x^3 y^3-x^3 y^2+8 x^3 y+2 x^3+34 x^2 y+2 x^2+x y^2-2 x-6\right)/\left(6 \left(2 x^2 y-1\right) \left(x^6 y^3+x^6 y^2-2 x^4 y^2+2 x^4 y+5 x^2 y+x^2-1\right)\right) \end{align*} Then

ContourPlot3D[{-6 - 2 x + 2 x^2 + 2 x^3 + 34 x^2 y + 8 x^3 y - 
7 x^4 y + 6 x^5 y + x y^2 - x^3 y^2 - 53 x^4 y^2 + 6 x^5 y^2 - 
21 x^6 y^2 + 6 x^7 y^2 - 3 x^3 y^3 - 3 x^5 y^3 + 12 x^6 y^3 - 
2 x^7 y^3 - 13 x^8 y^3 + 2 x^9 y^3 - 3 x^7 y^4 - 2 x^8 y^4 + 
2 x^9 y^4 - x^10 y^4 + 4 x^7 y^5 - x^9 y^5 + x^10 y^5 - 
6 (-1 + 2 x^2 y) (-1 + x^2 + 5 x^2 y + 2 x^4 y - 2 x^4 y^2 + 
   x^6 y^2 + x^6 y^3) z == 0,
2 x^2 + x^3 - x^4 + 10 x^2 y - 6 x^4 y + 6 x^5 y - 
4 x^6 y - 28 x^4 y^2 - 14 x^6 y^2 + 14 x^7 y^2 - 6 x^8 y^2 + 
26 x^6 y^3 - 4 x^8 y^3 + 16 x^9 y^3 - 4 x^10 y^3 - 8 x^8 y^4 + 
9 x^11 y^4 - x^12 y^4 + 8 x^10 y^5 - 2 x^12 y^5 + 2 x^13 y^5 == 1},
{x, -7, 7}, {y, -7, 7}, {z, -7, 7}, PlotPoints -> 70, Mesh -> None]

shows that indeed there are several branches of $y$ above the $(x,z)$ plane to sort out enter image description here

(The $f(x,y)=1$ surface is the blue one)

PS Just noticed the comment by Rahul with a link to a similar but much better solution. Will still leave mine as it is since it has been upvoted :P

$\endgroup$

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.