Warning, unable to evaluate the function to numeric values in the region; complex values were detected - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Error Message Guide : complexvaluesdetected


 

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

 

 

Description

Examples

See Also

 

 

Description

 

 

This warning occurs when the expression that you are trying to plot contains undefined variable(s) other than the plotting variable(s).

 

Examples

 

 

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

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

 

plot(e^x, x = 0 .. 1)

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

 

 

 

Maple cannot plot e^x just like it cannot plot a^x when a does not have a value.

 

Solution 1 (Standard math notation): To plot this expression, replace e^x with exp(x), where e is the exponential constant. (Note: When using standard mathematical notation in Maple, variables are displayed in italics, so e is the variable, and e 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 the Esc key, and select Exponential 'e' from the menu.

plot(exp(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 Pi

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):  When using Maple syntax, use "Pi" instead of "pi".

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

 

Solution 2 (Standard math notation): When using standard math notation, you can enter Pi using symbol completion (type 'pi' and press Esc then select Pifrom the menu) or using the Common Symbols palette.

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

 

 

 


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

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

 

plot3d(abs(i*y+x), 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 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 palettes, or you can enter it using symbol completion: Type 'i', then press the Esc key, and select Imaginary 'i' from the menu.

 

plot3d(abs(x+I*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.

plot3d(abs(x+I*y), x = 1 .. 10, y = 1 .. 10)

 

Example 4: Variable mismatch: Parametric plot

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

plot([sin(t), cos(t), x = 0 .. Pi])

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, thas been changed to "x."

plot([sin(x), cos(x), x = 0 .. Pi])

 

 

 

 

Example 5: Forgetting to assign a value to a variable

The constant a has not been assigned a value.

plot(a+x, x = 1 .. 2)

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

 

 

Solution: Assign a value to a

a := 5

5

 

plot(a+x, x = 1 .. 2)

 

 

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, x+bcontains an undefined constant, b. As a result, only one curve is plotted.

plot([x+b, x^2], 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

b := 7

7

 

plot([x+b, x^2], x = -1 .. 1)

 

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

plot3d([sin(z), cos(z), y^2+z], 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 . Making them match fixes the problem.

plot3d([sin(x), cos(x), y^2+x], x = -1 .. 1, y = -1 .. 1)

 

See Also

 

plot, plot3d, plots[complexplot]