Expand expressions and simplify inputs of functions by using identities (2024)

Expand expressions and simplify inputs of functions by using identities

collapse all in page

Syntax

expand(S)

expand(S,Name,Value)

Description

example

expand(S) multiplies all parentheses in S, and simplifies inputs to functions such as cos(x + y) by applying standard identities.

example

expand(S,Name,Value) uses additional options specified by one or more name-value pair arguments. For example, specifying 'IgnoreAnalyticConstraints' as true uses convenient identities to simplify the input.

Examples

collapse all

Expand Symbolic Expression

syms xp = (x - 2)*(x - 4);expand(p)
ans =x^2 - 6*x + 8

Expand Trigonometric Expression

Expand the trigonometric expression cos(x + y). Simplify the cos function input x + y to x or y by applying standard identities.

Expand Exponential Expression

Expand e(a+b)2. Simplify the exp function input, (a + b)^2, by applying standard identities.

syms a bf = exp((a + b)^2);expand(f)
ans =exp(a^2)*exp(b^2)*exp(2*a*b)

Expand Vector of Expressions

Expand expressions in a vector. Simplify the inputs to functions in the expressions by applying identities.

syms tV = [sin(2*t), cos(2*t)];expand(V)
ans =[ 2*cos(t)*sin(t), 2*cos(t)^2 - 1]

Expand Only Arithmetic and Suppress Expansion of Functions

By default, expand both expands terms raised to powers and expands functions by applying identities that simplify inputs to the functions. Expand only terms raised to powers and suppress expansion of functions by using 'ArithmeticOnly'.

Expand (sin(3*x) - 1)^2. By default, expand will expand the power ^2 and simplify the sin input 3*x to x.

syms xf = (sin(3*x) - 1)^2;expand(f)
ans =2*sin(x) + sin(x)^2 - 8*cos(x)^2*sin(x) - 8*cos(x)^2*sin(x)^2... + 16*cos(x)^4*sin(x)^2 + 1

Suppress expansion of functions, such as sin(3*x), by setting ArithmeticOnly to true.

expand(f, 'ArithmeticOnly', true)
ans =sin(3*x)^2 - 2*sin(3*x) + 1

Simplify Log Input by Removing Constraints

Simplify the input of log function calls. By default, expand does not simplify logarithm input because the identities used are not valid for complex values of variables.

syms a b cf = log((a*b/c)^2);expand(f)
ans =log((a^2*b^2)/c^2)

Apply identities to simplify the input of logarithms by setting 'IgnoreAnalyticConstraints' to true.

expand(f,'IgnoreAnalyticConstraints',true)
ans = 2*log(a) + 2*log(b) - 2*log(c)

Input Arguments

collapse all

SInput
number | vector | matrix | array | symbolic number | symbolic variable | symbolic array | symbolic function | symbolic expression

Input, specified as a number, vector, matrix, or array, or a symbolic number, variable, array, function, or expression.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: expand(S,'ArithmeticOnly',true)

ArithmeticOnlyExpand only algebraic expressions
false (default) | true

Expand only algebraic expressions, specified as the comma-separated pair consisting of 'ArithmeticOnly' and true or false. If the value is true, the function expands the arithmetic part of an expression without expanding trigonometric, hyperbolic, logarithmic, and special functions. This option does not prevent the expansion of powers and roots.

IgnoreAnalyticConstraintsUse convenient identities for simplification
false (default) | true

Use convenient identities for simplification, specified as the comma-separated pair consisting of 'IgnoreAnalyticConstraints' and true or false.

Setting 'IgnoreAnalyticConstraints' to true can give you simpler solutions, which could lead to results not generally valid. In other words, this option applies mathematical identities that are convenient, but the results might not hold for all values of the variables. In some cases, this option can let expand return simpler results that might not be equivalent to the initial expression. See Algorithms.

Algorithms

When you use 'IgnoreAnalyticConstraints', expand applies some of these rules.

  • log(a) + log(b)=log(a·b) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c:

    (a·b)c=ac·bc.

  • log(ab)=b·log(a) for all values of a and b. In particular, the following equality is valid for all values of a, b, and c:

    (ab)c=ab·c.

  • If f and g are standard mathematical functions and f(g(x))=x for all small positive numbers, f(g(x))=x is assumed to be valid for all complex x.

    • log(ex)=x

    • asin(sin(x))=x, acos(cos(x))=x, atan(tan(x))=x

    • asinh(sinh(x))=x, acosh(cosh(x))=x, atanh(tanh(x))=x

    • Wk(x·ex)=x for all values of k

Version History

Introduced before R2006a

See Also

Functions

  • collect | combine | factor | horner | numden | rewrite | simplify | simplifyFraction

Live Editor Tasks

  • Simplify Symbolic Expression

