I took me years to figure out how did we plot such a picture in this entry. Thanks to MuPAD, we can do it quite easily. What I got is the following

Firstly, we need to choose a function which has a mountain-pass shape. Thank to a special solution to the Toda system considered in this entry, we can choose

.

To plot such a function, we use

`f1 := plot::Function3d(`

ln(4*(1+4*abs(x+y*I)^2+abs(((x+y*I)^2+2*(x+y*I))^2))/((1+abs((x+1)+(y+1)*I)+abs((x+y*I)^4))^2)),

x = -1.3..1.3,

y = -1.3..1.3,

Submesh = [2,1],

CameraDirection = [3,4,2]);

Next we try to plot a curve on the surface. To this purpose, we use

`f2 := plot::Curve3d([x,`

1/4-x^4,

ln(4*(1+4*abs(x+(1/4-x^4)*I)^2+abs(((x+(1/4-x^4)*I)^2+2*(x+(1/4-x^4)*I))^2))/((1+abs((x+1)+((1/4-x^4)+1)*I)+abs((x+(1/4-x^4)*I)^4))^2))],

x = -1/8..1,

LineWidth = 0.5,

AdaptiveMesh = 2,

LineStyle = Solid);

Note that, the way to do it is to parametrize the surface. Since each point lying within the surface, its coordinates is nothing but

then what we need to do is to replace by a function of , for e.g. from above. Therefore, can be regarded as a parameter. The range of the curve is determined by the range of parameter , from above, it is from to .

Finally, we need to put two end points. These points are determined by the range of . We use the following

`p1 := plot::Point3d([1,`

1/4-1^4,

ln(5681/64/(1/4*65^(1/2) + 881/256)^2)],

Color = RGB::Blue, PointSize = 2*unit::mm);

`p2 := plot::Point3d([-1/8,`

1/4-1/8^4,

ln(447856773689345/70368744177664/(1/4096*39049217^(1/2) + 283187601731585/281474976710656)^2)],

Color = RGB::Blue, PointSize = 2*unit::mm);

Putting on everything by using

`plot(f1, f2, p1, p2, Axes = None);`

Here is the result

### Like this:

Like Loading...

*Related*

thank you very much for this useful entry

Comment by Dan — March 25, 2011 @ 20:33

Dear sir,

the problem I would like to solve is related to representation of constrained optimization problems in MUPAD, but in broader terms, this could apply to a variety of cases.

I actually comes pretty close to what you posted in “MuPAD: Drawing a surface with a line on”, but a straightforward extension of its indications to the case I am strudying seems not possible.

To exemplify, my problem is to trace on the surface of a target function like, for instance, z = x^2+y^2 its intersection with, say, a plane (the constraint) that according to its inclination would result on the surface of the target function in an ellipse, a circle or a parabola.

Of course, in a more general setting, the constraint itself needs not be linear.

The natural choice would seem plot::curve3d, but I have no clue on how to parametrize the constraint function when it is a quadratic function such as an ellipse or a circle.

Also, all my initial equations are expressed in Cartesian coordinates.

Thank you very moch for any suggestion you could offer on the subject.

Regards

Comment by Dan — April 18, 2011 @ 19:01