expecting only range variable - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : expecting only range variable

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

 

Description

Examples

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 .  If you simply type e or i, you get the variable. In this example, the letter e has been used.

plotex,x=0..1

Warning, if e is meant to be the exponential e, use command/symbol completion or palettes to enter this special symbol, or use the exp function

Warning, expecting only range variable x in expression e^x to be plotted but found name e

 

This is analogous to trying to plot ax when a does not have a value.

Solution 1 (Standard math notation): To plot this expression, replace ex 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.

plotⅇx,x=0..1

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 π

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

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

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

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

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

plotsinπx,x=1..2

Example 3: Using the variable i instead of the imaginary unit

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 .  If you simply type e or i, you get the variable. In this example, the letter i has been used.

plot3dabsx+iy,x=1..10,y=1..10

Warning, expecting only range variables [x, y] in expression abs(i*y+x) to be plotted but found name i

 

Solution 1 (Standard math notation): To plot this expression, replace the variable i with the imaginary unit . (Note: When using standard mathematical notation in Maple, variables are displayed in italics, so i is the variable, but  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.

 

plot3dabsx+y,x=1..10,y=1..10

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

plot3dabsx+Iy,x=1..10,y=1..10

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.

plotsint,cost,x=0..π

Warning, expecting only range variable x in expressions [sin(t), cos(t)] to be plotted but found name t

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

plotsinx,cosx,x=0..π

 

 

 

 


Example 5: Forgetting to assign a value to a variable

The constant a has not been assigned a value.

plota+x2,x=0..2,view=0..2,0..8

Warning, expecting only range variable x in expression x^2+a to be plotted but found name a

Solution 1: Assign a value to a

a5

a5

(2.1)

plota+x2,x=0..2,view=0..2,0..8

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.

restart

plota+x2,x=0..2,view=0..2,0..8

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.

plotx+b,x2,x=1..1

Warning, expecting only range variable x in expression x+b to be plotted but found name b

Solution:  Assign a value to b

b7

b7

(2.2)

plotx+b,x2,x=1..1

Now both curves are plotted.

 

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

plot3dsinz,cosz,z+y2,x=1..1,y=1..1

Warning, expecting only range variables [x, y] in expressions [sin(z), cos(z), y^2+z] to be plotted but found name z

 

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.

plot3dsinx,cosx,x+y2,x=1..1,y=1..1

See Also

plot

plot3d

plots[complexplot]

Using the Exploration Assistant

How Do I Enter a Simple Expression?