Topics

  • Choose Function to Rearrange Expression
  • Simplify Symbolic Expressions
  • Simplify Symbolic Expressions Using Live Editor Task

MATLAB Command

You clicked a link that corresponds to this MATLAB command:

 

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

Expand expressions and simplify inputs of functions by using identities (1)

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

Expand expressions and simplify inputs of functions by using identities (2024)

FAQs

What is expand in Matlab? ›

expand( sigObj ) converts the representation of the signal that corresponds to the Simulink. sdi. Signal object sigObj from a single signal with nonscalar sample values to a set of signals with scalar sample values: one signal, called a channel, for each element in the multidimensional sample values.

What is symbolic expansion? ›

Symbolic expansion. expand(S) writes each element of a symbolic expression S as a product of its factors. expand is most often used only with polynomials, but also expands trigonometric, exponential, and logarithmic functions.

How to use simplify in Matlab? ›

S = simplify( expr ) performs algebraic simplification of expr . If expr is a symbolic vector or matrix, this function simplifies each element of expr . S = simplify( expr , Name,Value ) performs algebraic simplification of expr using additional options specified by one or more Name,Value pair arguments.

How do you expand code in MATLAB? ›

To expand or collapse all of the code in a file, place your cursor anywhere within the file, go to the View tab, and select the Expand All or Collapse All buttons. Alternatively, you can use the Ctrl+Shift+, (comma) and Ctrl+, (comma) keyboard shortcuts.

What does expand () do? ›

The EXPAND function in Excel is used to expand an array or range by adding additional rows and columns. This function is particularly useful when you need to increase the size of a dataset, either by extending its dimensions or by padding it with specific values.

How to do expanding brackets in algebra? ›

Expanding brackets, or multiplying out, involves multiplying every term inside the bracket by the term on the outside and then collecting like terms with the aim of removing the set of brackets. Expanding brackets is often an important step in solving equations and is the opposite process to factorisation.

What is an expansion symbol? ›

The expansion symbol is a small icon found on the right side of the middle line or type line on a Magic: The Gathering card and is a characteristic of that card. If a card is copied, the copy will keep its original expansion symbol. Evolution of the Core Set Expansion symbol.

What is a symbolic form of expression? ›

Refers to the intellectual process of finding a mathematical expression (often, an equation) or a symbolic expression that describes or summarizes a system or a collection of data.

What is simplify rules? ›

A 'Simplification Rule' in computer science refers to a transformation that reduces the problem size without changing the solution, thus helping to narrow down the search space for a solution.

What is an example of simplify in math? ›

For example, 1/2 (x + 4) can be simplified as x/2 + 2. Let us take one more example to understand it. Example: Simplify the expression: 3/4x + y/2 (4x + 7). By using the distributive property, the given expression can be written as 3/4x + y/2 (4x) + y/2 (7).

How can we simplify work? ›

Here are our Top Ten Tips for simplifying your work life:
  1. Preparation is key. ...
  2. Go back to basics. ...
  3. Ditch your emails. ...
  4. Take a break. ...
  5. Don't be distracted by social media. ...
  6. Recycle good ideas. ...
  7. Set realistic goals. ...
  8. Manage your time better.

What is expand and extend? ›

Although extend and expand can be used interchangeably in some contexts, extend applies to things that are being stretched out, while expand applies to things that are spread out. One implies length; the other area. If you extend your arm, for example, you stretch it out, making it longer.

Does expand mean in math? ›

Definition of Expansion in Math Expansion refers to the process of simplifying an expression or equation by multiplying out brackets, combining like terms, and eliminating common factors. It is an algebraic technique that makes it easier to work with complex equations and expressions.

How do you expand a matrix in MATLAB? ›

Expanding a Matrix

MATLAB automatically pads the matrix with zeros to keep it rectangular. For example, create a 2-by-3 matrix and add an additional row and column to it by inserting an element in the (3,4) position. You can also expand the size by inserting a new matrix outside of the existing index ranges.

What is expand in Mathematica? ›

The simplify command finds the simplest form of an equation. Simplify[expr,assum] does simplification using assumptions. Expand[expr,patt] leaves unexpanded any parts of expr that are free of the pattern patt. ExpandAll[expr] expands out all products and integer powers in ant part of exps.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Edwin Metz

Last Updated:

Views: 6261

Rating: 4.8 / 5 (78 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Edwin Metz

Birthday: 1997-04-16

Address: 51593 Leanne Light, Kuphalmouth, DE 50012-5183

Phone: +639107620957

Job: Corporate Banking Technician

Hobby: Reading, scrapbook, role-playing games, Fishing, Fishing, Scuba diving, Beekeeping

Introduction: My name is Edwin Metz, I am a fair, energetic, helpful, brave, outstanding, nice, helpful person who loves writing and wants to share my knowledge and understanding with you.