The Essential Maple

Scott Esterholm and Mark Pond

Critical Functions

restart; - Command to reset all variables.   Should be used at top of every program.

?command – Calls up Maple help on a command.

; - Executes command line and shows result.

: - Executes command line and hides result.

:= - Variable assignment operator.   (NOT =)

funct := var -> expr(var); - Creates a function with respect to a variable

simplify(expr, assume=positive); - Simplifies the format of an expression as stored by

Maple.   This format of simplify will take care of extraneous radicals.

convert(expr, form); - Converts an expression to a certain format.   Examples of forms

include exp , trig , D , diff or even units when done in the following way:

convert(num, units, oldUnits, newUnits); For a complete list, use ?convert .

evalf(expr); - Evaluates with floating point numbers. (gets rid of fractions / Pi)

solve(expr, var); - Solves an expression for a specified variable.

solve({expr1, …, exprN},{var1, …, varN}); - Solves n equations for n unknowns.

diff(expr, var); - Takes the first derivative of the expression with respect to the variable.

diff(expr, var1, …., varN); - Takes derivative with respect to all N variables.

D(funct); - Takes derivative of function.

D[M](funct)(var1, …, varN); - Takes derivative of multi-variable function with respect to

Mth variable.

int(expr, var); - Takes indefinite integral with respect to the variable.

int(expr, var = A…B); - Takes definite integral with respect to the variable from A to B.

dsolve(deq, funct(var)); - Solves differential equation for given function.

dsolve({deq, BC1, …, BCN}, funct(var)); - Solves differential equation for given

function and boundary conditions.

assign(soln); funct := unapply(funct(var), var); - Takes a solution from a solver and

assigns it as a function.

[v1, …, vN]; - Makes a vector with N entries.

[[a11, …, a1N], …, [aM1, …, aMN]]; - Makes a M x N array

map(funct, expr); - A linear mapping of a function onto an expression (which can be a

vector or array).

dchange(transforms, expr, [NewVar1, …, NewVarN]); - Performs a change of

variables on an expression.   First must use the following command: with(PDEtools); .  

The variable transforms should be defined as the following:

transforms := {var1 = expr1, …, varN = exprN}; where the expressions are in terms

of the new variables.

LeastSquares(xdata, ydata, xvar, curve = expr(x)); - Performs a least squares

regression for a set of data.   First must use the following command: with(CurveFitting); .  

For a linear regression, expr(x) should be ‘A*x+B’.

LeastSquares(xydata, xvar, curve = expr(x)); - Same function as above, except

xydata is an array of the form [[x1,y1], …, [xN,yN]].

Plot Functions

plot(funct(var), var = A…B); - Plots a function over a given interval.

plot(xydata); - Plots a set of points. xydata is an array of the form [[x1,y1], …, [xN,yN]].  

If the data is in two separate vectors of length N, xdata and ydata, then they can

be merged into a single vector, xydata, with the following command:

xydata := [[xdata[j], ydata[j]]$j=1…N];

plot({funct1(var), …, functN(var), xydata1, …, xydataN}, var = A…B); - Plots multiple

functions and data sets over a given interval.

Plot Formatting Example

plot({xydata1, xydata2, xydata3}, labels = [“x”,”y”], title = “Example Plot”,

style = [line, point, point], color = [red, blue, black]);

The labels command labels the x and y axes.   The title command gives the plot a title.  

The style command will differentiate between data expressed as points and lines.   The color

command changes the color of a set of data.   There is also a legend command, which can only

be used for functions.

Helpful Hints

Unit Conversion – Make statements of the following form:

            DesiredUnit := x*CurrentUnit;

where x is equal to DesiredUnit divided by CurrentUnit

# - Comment on a command line

CTRL + K - Insert Execution Group ABOVE Cursor

CTRL + J - Insert Execution Group BELOW Cursor

CTRL + SHIFT + K - Insert Comment ABOVE Cursor

CTRL + SHIFT + J - Insert Comment BELOW Cursor

SHIFT + ENTER - Moves cursor to new line in execution group (for ease of reading)

!!! (Button at Top) - Executes entire program

Red Octagon (i.e. Stop Sign Button at top toolbar) - Halts program execution

Note: Most graphical and matrix applications should be done in Matlab.

(Updated April 2005)

Link to Downloadable Microsoft Word Document

Home | Maple Cheat Sheet | New Assignment Order

Unix Review and Introduction to Maple | Graphic Design

Basic Maple Techniques | Advanced Maple Topics

Project by: Scott Esterholm and Mark Pond

assignment operator in maple

Maple Tutorial Under the terms of the GNU General Public License GPL for the First Course

Email: Vladimir Dobrushkin | (Monday, September 30, 2019 11:34:18 AM)

This web site provides an introduction to the computer algebra system Maple, created by MapleSoft ©. This tutorial is made solely for the purpose of education, and intended for students taking APMA 0330 (Methods of Applied Mathematics - I) course at Brown University. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043

Maple is a computer algebra system (CAS for short) that is able to give exact solutions in an analytic form to numerous problems related to differential equations. In addition to symbolic computation packages, Maple incorporate many numerical algorithms for approximating solutions to problems that do not admit exact solutions. It also contains graphic programs allowing visualization of information and results.

Maple is structured on two levels. the basic level, the 'kernel', of about 10%, contains primitive and fundamental commands, and algorithms for arithmetic and polynomial calculus. The higher level, maple's library, of about 90%, contains maple code that can be called on commands, and numerous specialized packages, such as LinearAldebra or DEtools .

Maple is a large, complex computer algebra system, only part of which is introduced in this tutorial. If you have not taken or are not taking a course regarding Maple or programming, such as CSCI 0150 (Introduction to Object-Oriented Programming and Computer Science) or ENGN 0030 (Introduction to Engineering), then please begin from Chapter 1 . Otherwise, please proceed with this Introduction . For those who have used Maple before, please note that there are certain commands and sequences of input that is specific to solving differential equations, so it is best to read through this tutorial in its entirety. This tutorial is based on latest version of Maple, but some pages are not updated. Therefore, tutorials from other sources may or may not be compatible with this tutorial.

