Is there any discrete mathematics solver for symbolic equations ?

7 ビュー (過去 30 日間)
Tamura Kentai
Tamura Kentai 2020 年 7 月 6 日
コメント済み: Walter Roberson 2020 年 7 月 9 日
Hi, :
Excuse me, I have surveyed some, but no similar solution. So that may I ask some opinions from you.
That's if it's possible to solve the symbolic equations (simplify), which similar to the 'solve()', in continuous time questions.
For example:
(1). w[n] = x[n] + a*w[n-1]
(2). y[n] = w[n] + b*w[n-1]
The above (1), (2), equations represent a signal flow, the w[n] is intermediate node, what the users would want is y[n] = expressions in {x , y}.
From the handwrote deriven , the final is (3)
(3). y[n] = x[n] +b*x[n-1] + a*y[n-1]
is derived from,
from (1),
w[n] = x[n] +a*z^-1*w[n], such that, w[n] = x[n]*( 1 - a*z^-1 )^-1 --------(1-1)
from (2),
y[n] = w[n] + b*z^-1*w[n], such that, y[n] = w[n]*( 1 + b*z^-1 ) ---------(2-1)
from (1-1), (2-1),
y[n] = x[n]* ( 1 + b*z^-1) / ( 1 - a*z^-1)
then , y[n]*( 1 - a*z^-1 ) = x[n]*( 1 + b*z^-1 )
then , y[n] - a*y[n -1] = x[n] + b*x[n-1]
finally, y[n] = x[n] + b*x[n-1] + a*y[n-1] ------------(3)
Like the above, is there any method in Matlab to derive the (1), (2) to (3)
Thank you fro any ideas.
Best regards.

採用された回答

Walter Roberson
Walter Roberson 2020 年 7 月 6 日
you will need to use evalin or feval into the symbolic engine, and use rec() to build the recurrence equation and then solve() to solve it. There is no exposed interface for this, and it is no longer documented in R2020a but you can find the MuPad description in older documentation
  4 件のコメント
Tamura Kentai
Tamura Kentai 2020 年 7 月 9 日
Hi, Walter:
First, I appreciate your answers. I haven't understand those quite well, but I think it will take times.
I'm sorry, I don't know those advanced features behind rather than in 'Help'.
I mean those code, they are not included in 'Help'.
feval(symengine, 'solve', 'rec(y(n+2) = y(n+1) + 2*y(n), y(n))')
It would be impolite if I don't reply until I completely understand those, it's truely hard to read.
Thank you very much.
Best regards.
Walter Roberson
Walter Roberson 2020 年 7 月 9 日
The short summary is that feval(symengine, 'SomeFunction', arg1, arg2, arg3, ...) evaluates arg1, arg2, arg3 using the usual MATLAB evaluation rules. It then takes the results and constructs a MuPAD call with SomeFunction as the name of the function to call, and the results of evaluating arg1, arg2, arg3 as the arguments. The call that is constructed is a character vector, and the character vector is
The effect is similar to evalin(symengine, 'SomeCommand') except that using feval(symengine) constructs arguments with variable names properly.
The programming language is MuPAD.
MuPAD is barely documented starting with R2020a, so you would need to look at a previous release for documentation.
The basic syntax is rec() with first parameter being an equation in = form (not == form) that sets out a recursion, and the second parameter indicates which expression you would want it to be solved for. The third parameter, not shown, is a set of initial conditions in the form of indexed_expression = value, such as {y(0)=1 y(1) = 7} . It takes a bit of extra work to construct a set at the MATLAB level: MATLAB's {} for cell arrays is not the same.

サインインしてコメントする。

その他の回答 (1 件)

madhan ravi
madhan ravi 2020 年 7 月 6 日
You may have a look into collect(), isolate() which may be of use for you to obtain those results.
doc collect
doc isolate
  1 件のコメント
Tamura Kentai
Tamura Kentai 2020 年 7 月 6 日
Hi, madhan:
Thank you for the reply.
But I don't think collect() & isolate() is about that.
I read the help of them, they are still about the continuous time equations, and arrange the expression style.
Originally, I shouldn't say that 'discrete mathematics', I should say about 'z-transform'.
So, it's something like doing the z-transform of equations, then re-arrange them, then inverse z-transform, I don't know what's the terminology, I just know it's from digital signal processing.
Thank you very much for the ideas.
Best regards.

サインインしてコメントする。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by