Error, invalid input: f2 expects its 1st argument, x, to be of type numeric, but received x - Maple Help

Home : Support : Online Help : Error, invalid input: f2 expects its 1st argument, x, to be of type numeric, but received x

Error, (in ...) invalid input: ... expects its ... argument, ..., to be of type ..., but received ...

 Description This error occurs when the argument to a command is of the wrong type.

Examples

Example

 >

Examine the argument using the whattype command. Use the Describe command (or review the command's help page) to see correct usage.

 > $\mathrm{whattype}\left(\left[1,2,3\right]\right);$
 ${\mathrm{list}}$ (2.1)

Here, whattype returns list--the argument $\left[1,2,3\right]$ used in the example is of type list. To see the valid arguments for the sin command, use Describe.

 > $\mathrm{Describe}\mathit{}\left(\mathrm{sin}\right)$

 sin( x::algebraic )

When you use the Describe command on a Maple object, it returns the type of an object and its value. In this example, Describe(sin) returns the value $x$ and the type algebraic.  Lists are not a valid subset of type/algebraic. For this example, the argument must be of type algebraic.

To find out more information about $\mathrm{sin}$, see the sin help page. See Describe for more information about the Describe command and its uses beyond Maple objects.

Solution 1: Use an argument of type algebraic.

 > $\mathrm{sin}\left(1\right);\mathrm{sin}\left(2\right);\mathrm{sin}\left(3\right)$
 ${\mathrm{sin}}{}\left({1}\right)$
 ${\mathrm{sin}}{}\left({2}\right)$
 ${\mathrm{sin}}{}\left({3}\right)$ (2.2)

Solution 2:  Use the element-wise operator ~ to apply sin to every element in a list.

 > $\mathrm{sin}~\left(\left[1,2,3\right]\right)$
 $\left[{\mathrm{sin}}{}\left({1}\right){,}{\mathrm{sin}}{}\left({2}\right){,}{\mathrm{sin}}{}\left({3}\right)\right]$ (2.3)