The commands in this tutorial are all written in red text (as Maple input), while Maple output is in blue , which means that the output is in 2D output style. You can copy and paste all commands into Maple, change the parameters and run them. You, as the user, are free to use the mw files and scripts to your needs, and have the rights to distribute this tutorial and refer to this tutorial as long as this tutorial is accredited appropriately. The tutorial accompanies the textbook Applied Differential Equations. The Primary Course by Vladimir Dobrushkin, CRC Press, 2015; http://www.crcpress.com/product/isbn/9781439851043. Any comments and/or contributions for this tutorial are welcome; you can send your remarks to < [email protected] >

0.1. Introduction

assignment operator in maple

In Maple, mathematical expressions are typed directly after Maple prompt, which can be either sland (/) or right carrot (>), depending on the input specification. We drop writing a Maple prompt to simplify copying and pasting corresponding scripts. In the previous versions of Maple, the semicolomn (;) was required to indicate the end of input command. In the latest versions it is redundant. Throughout Tutorial, we present Maple commands in red color (as Maple input), while Maple output is in blue , which means that the output is in 2D output style. To switch your input into Maple input, type Ctrl-M or use options Maple Input/monocpaced in math mode or Maple input , depending on Maple's version. Everything that is typed after # is ignored by Maple. This tutorial will be completed in the default Mathsheet Mode -- 2D Math. Therefore, any Maple prompt is ignored and all commands are typed in red plain text.

0.0.1. Arithmetic Operationss

The symbols +, -, *, /, and ^ (or **) denote addition, subtraction, multiplication, division, and exponentiation (4^2 = 4**2 = 16). When a string of operations are specified in a command, MAPLE first does exponentiations, then multiplications and divisions, then additions and subtractions. To change the order, use parentheses. Editing commands. If you make a mistake in a command (like forgetting a semicolon) or want to change a command, you can go back and edit the command with the cursor and mouse as you would a word-processor text. Operating on the last result. Use a percentage character (%) to refer to the result of the last calculation, and a double percentage character (%%) to refer to the next-to-last result. For example,

5*2; 10 7 + %; 17

Exact arithmetic and floating-point arithmetic MAPLE calculates fractions (exact arithmetic) unless you specify that you want decimals (floating-point arithmetic) with the evalf function ("evalf" stands for "evaluate using floating-point arithmetic"):

25/27 + 3/51;

evalf(%) 0.9847494553

To specifies number of digits, type

evalf[25](%)

Using evalf or Digits affects the number digits used to perform the floating-point computations.

You can get help with MAPLE syntax by using the HELP menu, as described previously. If you have a question about a particular command, you can quickly get help by typing a question mark followed by the command name (no semicolon). For example,

will open a window containing information about what the evalf function does and how to use it.

Close the help window. Click on the little box at the upper left of the window and select Close.

0.1.2. Algebraic Operations/variables/constants

This section of the tutorial will be compltered in Math environment -- 2D Math.

Try the following input (Type in exactly as you see it. Do not include the left carrot > , as this is only for showing Maple input in forms of text other than in Maple):

> |(x^3+x+sqrt(x))/(Pi*x-1)|;               # comments are typed here

The resulting output should be:

assignment operator in maple

Greek Letters

To insert a Greek letter into Maple, type the name of the letter, for example gamma, and then hit the escape key. Uppercase Greek letters can be inserted by making the first letter of your text uppercase, for example Gamma. Sometimes the escape key will bring up a menu that will allow you to choose between several different options.

Using subscripts in Maple to differentiate between variables can be extremely useful. To insert a subscript, type an underscore ( _ ). When you are done, press the right arrow key to get back to normal input. This notation is not perfect. If you are using a variable with a subscript, don’t assign a value the variable alone. For example if you are using x1 and x2, don’t assign anything to just x. Doing so will generate recursive expression error messages or cause your code not to function properly.

Clearing Variables

The restart command will clear all variables and all packages: > restart

Variables can also be cleared manually. To do this we reassign the variable to its own name within single quotations. > x:=10

> 5*x+15

> x:='x'

In older versions of Maple, every command line had to end with a semicolon. This is no longer the case in Maple 14 or later versions. However, semicolons can still be used to run multiple expressions on the same line. This is sometimes useful for defining variables. If you make a mistake in a command (like forgetting a semicolon) or want to change a command, you can go back and edit the command with the cursor and mouse as you would a word-processor text.

0.1.3. Constants and Packages

In Maple, the constant Pi is the irrational number 3.1415...; it is denoted by Pi, not by pi ( \( \pi \) ) neither by PI ( \( \Pi ,\) ) which is upper case Greek letter.

Exponential Function In Maple, e is just a variable. To use e you must use either use the Expression Pallete to call e or use exp(x)

Euler's Totient Function First type with(numtheory) then use the calling sequence:phi(n) where n is an integer

Fibonacci with(combinat): Call sequence: fibonacci(n) where n is an integer. Computes the nth Fibonacci number F(n). For a sequence of Fibonacci numbers, say the 0-10th, type seq(fibonacci(i),i=0..10)

Bernoulli Call sequence: bernoulli(n) where n -nonnegint; the index of the required Bernoulli number or polynomial

Stirling Number Call sequence: Stirling1(n,m) where m and n are positive intergers May have to type the next line after you already called the call sequence =convert(,Sum)

Euler Numbers Call Sequence: euler(n,x) where n is a non-negative integer and x is an expression The function euler computes the nth Euler number, or the nth Euler polynomial in x

