## `plotfunc3d` -- 3D plots of function graphs

#### Introduction

`plotfunc3d``(f1, f2, ...)` generates a 3D plot of the graphs of the bivariate functions `f1`, `f2` etc.

#### Call(s)

`plotfunc3d( <SceneOptions,> f1, f2, ... <, Grid = [nx, ny]>)`
`plotfunc3d( <SceneOptions,> f1, f2, ..., x = xmin..xmax <, Grid = [nx, ny]>)`
`plotfunc3d( <SceneOptions,> f1, f2, ..., x = xmin..xmax, y = ymin..ymax <, Grid = [nx, ny]>)`

#### Parameters

`f1, f1, ...` | - | the functions: arithmetical expressions or `piecewise` objects containing two indeterminates `x`, `y`
`x, y` | - | the independent variables: identifiers
`xmin, xmax` | - | the plot range for `x`: finite real numerical expressions
`ymin, ymax` | - | the plot range for `y`: finite real numerical expressions

#### Options

`SceneOptions` | - | a sequence of scene options. These determine the general appearance of the graphical scene. See `?plotOptions3d` for details.
`Grid = [nx, ny]` | - | sets the number of sample points in the x and y direction. The integers `nx`, `ny` must be larger than 1; the default is Grid = `[20, 20]`.

#### Returns

MuPAD's graphics tool is called to render the graphical scene. The `null``()` object is returned to the MuPAD session.

#### Related Functions

`plot`, `plot::Function3d`, `plot2d`, `plot3d`, `plotfunc2d`

#### Details

- The functions must not contain any symbolic parameters apart from `x` and `y` that cannot be converted to floating point values.
- If no plot range is specified, the default ranges `x = -5..5` and `y = -5..5` are used.
- Piecewise defined functions are handled. Cf. example 4.
- The graph of a function f(x, y) can also be plotted by `plot3d` as a parametrized surface:

         [Mode = Surface, [x, y, f(x, y)], x = [xmin, xmax],
          y = [ymin, ymax] <, Options>]:

  This way ranges, color options, style options etc. can be specified separately for each function. See the help page of `plot3d` for details.
- The `plot` library provides the routine `plot::Function3d` which allows to create a function graph as a graphical primitive, and to combine it with other graphical objects.
- MuPAD graphics can be saved in a variety of graphical formats. In a `plotfunc3d` command, the PlotDevice scene option allows to specify the conversion into the two MuPAD specific formats 'Ascii' and 'Binary'. See the help page `plotOptions3d` for details.

  For graphical standard formats such as Postscript, JPEG, TIFF etc., no direct conversion is available by a plot command inside a MuPAD session. Instead, conversion has to be requested interactively via the graphical interface of the rendering tool VCam. In a MuPAD Pro notebook, double click on the graphics to activate this interface. Using the menu item ``Edit/Save Graphics ..'', you can choose the desired format in the ``Export Graphics'' dialog box.

#### Option: Grid = `[nx, ny]`

- This option determines the number of sample points in the x and y direction. The graphics uses linear interpolation between adjacent sample points. The integers `nx`, `ny` must be larger than 1; the default is Grid = `[20, 20]`. Large values of `nx`, `ny` generate a smooth graph.

#### Example 1

The following command draws two functions over the unit square:

    >> plotfunc3d(BackGround = RGB::White,
                  ForeGround = RGB::Black,
                  Axes = Box,
                  sin(x^2 + y^2), cos(x^2 - y^2),
                  x = 0..1, y = 0..1):

#### Example 2

We demonstrate the effect of various scene options:

    >> plotfunc3d(Axes = Box, Ticks = 5,
                  abs(x + I*y), x = -1..1, y = -1..1)

    >> plotfunc3d(Arrows = FALSE, Axes = Corner, Ticks = 8,
                  Grid = [40, 40], CameraPoint = [10, -5, 15],
                  abs(x + I*y), x = -1..1, y = -1..1)

#### Example 3

In contrast to `plotfunc2d`, non-real function values cause an error:

    >> plotfunc3d(sqrt(1 - x^2 - y^2), x = -1..1, y = -1..1):

          Error: Plot function(s) must return real numbers.
                 Type of the returned value is DOM_COMPLEX;
          during evaluation of 'plot3d'

#### Example 4

Piecewise defined functions are handled:

    >> f := piecewise([x < y, -x^2 + 1], [x >= y, 1 - y^2]):
       plotfunc3d(BackGround = RGB::White,
                  ForeGround = RGB::Black,
                  Ticks = [Steps = 1, Steps = 1, Steps = 1],
                  f(x, y), x = -3..3, y = -3..3)

    >> delete f:

#### Example 5

We use the scene option AxesScaling to create a logarithmic plot:

    >> plotfunc3d(AxesScaling = [Lin, Lin, Log],
                  exp(x + y^2), x = 0..10, y = 0..10):

#### Changes

- The functionality of the scene option Ticks was extended.
- The default values of various options were changed.
- Scene titles as well as object titles can now be moved interactively by the mouse.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000