Defining/Checking assumptions on symoblic arrays

1 次查看(过去 30 天)
Hi all,
I have been encountering a problem/inconsistency while using Matlab 2011b for defining and checking symbolic variable assumptions.
Even the example from the help file does not properly identify the assumptions on the following variable:
A = sym('A%d%d', [2 2]);
A = sym(A, 'positive');
evalin(symengine,'getprop(A(1,1))')
ans =
C_
evalin(symengine,'getprop(A)')
ans =
C_
However, it actually does obey the assumptions, atleast for this example from the help. (below)
solve(A(1, 1)^2 - 1, A(1, 1))
ans =
1
This problem does not happen for scalar variables, that does work properly.
Is there a way to check the assumptions on a whole array/matrix or even the different elements that comprise the array/matrix? Given the two checks on properties above it does not seem so.
Might it be a problem that needs me switching to the newest version (2012); however I am hesitant to do this because last time I found errors with 2010 symbolic and compiler toolboxes, upon upgrading to 2011 I found that the subs() has changed functionality and would no longer substitute vectors properly (this problem has been referenced by others in the Matlab Answers).
Thanks for any help that can be provided, Joe

回答(1 个)

Christopher Creutzig
The name inside MuPAD is not A(1,1). Try this instead:
A = sym('A%d%d', [2 2]);
A = sym(A, 'positive');
feval(symengine, 'getprop', A(1,1))
ans =
Dom::Interval(0, Inf)
I'm not sure I know which problem with subs and vectors you refer to. I know of one issue that was fixed in 2012a.

类别

Help CenterFile Exchange 中查找有关 Properties and Assumptions 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by