There are a few things to note when defining mathematical expressions:

  • Types of operations are expressed as + (addition), - (subtraction), *(multiplication), / (division).
  • Exponents are expressed with carrots ^. Beware that when you input exponents, you must hit the right arrow key afterwards or else you will continue to type into the exponent. The same concept applies to division; when you are typing in the numerator/denominator, in order to move the blinking cursor outside of the fraction, you must hit the arrow keys to move it outside of the fraction (Clicking works as well).
  • Type math first and then press [Enter] to see the result. And the result will show on the nest line.
  • Type math first and then press [Ctrl][=] and then the result will show on the same line as the math you typed.
  • Asking further questions: place your cursor on the result and then the context menu will offer several further operations such as integration and derivative.
  • You can always go back to the calculations you entered and change the numbers to get new results.
  • Maple has over 1000 palette symbols to input data.
  • You can use the Handwriting palette to find the symbol you want.
  • You can type in the first few characters of the symbol and then press [Ctrl][Space] to choose the symbol you want from the list.
  • To multiply two variables, a space has to be inserted. “a b” means a times b, while ‘ab’ means a variable whose name is ‘ab’.
  • Maple understands mathematical notation such as y’ (y prime).
  • Absolute values are expressed with vertical lines ||. They can also be expressed using the abs( ) command.
  • Square roots (radicals) are expressed with the input sqrt( ).
  • The percent sign ( % ) can be used as shorthand for the most recent output.
  • When inputting π, you must type in Pi. Maple will not accept pi as π.
  • When using division, be sure to separate the numerators and denominators with parentheses to prevent errors.
  • In new versions of Maple, typing semicolumn (;) at the end of mathematical expression is not needed.
  • When you wish to substitute a variable with a value, use the subs command. The generic syntax is as follows: subs(value, equation); Therefore, if we use the above equation to substitute x with the value -2, we have: subs(x=-2, %) 10 For more complicated equations where after substitution you still have an equation, remember you can use evalf(%)
  • The % is a special symbol which takes in the most recently inputted equation. This is a useful symbol to use to avoid assigning equations to variables.
  • You will notice in #7 that the resulting output will not be a specific value, but another equation with the x substituted with -2. Therefore, you may use the evalf command to receive a specific answer. The syntax is straightforward and simple, you just have to input the equation back in. evalf(%); 1.386687900 If you want to see more digits, say 25, type evalf[25](%); or evalf(%, 25)

In Maple, defining functions is done by the command “:=”, followed by expression involving independent variable, which is x in our case. When you type, do not include the right carrot >, as this is only for showing Maple input in forms of text other than in Maple:

> f:=x->x^3+x+sqrt(x);

Note that the square root sqrt(x) can be defined as x^(1/2) or x^(0.5); however, it will slow down all numerical computations because Maple uses logarithm for its representation and the corresponding calculations are based on different algorithm.

0.1.4. Substitution

The command

> g:=unapply(f,x);

configures the expression f as a function of x. This has two effects.

(i) It enables you to call for the value of f at a particular value of x. For example g(a) will then be the expression f with x replaced by a. This is obviously useful in imposing boundary conditions.

(ii) It ensures that Maple will treat all other parameters in f as being independent of x. You will find this useful if at any point you get output including derivatives of quantities you want to treat as constants.

