Warning, expecting only range variable x in expression sin(pi*x) to be plotted but found name pi - Maple Help

Home : Support : Online Help : Warning, expecting only range variable x in expression sin(pi*x) to be plotted but found name pi

Warning,  expecting only range variable ... in expressions ... to be plotted but found name ...

 Description This warning occurs when the expression that you are trying to plot contains an undefined variable other than the plotting variable.

Examples

Example 1: Using the variable $e$ instead of the exponential constant e

In Maple, you can use letters as variables even when that letter is also used to represent a particular mathematical constant, such as the exponential constant $ⅇ$ or the imaginary unit $i$.  If you simply type $e$ or $i$, you get the variable. In this example, the letter $e$ has been used.

 > $\mathrm{plot}\left({e}^{x},x=0..1\right)$

This is analogous to trying to plot ${a}^{x}$ when $a$ does not have a value.

Solution 1 (Standard math notation): To plot this expression, replace ${e}^{x}$ with ${ⅇ}^{x}$, where $ⅇ$ is the exponential constant.  (Note: When using standard mathematical notation in Maple, variables are displayed in italics, so $e$ is the variable, $ⅇ$ is the constant.)  You can enter the exponential constant by using the Expression or Common Symbols palettes, or you can enter it using symbol completion:

Type e, then press Esc, and select Exponential 'e' from the popup list.

 > $\mathrm{plot}\left({ⅇ}^{x},x=0..1\right)$

Solution 2 (Maple syntax): Use the exp function to enter exponentials.

 > plot(exp(x), x = 0 .. 1);

Example 2: Using pi instead of Pi or $\mathrm{\pi }$

 > plot(sin(pi*x), x = 1 .. 2);

Solution 1 (Maple syntax):  Use "Pi" instead of "pi".

 > plot(sin(Pi*x), x = 1 .. 2);

Solution 2 (Standard math notation):  Enter the $\pi$ symbol using symbol completion (type pi, press Esc, and select $\pi$ from the popup list) or using the Common Symbols palette.

 > $\mathrm{plot}\left(\mathrm{sin}\left(\mathrm{\pi }x\right),x=1..2\right)$

Example 3: Using the variable $\mathbit{i}$ instead of the imaginary unit $\mathbf{i}$

In Maple, you can use letters as variables even when that letter is also used to represent a particular mathematical constant, such as the exponential constant $ⅇ$ or the imaginary unit $i$.  If you simply type $e$ or $i$, you get the variable. In this example, the letter $i$ has been used.

 > $\mathrm{plot3d}\left(\mathrm{abs}\left(x+i\cdot y\right),x=1..10,y=1..10\right)$

Solution 1 (Standard math notation): To plot this expression, replace the variable $i$ with the imaginary unit $i$. (Note: When using standard mathematical notation in Maple, variables are displayed in italics, so $i$ is the variable, but $i$ is the imaginary unit.)  You can enter the imaginary unit by using the Common Symbols palette, or you can enter it using symbol completion:

Type $i$, then press Esc, and select Imaginary 'i' from the popup list.

 > $\mathrm{plot3d}\left(\mathrm{abs}\left(x+i\cdot y\right),x=1..10,y=1..10\right)$

Solution 2 (Maple syntax): Use uppercase $I$ instead of lowercase $i$. Maple uses $I$ to represent one of the square roots of -1.

 > $\mathrm{plot3d}\left(\mathrm{abs}\left(x+I\cdot y\right),x=1..10,y=1..10\right)$

Example 4: Variable mismatch: parametric plot

In this example, the variable name used in the arguments for the real functions to be plotted do not match the variable name given to the range variable.

 > $\mathrm{plot}\left(\left[\mathrm{sin}\left(t\right),\mathrm{cos}\left(t\right),x=0..\mathrm{\pi }\right]\right)$

Solution: Changing one of the variable names to match the other solves this problem. Here, has been changed to $x.$

 > $\mathrm{plot}\left(\left[\mathrm{sin}\left(x\right),\mathrm{cos}\left(x\right),x=0..\mathrm{\pi }\right]\right)$

Example 5: Forgetting to assign a value to a variable

The constant $a$ has not been assigned a value.

 > $\mathrm{plot}\left(a+{x}^{2},x=0..2,\mathrm{view}=\left[0..2,0..8\right]\right)$

Solution 1: Assign a value to $a$

 > $a≔5$
 ${a}{≔}{5}$ (2.1)
 > $\mathrm{plot}\left(a+{x}^{2},x=0..2,\mathrm{view}=\left[0..2,0..8\right]\right)$

Solution 2: Use Explore to see how the plot depends on the parameter $a$.

Note: To interact with the solution provided below, open this help page as a worksheet and then move the slider.

From the Context Panel for the plot expression, select Explore.  Use the default settings in the dialog box and click Explore to see the resulting interactive application. Use the slider to see how the graph depends on the parameter $a$.

 > $\mathrm{restart}$
 > $\mathrm{plot}\left(a+{x}^{2},x=0..2,\mathrm{view}=\left[0..2,0..8\right]\right)$

$\mathbf{a}$

Example 6: Forgetting to assign a value to a variable, multiple curves

Similar to Example 5, in the list of expressions to be plotted, the first expression contains an undefined constant, $b$.  As a result, only one curve is plotted.

 > $\mathrm{plot}\left(\left[x+b,{x}^{2}\right],x=-1..1\right)$

Solution:  Assign a value to $b$

 > $b≔7$
 ${b}{≔}{7}$ (2.2)
 > $\mathrm{plot}\left(\left[x+b,{x}^{2}\right],x=-1..1\right)$

Now both curves are plotted.

Example 7: Mismatched variable names: 3-D plot example

 > $\mathrm{plot3d}\left(\left[\mathrm{sin}\left(z\right),\mathrm{cos}\left(z\right),z+{y}^{2}\right],x=-1..1,y=-1..1\right)$

Solution: The expression is defined in terms of $z$ and $y$, but the ranges are defined in terms of $x$ and $y$.  Making them match fixes the problem.

 > $\mathrm{plot3d}\left(\left[\mathrm{sin}\left(x\right),\mathrm{cos}\left(x\right),x+{y}^{2}\right],x=-1..1,y=-1..1\right)$