# plot a specific path on a surface

I have a 3D function (z = f(x, y)). I have plot it correctly as you can see below. Now, I want to show that there are two different paths to reach from Point A to Point B as shown in the following image. As you can see, I have done it using Shockwell in Linux. But, I want to do it in a clean manner in Mathematica. How can I plot a path from Point A to B while the path is on the surface?

And, if it is possible, as you can see, my preference is to draw an arrow. But, it is not totally necessary.

• What are the definitions of f and the specific paths? Sep 19, 2016 at 16:48
• – user9660
Sep 19, 2016 at 17:29

Draw your plot with Plot3D and your paths with ParametricPlot3D, then combine them with Show

zfunc[x_, y_] := Exp[x y];
path1[x_] := x^2
path2[x_] := Sqrt[x]

Show[
Plot3D[zfunc[x, y], {x, 0, 1.1}, {y, 0, 1.1}],
(ParametricPlot3D[{
{x, path1[x], zfunc[x, path1[x]]},
{x, path2[x], zfunc[x, path2[x]]}},
{x, 0, 1}, • To make the path always on top of the surface, you could manually put in an offset in the z-coordinate of the paths: ParametricPlot3D[{{x, path1[x], zfunc[x, path1[x]] + .01}, {x, path2[x], zfunc[x, path2[x]] + .01}} for example offsets the plot by 0.01 in the z-direction. Sep 21, 2016 at 19:50
• To bolden the lines, you could change Line-> Arrow to Line[pts_] :> Arrow[Tube[pts, .0075], {0, -.1}] Sep 21, 2016 at 19:53