4. Another way of obtaining the expression f with x replaced by a is to use the `subs' command:-

> g:=subs(x=a,f);

More than one substitution can be made at the same time, for example

> g:=subs({x=a,y=b},f);

Notice that the separate substitutions are separated by commas and the complete set is then enclosed in {....}.

Once you have given a value to an expression (e.g. x=a , Maple will assume that value for all subsequent calculations, including new runs of the code. If you want to change such an assignment, you will need to issue the command

> restart;

which essentially erases the effect of all previous calculations.

  • Introduction
  • Getting started
  • Basic operations
  • Complex numbers
  • Logical operators
  • Lists and sets
  • Simplification
  • Maple commands
  • Solving equations
  • Derivatives
  • Picard iterations
  • Adomian iterations
  • Plotting functions
  • Plotting solutions to ODEs
  • Discontinuous functions
  • Direction fields
  • Implicit plot
  • Parametric plots
  • Labeling figures
  • Figures with arrows
  • Electric circuits
  • Plotting with filling
  • Some famous curves
  • Solutions of ODEs
  • Singular solutions
  • Solving first order ODEs
  • Phase portrait
  • Separable equations
  • Equations reducible to the separable equations
  • Equations with linear fractions
  • Exact equations
  • Integrating factors ▾
  • Function of x
  • Function of y
  • Function of xy
  • Function of x/y
  • Function of x ² + y ²
  • Common factors
  • Homogeneous factors
  • Special factors
  • Approximation of integrating factors
  • Linear equations
  • RC circuits
  • Bernoulli equations
  • Riccati equations
  • Clairaut equations
  • Qualitative Analysis ▾
  • Qualitative analysis
  • Bifurcations
  • Landau theory
  • Validity interval
  • Orthogonal trajectories
  • Population models
  • Applications
  • Fixed point iteration
  • Bracketing methods
  • Secant methods
  • Comparisons
  • Padé approximation
  • Euler's Methods ▾
  • Backward method
  • Heun method
  • Modified Euler method
  • Runge-Kutta methods ▾
  • Runge--Kutta methods of order 2
  • Runge--Kutta methods of order 3
  • Runge--Kutta methods of order 4
  • Polynomial approximations
  • Error estimates
  • Adomian Decomposition Method
  • Modified Decomposition Method
  • Finite Difference Schemes
  • Variational iteration method
  • Multi-step Methods ▾
  • Multistep methods of order 3
  • Multistep methods of order 4
  • Milne method
  • Hamming method
  • Differential equations of higher order
  • Canonical forms
  • Reduction higher order ODEs
  • Linear operators
  • Fundamental sets of solutions
  • Linear ODEs
  • Constant coefficient ODEs
  • Complex roots
  • Reduction of order
  • Annihilator operators
  • Method of undetermined coefficients
  • Variation of parameters
  • Operator methods
  • Factorization
  • Euler Equations ▾
  • Inhomogeneous Euler equations
  • Numerical solutions
  • Boundedness of solutions
  • Spring Problems ▾
  • Free vibrations
  • Damped vibrations
  • Forced vibrations
  • Nonlinear models
  • Driven models
  • Pendulum ▾
  • Simple pendulum
  • Solution of pendulum equation
  • Period of pendulum
  • Real pendulum
  • Driven pendulum
  • Rocking pendulum
  • Pumping swing
  • Pertubation
  • Recurrences
  • Discrete logistic recurrence
  • Generating functions
  • Lagrange Inversion Theorem
  • Series convergence
  • Review of power series
  • Convergence acceleration
  • Nonlinear ODEs
  • Series solutions for first order equations
  • Series solutions for the second order equations
  • Examples of second order ODEs
  • Euler equations
  • Regular Singular Points ▾
  • Distinct exponents
  • Equal exponents
  • Integer difference
  • Complex exponents
  • Polynomial solutions
  • Bessel's equations
  • Picard iterations for the second order ODEs
  • MDM for first order ODEs
  • MDM for second order ODEs
  • ADM for first order ODEs
  • ADM for second order ODEs
  • Definition of Laplace transform
  • Heaviside and Dirac function
  • Laplace transform of discontinuous functions
  • Table of Laplace transforms
  • Inverse Laplace transform
  • Convolution integral
  • Residue method
  • Solving IVPs with Laplace transform
  • ODEs with discontinuous input
  • Nonconstant coefficient IVP’s
  • Bessel functions
  • Elzaki transform
  • Boundary Value Problems
  • Hyperbolic functions
  • Green functions
  • Finite difference schemes
  • Shooting methods
  • Tridiagonal linear systems
  • Numerov method
  • Adomian Decomposition
  • Blasius layer
  • Falkner--Skan layer
  • Heat transfer
  • Singular BVPs
  • • Computing APMA0330
  • • Computing APMA0340
  • • Maple tutorial APMA0330
  • • Maple tutorial APMA0340
  • • Main page for APMA0330
  • • Main page for APMA0340
  • Trending Now
  • Foundational Courses
  • Data Science
  • Practice Problem
  • Machine Learning
  • System Design
  • DevOps Tutorial

Assignment Operators in Programming

  • Binary Operators in Programming
  • Operator Associativity in Programming
  • C++ Assignment Operator Overloading
  • What are Operators in Programming?
  • Assignment Operators In C++
  • Bitwise AND operator in Programming
  • Increment and Decrement Operators in Programming
  • Types of Operators in Programming
  • Logical AND operator in Programming
  • Modulus Operator in Programming
  • Solidity - Assignment Operators
  • Augmented Assignment Operators in Python
  • Pre Increment and Post Increment Operator in Programming
  • Right Shift Operator (>>) in Programming
  • JavaScript Assignment Operators
  • Move Assignment Operator in C++ 11
  • Assignment Operators in Python
  • Assignment Operators in C
  • Subtraction Assignment( -=) Operator in Javascript

Assignment operators in programming are symbols used to assign values to variables. They offer shorthand notations for performing arithmetic operations and updating variable values in a single step. These operators are fundamental in most programming languages and help streamline code while improving readability.

Table of Content

What are Assignment Operators?

  • Types of Assignment Operators
  • Assignment Operators in C++
  • Assignment Operators in Java
  • Assignment Operators in C#
  • Assignment Operators in Javascript
  • Application of Assignment Operators

Assignment operators are used in programming to  assign values  to variables. We use an assignment operator to store and update data within a program. They enable programmers to store data in variables and manipulate that data. The most common assignment operator is the equals sign ( = ), which assigns the value on the right side of the operator to the variable on the left side.

Types of Assignment Operators:

  • Simple Assignment Operator ( = )
  • Addition Assignment Operator ( += )
  • Subtraction Assignment Operator ( -= )
  • Multiplication Assignment Operator ( *= )
  • Division Assignment Operator ( /= )
  • Modulus Assignment Operator ( %= )

Below is a table summarizing common assignment operators along with their symbols, description, and examples:

OperatorDescriptionExamples
= (Assignment)Assigns the value on the right to the variable on the left.  assigns the value 10 to the variable x.
+= (Addition Assignment)Adds the value on the right to the current value of the variable on the left and assigns the result to the variable.  is equivalent to 
-= (Subtraction Assignment)Subtracts the value on the right from the current value of the variable on the left and assigns the result to the variable.  is equivalent to 
*= (Multiplication Assignment)Multiplies the current value of the variable on the left by the value on the right and assigns the result to the variable.  is equivalent to 
/= (Division Assignment)Divides the current value of the variable on the left by the value on the right and assigns the result to the variable.  is equivalent to 
%= (Modulo Assignment)Calculates the modulo of the current value of the variable on the left and the value on the right, then assigns the result to the variable.  is equivalent to 

Assignment Operators in C:

Here are the implementation of Assignment Operator in C language:

Assignment Operators in C++:

Here are the implementation of Assignment Operator in C++ language:

Assignment Operators in Java:

Here are the implementation of Assignment Operator in java language:

Assignment Operators in Python:

Here are the implementation of Assignment Operator in python language:

Assignment Operators in C#:

Here are the implementation of Assignment Operator in C# language:

Assignment Operators in Javascript:

Here are the implementation of Assignment Operator in javascript language:

Application of Assignment Operators:

  • Variable Initialization : Setting initial values to variables during declaration.
  • Mathematical Operations : Combining arithmetic operations with assignment to update variable values.
  • Loop Control : Updating loop variables to control loop iterations.
  • Conditional Statements : Assigning different values based on conditions in conditional statements.
  • Function Return Values : Storing the return values of functions in variables.
  • Data Manipulation : Assigning values received from user input or retrieved from databases to variables.

Conclusion:

In conclusion, assignment operators in programming are essential tools for assigning values to variables and performing operations in a concise and efficient manner. They allow programmers to manipulate data and control the flow of their programs effectively. Understanding and using assignment operators correctly is fundamental to writing clear, efficient, and maintainable code in various programming languages.

Please Login to comment...

Similar reads.

  • Programming

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

  • Index »
  • Complete Language Index »

Assignment Operator ( = ) ¶

Stores the value to the right of the equal sign in the variable to the left of the equal sign.

The single equal sign in the C++ programming language is called the assignment operator. It has a different meaning than in algebra class, where it indicated an equation or equality. The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign [1] .

Programming Tips ¶

The variable on the left side of the assignment operator ( = sign) needs to be able to hold the value stored in it. If it is not large enough to hold a value, the value stored in the variable will be incorrect.

Don’t confuse the assignment operator = (single equal sign) with the comparison operator == (double equal signs), which evaluates whether two expressions are equal.

Arduino Compatibility ¶

Assignments on the Maple are identical to those on Arduino.

Experienced C++ programmers know this to be an oversimplification of what happens when the variable on the left hand side is an object. See Richard Gillam’s wonderful and scary for more information.

License and Attribution

Portions of this page were adapted from the Arduino Reference Documentation , which is released under a Creative Commons Attribution-ShareAlike 3.0 License .

Table Of Contents

  • IDE Installation
  • Command-Line Toolchain
  • Arduino Compatibility
  • Troubleshooting
  • GCC and libc for Maple
  • Language Index
  • External Interrupts
  • Maple RET6 Edition
  • Maple Native β

Quick search

Enter search terms or a module, class or function name.

  • Skip to main content
  • Skip to search
  • Skip to select language
  • Sign up for free
  • Português (do Brasil)

Expressions and operators

This chapter documents all the JavaScript language operators, expressions and keywords.

Expressions and operators by category

For an alphabetical listing see the sidebar on the left.

Primary expressions

Basic keywords and general expressions in JavaScript. These expressions have the highest precedence (higher than operators ).

The this keyword refers to a special property of an execution context.

Basic null , boolean, number, and string literals.

Array initializer/literal syntax.

Object initializer/literal syntax.

The function keyword defines a function expression.

The class keyword defines a class expression.

The function* keyword defines a generator function expression.

The async function defines an async function expression.

The async function* keywords define an async generator function expression.

Regular expression literal syntax.

Template literal syntax.

Grouping operator.

Left-hand-side expressions

Left values are the destination of an assignment.

Member operators provide access to a property or method of an object ( object.property and object["property"] ).

The optional chaining operator returns undefined instead of causing an error if a reference is nullish ( null or undefined ).

The new operator creates an instance of a constructor.

In constructors, new.target refers to the constructor that was invoked by new .

An object exposing context-specific metadata to a JavaScript module.

The super keyword calls the parent constructor or allows accessing properties of the parent object.

The import() syntax allows loading a module asynchronously and dynamically into a potentially non-module environment.

Increment and decrement

Postfix/prefix increment and postfix/prefix decrement operators.

Postfix increment operator.

Postfix decrement operator.

Prefix increment operator.

Prefix decrement operator.

Unary operators

A unary operation is an operation with only one operand.

The delete operator deletes a property from an object.

The void operator evaluates an expression and discards its return value.

The typeof operator determines the type of a given object.

The unary plus operator converts its operand to Number type.

The unary negation operator converts its operand to Number type and then negates it.

Bitwise NOT operator.

Logical NOT operator.

Pause and resume an async function and wait for the promise's fulfillment/rejection.

Arithmetic operators

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value.

Exponentiation operator.

Multiplication operator.

Division operator.

Remainder operator.

Addition operator.

Subtraction operator.

Relational operators

A comparison operator compares its operands and returns a boolean value based on whether the comparison is true.

Less than operator.

Greater than operator.

Less than or equal operator.

Greater than or equal operator.

The instanceof operator determines whether an object is an instance of another object.

The in operator determines whether an object has a given property.

Note: => is not an operator, but the notation for Arrow functions .

Equality operators

The result of evaluating an equality operator is always of type boolean based on whether the comparison is true.

Equality operator.

Inequality operator.

Strict equality operator.

Strict inequality operator.

Bitwise shift operators

Operations to shift all bits of the operand.

Bitwise left shift operator.

Bitwise right shift operator.

Bitwise unsigned right shift operator.

Binary bitwise operators

Bitwise operators treat their operands as a set of 32 bits (zeros and ones) and return standard JavaScript numerical values.

Bitwise AND.

Bitwise OR.

Bitwise XOR.

Binary logical operators

Logical operators implement boolean (logical) values and have short-circuiting behavior.

Logical AND.

Logical OR.

Nullish Coalescing Operator.

Conditional (ternary) operator

The conditional operator returns one of two values based on the logical value of the condition.

Assignment operators

An assignment operator assigns a value to its left operand based on the value of its right operand.

Assignment operator.

Multiplication assignment.

Division assignment.

Remainder assignment.

Addition assignment.

Subtraction assignment

Left shift assignment.

Right shift assignment.

Unsigned right shift assignment.

Bitwise AND assignment.

Bitwise XOR assignment.

Bitwise OR assignment.

Exponentiation assignment.

Logical AND assignment.

Logical OR assignment.

Nullish coalescing assignment.

Destructuring assignment allows you to assign the properties of an array or object to variables using syntax that looks similar to array or object literals.

Yield operators

Pause and resume a generator function.

Delegate to another generator function or iterable object.

Spread syntax

Spread syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created.

Comma operator

The comma operator allows multiple expressions to be evaluated in a single statement and returns the result of the last expression.

Specifications

Specification

Browser compatibility

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

  • Operator precedence
  • Programming

Rahul Awati

  • Rahul Awati

What is an operator in mathematics and programming?

In mathematics and computer programming , an operator is a character that represents a specific mathematical or logical action or process. For instance, "x" is an arithmetic operator that indicates multiplication, while "&&" is a logical operator representing the logical AND function in programming.

Depending on its type, an operator manipulates an arithmetic or logical value, or operand, in a specific way to generate a specific result. From handling simple arithmetic functions to facilitating the execution of complex algorithms, like security encryption , operators play an important role in the programming world.

Mathematical and logical operators should not be confused with a system operator , or sysop, which refers to a person operating a server or the hardware and software in a computing system or network.

Operators and logic gates

In computer programs, Boolean operators are among the most familiar and commonly used sets of operators. These operators work only with true or false values and include the following:

These operators and variations, such as XOR, are used in logic gates .

Boolean operators can also be used in online search engines , like Google. For example, a user can enter a phrase like "Galileo AND satellite" -- some search engines require the operator be capitalized in order to generate results that provide combined information about both Galileo and satellite.

Types of operators

There are many types of operators used in computing systems and in different programming languages. Based on their function, they can be categorized in six primary ways.

1. Arithmetic operators

Arithmetic operators are used for mathematical calculations. These operators take numerical values as operands and return a single unique numerical value, meaning there can only be one correct answer.

The standard arithmetic operators and their symbols are given below.

+

Addition (a+b)

This operation adds both the operands on either side of the + operator.

-

Subtraction (a-b)

This operation subtracts the right-hand operand from the left.

*

Multiplication (a*b)

This operation multiplies both the operands.

/

Division (a/b)

This operation divides the left-hand operand by the operand on the right.

%

Modulus (a%b)

This operation returns the remainder after dividing the left-hand operand by the right operand.

2. Relational operators

Relational operators are widely used for comparison operators. They enter the picture when certain conditions must be satisfied to return either a true or false value based on the comparison. That's why these operators are also known as conditional operators.

The standard relational operators and their symbols are given below.

==

Equal (a==b)

This operator checks if the values of both operands are equal. If yes, the condition becomes TRUE.

!=

Not equal (a!=b)

This operator checks if the values of both operands are equal. If not, the condition becomes TRUE.

>

Greater than (a>b)

This operator checks if the left operand value is greater than the right. If yes, the condition becomes TRUE.

<

Less than (a<b)

This operator checks if the left operand is less than the value of right. If yes, the condition becomes TRUE.

>=

Greater than or equal (a>=b)

This operator checks if the left operand value is greater than or equal to the value of the right. If either condition is satisfied, the operator returns a TRUE value.

<=

Less than or equal (a<=b)

This operator checks if the left operand value is less than or equal to the value of the right. If either condition is satisfied, the operator returns a TRUE value.

3. Bitwise operators

Bitwise operators are used to manipulate bits and perform bit-level operations . These operators convert integers into binary before performing the required operation and then showing the decimal result.

The standard bitwise operators and their symbols are given below.

&

Bitwise AND (a&b)

This operator copies a bit to the result if it exists in both operands. So, the result is 1 only if both bits are 1.

|

Bitwise OR (a|b)

This operator copies a bit to the result if it exists in either operand. So, the result is 1 if either bit is 1.

^

Bitwise XOR (a^b)

This operator copies a bit to the result if it exists in either operand. So, even if one of the operands is TRUE, the result is TRUE. However, if neither operand is TRUE, the result is FALSE.

~

Bitwise NOT (~a)

This unary operator flips the bits (1 to 0 and 0 to 1).

4. Logical operators

Logical operators play a key role in programming because they enable a system or program to take specific decisions depending on the specific underlying conditions. These operators take Boolean values as input and return the same as output.

The standard logical operators and their symbols are given below.

&&

Logical AND (a&&b)

This operator returns TRUE only if both the operands are TRUE or if both the conditions are satisfied. It not, it returns FALSE.

||

(a||b)

This operator returns TRUE if either operand is TRUE. It also returns TRUE if both the operands are TRUE. If neither operand is true, it returns FALSE.

!

Logical NOT (!a)

This unary operator returns TRUE if the operand is FALSE and vice versa. It is used to reverse the logical state of its (single) operand.

5. Assignment operators

Assignment operators are used to assign values to variables. The left operand is a variable, and the right is a value -- for example, x=3.

The data types of the variable and the value must match; otherwise, the program compiler raises an error, and the operation fails.

The standard assignment operators and their symbols are given below.

=

Assignment (a=b)

This operator assigns the value of the right operand to the left operand (variable).

+=

Add and assign (a+=b)

This operator adds the right operand and the left operand and assigns the result to the left operand.

Logically, the operator means a=a+b.

-=

Subtract and assign (a-=b)

This operator subtracts the right operand from the left operand and assigns the result to the left operand.

Logically, the operator means a=a-b.

*=

Multiply and assign (a*=b)

This operator multiplies the right operand and the left operand and assigns the result to the left operand.

Logically, the operator means a=a*b.

/=

Divide and assign (a/=b)

This operator divides the left operand and the right operand and assigns the result to the left operand.

Logically, the operator means a=a/b.

%=

Modulus and assign (a%=b)

This operator performs the modulus operation on the two operands and assigns the result to the left operand.

Logically, the operator means a=a%b.

6. Increment/decrement operators

The increment/decrement operators are unary operators, meaning they require only one operand and perform an operation on that operand. They sometimes are called monadic operators .

The standard increment/decrement operators and their symbols are given below.

++

Post-increment (a++)

This operator increments the value of the operand by 1 after using its value.

--

Post-decrement (a--)

This operator decrements the value of the operand by 1 after using its value.

++

Pre-increment (++a)

This operator increments the value of the operand by 1 before using its value.

--

Pre-decrement (--a)

This operator decrements the value of the operand by 1 before using its value.

See also: proximity operator , search string , logical negation symbol , character and mathematical symbols .

Continue Reading About operator

  • How to become a good Java programmer without a degree
  • How improving your math skills can help in programming
  • 10 best IT certs for beginners
  • Top 22 cloud computing skills to boost your career in 2022
  • Binary and hexadecimal numbers explained for developers

Related Terms

NBASE-T Ethernet is an IEEE standard and Ethernet-signaling technology that enables existing twisted-pair copper cabling to ...

SD-WAN security refers to the practices, protocols and technologies protecting data and resources transmitted across ...

Net neutrality is the concept of an open, equal internet for everyone, regardless of content consumed or the device, application ...

A proof of concept (PoC) exploit is a nonharmful attack against a computer or network. PoC exploits are not meant to cause harm, ...

A virtual firewall is a firewall device or service that provides network traffic filtering and monitoring for virtual machines (...

Cloud penetration testing is a tactic an organization uses to assess its cloud security effectiveness by attempting to evade its ...

Regulation SCI (Regulation Systems Compliance and Integrity) is a set of rules adopted by the U.S. Securities and Exchange ...

Strategic management is the ongoing planning, monitoring, analysis and assessment of all necessities an organization needs to ...

IT budget is the amount of money spent on an organization's information technology systems and services. It includes compensation...

ADP Mobile Solutions is a self-service mobile app that enables employees to access work records such as pay, schedules, timecards...

Director of employee engagement is one of the job titles for a human resources (HR) manager who is responsible for an ...

Digital HR is the digital transformation of HR services and processes through the use of social, mobile, analytics and cloud (...

A virtual agent -- sometimes called an intelligent virtual agent (IVA) -- is a software program or cloud service that uses ...

A chatbot is a software or computer program that simulates human conversation or "chatter" through text or voice interactions.

Martech (marketing technology) refers to the integration of software tools, platforms, and applications designed to streamline ...

Top.Mail.Ru

Current time by city

For example, New York

Current time by country

For example, Japan

Time difference

For example, London

For example, Dubai

Coordinates

For example, Hong Kong

For example, Delhi

For example, Sydney

Geographic coordinates of Elektrostal, Moscow Oblast, Russia

City coordinates

Coordinates of Elektrostal in decimal degrees

Coordinates of elektrostal in degrees and decimal minutes, utm coordinates of elektrostal, geographic coordinate systems.

WGS 84 coordinate reference system is the latest revision of the World Geodetic System, which is used in mapping and navigation, including GPS satellite navigation system (the Global Positioning System).

Geographic coordinates (latitude and longitude) define a position on the Earth’s surface. Coordinates are angular units. The canonical form of latitude and longitude representation uses degrees (°), minutes (′), and seconds (″). GPS systems widely use coordinates in degrees and decimal minutes, or in decimal degrees.

Latitude varies from −90° to 90°. The latitude of the Equator is 0°; the latitude of the South Pole is −90°; the latitude of the North Pole is 90°. Positive latitude values correspond to the geographic locations north of the Equator (abbrev. N). Negative latitude values correspond to the geographic locations south of the Equator (abbrev. S).

Longitude is counted from the prime meridian ( IERS Reference Meridian for WGS 84) and varies from −180° to 180°. Positive longitude values correspond to the geographic locations east of the prime meridian (abbrev. E). Negative longitude values correspond to the geographic locations west of the prime meridian (abbrev. W).

UTM or Universal Transverse Mercator coordinate system divides the Earth’s surface into 60 longitudinal zones. The coordinates of a location within each zone are defined as a planar coordinate pair related to the intersection of the equator and the zone’s central meridian, and measured in meters.

Elevation above sea level is a measure of a geographic location’s height. We are using the global digital elevation model GTOPO30 .

Elektrostal , Moscow Oblast, Russia

Maplesoft logo

Powerful math software that is easy to use

Maple Addon Icon

  • Maple Add-Ons

MapleSim Icon

Advanced System Level Modeling

MapleSim Addon Icon

  • MapleSim Add-Ons

MapleMBSE Icon

Systems Engineering

Engineering Services Icon

  • Consulting Services

DigitalEd Icon

Maple T.A. and Möbius

Book Icon

Automotive and Aerospace

Machine design & industrial automation.

Atom Icon

  • Application Areas
  • Product Pricing
  • Institutional Student Licensing
  • Maplesoft Elite Maintenance (EMP)
  • Product Training
  • Online Product Help
  • Webinars & Events
  • Publications
  • Content Hubs
  • Examples & Applications
  • About Maplesoft
  • Media Center
  • User Community

Maplesoft logo

  • Maple Learn
  • Maple Calculator App
  • System Engeneering
  • Online Education Products

Online Help

All products    maple    maplesim.

Functional Operators

 

Description

• 

A functional operator in Maple is a special form of a procedure. Functional operators are written using arrow notation.

vars → result

  

Here, vars is a sequence of variable names (or a single variable) and result is the result of the procedure acting on vars.

• 

For example, the following

x → x 2

  

represents the function that squares its argument.

• 

Multivariate and vector functions are also allowed. You must put parentheses around vars or result whenever they are expression sequences. For example, the following functions have the correct syntax.

x , y → x 2 + y 2

x → 2 ⁢ x , 3 ⁢ x 4

x , y , z → x ⁢ y , y ⁢ z

• 

You can also create a functional operator by using the unapply command.  (See .)

• 

A functional operator of the form:

  

is semantically equivalent to:

proc(vars) option operator, arrow; result end

• 

The identity operator is expressed as  for any variable name x.

• 

Constant operators do not simplify to numbers. For example,  does not simplify to .

• 

Expressions such as  do not simplify to . This is invalid if  can also take fewer or greater than one argument.

• 

Note that optional and keyword parameters (see the  help page for more information on these) cannot be used in functional operators. However, type specifiers for parameters are supported.  If a type specifier is used, then the parameters must be enclosed in parentheses, even in the case of a single parameter.

Examples

(1)

(2)

(3)

(4)

(5)

(6)

(7)

See Also

Download Help Document

Download a Free Trial of Maple

Free Maple for Students

Try Maple free for 15 days with no obligation.

Maple 2024 now available.

Free Maple for Students

Save an additional 20% on Maple 2024 Upgrades until March 31, 2024.

IMAGES

  1. Example for MAPLE Assignment 1 2 .pdf

    assignment operator in maple

  2. Maple Assignment Help & Writing Service in Australia

    assignment operator in maple

  3. Arithmetic Operations in Maple

    assignment operator in maple

  4. PPT

    assignment operator in maple

  5. Assignment operator

    assignment operator in maple

  6. Maple Command for Partial Differentiation, Math Lecture

    assignment operator in maple

VIDEO

  1. Create A Data Sample And Trend Display -- Maple Systems Touchscreen HMI

  2. Core

  3. #20. Assignment Operators in Java

  4. Displaying Multiple Languages -- Maple Systems Touchscreen HMI

  5. Assignment Operator In C Language New 5

  6. Pastor Jerome (Sam) Tarver

COMMENTS

  1. 5 Maple Statements

    Special Semantics of the ,= Assignment Operator. In most cases, the operator assignment a ,= b is equivalent to a = a,b, forming an expression sequence from the values of a and b, and assigning it back to variable a.. In the special case where the value of the left hand side is a one dimensional Array, the Array is expanded and the right hand side appended to the Array in-place.

  2. PDF Maple for Math Majors 2. Variables, Assignment, and Equations 2.2

    In Maple, we can label and manipulate anything using just a few basic commands.. > Lastly, here is an interesting feature of Maple's assignment operator. We can use the assignment operator to assign more than one variable at a time. > x, y := 1, 2; > x, y; We need to have as many values on the right hand side of the assignment operator as we have

  3. assign

    Whenever an assignment is made to a local variable with such a type assertion, the type of the right-hand side is checked after evaluation, but before the assignment is done. ... The assign command is thread safe as of Maple 15, provided that the name or function being assigned to is not shared between threads. • For more information on ...

  4. PDF Lesson 2: Variables, Assignment and Equations

    What Maple is saying here is that x can be anything, and then a is . Oh, but that's not what I meant, I wanted it to solve for x. But Maple doesn't read minds. I have to tell it what I want it to do. solve(a + 3*x = 5, x); If I put the x in curly braces, Maple doesn't just return the value of x, it returns an equation, also in curly braces.

  5. PDF Maple for Math Majors

    Maple does not have any knowledge of this convention so in an expression Maple treats all unassigned names (i.e., all unknowns) as variables. In all the examples of expressions and Maple functions given above, we never gave any of them a name. But we can always use the assignment operator to give an expression or function a name, and

  6. Basic Maple Syntax

    Assignment operator The := operator can be used to assign a Maple expression to a variable name. This expression could be anything from a constant to the output of a Maple command. This is particularly useful if the output will be used in subsequent Maple commands. For example, the command r:= 5; assigns the value 5 to the variable r. The command

  7. Maple Cheat Sheet

    The Essential Maple. Scott Esterholm and Mark Pond . Critical Functions. restart; -Command to reset all variables. Should be used at top of every program.?command - Calls up Maple help on a command.; - Executes command line and shows result.: - Executes command line and hides result.:= - Variable assignment operator. (NOT =) funct := var -> expr(var); - Creates a function with respect to a ...

  8. Basic Commands in Maple

    assignment operator, assign a value to a variable, un-assign the value in maple, special operators in maple, Pai in maple exponential in maple, logarithm in ...

  9. Maple Tutorial I

    Throughout Tutorial, we present Maple commands in red color (as Maple input), while Maple output is in blue, which means that the output is in 2D output style. To switch your input into Maple input, type Ctrl-M or use options Maple Input/monocpaced in math mode or Maple input, depending on Maple's version.

  10. syntax

    Maple Syntax As much as possible, Maple conforms to standard linear expression notation and precedence rules. ... The syntactic expression operators in Maple are shown below in order of precedence (lowest to highest), where all the operators in a given group have the same precedence. ... assignment statement ( a ) a parenthesized expression (to ...

  11. Comparison Operators (==, !=, <, >, <=, >=)

    The comparison operators ==, !=, <, >, <=, and >= are used to compare two numbers. They are true when the comparison is true, and false otherwise. They are based on the symbols =, ≠, <, >, ≤, and ≥ from mathematics. Here are some examples, with their meaning in comments: The parentheses are optional; they are present only for clarity.

  12. Assignment Operators in Programming

    Assignment operators are used in programming to assign values to variables. We use an assignment operator to store and update data within a program. They enable programmers to store data in variables and manipulate that data. The most common assignment operator is the equals sign (=), which assigns the value on the right side of the operator to ...

  13. Assignment Operator (=)

    The assignment operator tells the microcontroller to evaluate whatever value or expression is on the right side of the equal sign, and store it in the variable to the left of the equal sign . ... Assignments on the Maple are identical to those on Arduino.

  14. Expressions and operators

    An assignment operator assigns a value to its left operand based on the value of its right operand. The simple assignment operator is equal (=), which assigns the value of its right operand to its left operand.That is, x = f() is an assignment expression that assigns the value of f() to x. There are also compound assignment operators that are shorthand for the operations listed in the ...

  15. Expressions and operators

    Basic keywords and general expressions in JavaScript. These expressions have the highest precedence (higher than operators ). The this keyword refers to a special property of an execution context. Basic null, boolean, number, and string literals. Array initializer/literal syntax. Object initializer/literal syntax.

  16. PDF Maple for Math Majors

    In Maple, we can label and manipulate anything using just a few basic commands. > Lastly, here is an interesting feature of Maple's assignment operator. We can use the assignment operator to assign more than one variable at a time. > x, y := 1, 2; > x, y; We need to have as many values on the right hand side of the assignment operator as we have

  17. What is an operator in programming?

    5. Assignment operators. Assignment operators are used to assign values to variables. The left operand is a variable, and the right is a value -- for example, x=3. The data types of the variable and the value must match; otherwise, the program compiler raises an error, and the operation fails.

  18. <Text-field style="Heading 1" layout="Heading 1">2.1. Introduction

    All variables begin their life in Maple as unassigned variables. To change an unassigned variable to an assigned one, we use the assignment operator, which is a colon followed by an equal sign (i.e. :=). A Maple command with an assignment operator in it is called an assignment statement. Here are some examples of assigned and unassigned variables.

  19. Moscow Oblast

    Moscow Oblast ( Russian: Моско́вская о́бласть, Moskovskaya oblast) is a federal subject of Russia. It is located in western Russia, and it completely surrounds Moscow. The oblast has no capital, and oblast officials reside in Moscow or in other cities within the oblast. [1] As of 2015, the oblast has a population of 7,231,068 ...

  20. Elektrostal

    In 1938, it was granted town status. [citation needed]Administrative and municipal status. Within the framework of administrative divisions, it is incorporated as Elektrostal City Under Oblast Jurisdiction—an administrative unit with the status equal to that of the districts. As a municipal division, Elektrostal City Under Oblast Jurisdiction is incorporated as Elektrostal Urban Okrug.

  21. Elektrostal

    Elektrostal. Elektrostal ( Russian: Электроста́ль) is a city in Moscow Oblast, Russia. It is 58 kilometers (36 mi) east of Moscow. As of 2010, 155,196 people lived there.

  22. 2 Maple Language Elements

    The Maple element-wise operators are listed in Table 2.5. For more information about these operators, refer to the operators,elementwise help page. Table 2.5: Element-wise Operators ... Use only valid names on the left-hand side of an assignment statement. Incorrect Syntax in Parse. The parse command accepts a string as its argument. An ...

  23. Geographic coordinates of Elektrostal, Moscow Oblast, Russia

    Geographic coordinates of Elektrostal, Moscow Oblast, Russia in WGS 84 coordinate system which is a standard in cartography, geodesy, and navigation, including Global Positioning System (GPS). Latitude of Elektrostal, longitude of Elektrostal, elevation above sea level of Elektrostal.

  24. operators

    Operators Description Descriptions are available for Maple's programming-language operators (binary, unary, nullary, and element-wise operators), Maple's algebra of functional operators, and defining properties of neutral operators. For descriptions...

  25. Define a Function

    Functional Operators Description Examples Description A functional operator in Maple is a special form of a procedure. Functional operators are written using arrow notation. Here, vars is a sequence of variable names (or a single variable) and result...