convert/numericproc - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Conversion : convert/numericproc

convert/numericproc

convert a symbolic function of two variables to a numeric function of two variables

 Calling Sequence convert( f, numericproc)

Parameters

 f - function of two variables

Description

 • Converts a function of two variables into a numeric function of two variables that uses evalhf for low precision numerical evaluation, if possible, evalf otherwise.

Examples

 > $g≔\left(x,y\right)↦\mathrm{sin}\left(x\right)\cdot y-{y}^{3}$
 ${g}{≔}\left({x}{,}{y}\right){↦}{\mathrm{sin}}{}\left({x}\right){\cdot }{y}{-}{{y}}^{{3}}$ (1)
 > $f≔\mathrm{convert}\left(g,\mathrm{numericproc}\right)$
 ${f}{:=}{\mathbf{proc}}\left({x}{,}{y}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{local}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{r}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{try}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{r}{:=}{\mathrm{evalhf}}{}\left({g}{}\left({x}{,}{y}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{catch}}{:}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end try}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{if}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{not}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{type}}{}\left({r}{,}{'}{\mathrm{numeric}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{then}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{try}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{r}{:=}{\mathrm{evalf}}{}\left({g}{}\left({x}{,}{y}\right)\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{catch}}{:}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end try}}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end if}}{;}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathrm{if}}{}\left({\mathrm{type}}{}\left({r}{,}{'}{\mathrm{numeric}}{'}\right){,}{r}{,}{'}{\mathrm{undefined}}{'}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (2)