Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

unfreeze

Create an active copy of a frozen function

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

unfreeze(object)

Description

unfreeze(object) reactivates all inactive functions occurring in object, proceeding recursively along the structure of object, and then evaluates the result.

unfreeze uses misc::maprec to proceed recursively along the structure of object. This means that for basic domains such as arrays, tables, lists, or polynomials, the function unfreeze is applied to each operand of object.

If object is an element of a library domain, then the behavior of unfreeze is specified by the method maprec that overloads the function misc::maprec. If this method does not exist, then unfreeze has no effect on object. See Example 2.

unfreeze does not operate on the body of procedures. Therefore, it is recommended not to embed inactive functions inside procedures.

Examples

Example 1

Create an inactive form of the function environment int:

_int := freeze(int): F := _int(x*exp(x^2), x = 0..1)

The inactive form of int keeps every information that is known about the function int, for example, the output, the type, and the "float" slot for floating-point evaluation:

F, type(F), float(F)

The original function environment int is not modified by freeze:

int(x*exp(x^2), x = 0..1)

Use unfreeze to reactivate the inactive function _int and evaluate the result:

unfreeze(F), unfreeze(F + 1/2)

Example 2

The function unfreeze uses misc::maprec to operate recursively along the structure of object. For example, if object is an array containing inactive functions, such as:

a := array(1..2, 
  [freeze(int)(sin(x), x = 0..2*PI), freeze(sum)(k^2, k = 1..n)]
)

then unfreeze(a) operates on the operands of a:

unfreeze(a)

This means that for library domains, the effect of unfreeze is specified by the method maprec. If the domain does not implement this method, then unfreeze does not operate on the objects of this domain. For example, create a domain and an object containing an inactive function as its operand:

dummy := newDomain("dummy"):
o := new(dummy, freeze(int)(sin(x), x = 0..2*PI))

The function unfreeze applied to the object o has no effect:

unfreeze(o)

If you overload the function misc::maprec in order to operate on the first operand of objects of the domain dummy, then unfreeze operates on o as expected:

dummy::maprec := 
  x -> extsubsop(x,
    1 = misc::maprec(extop(x,1), args(2..args(0)))
  ):
unfreeze(o)

Parameters

object

Any MuPAD® object

Return Values

Evaluated version of object after reactivating all inactive functions in it.

See Also

MuPAD Functions

Was this topic helpful?