getting error with symengine

74 ビュー (過去 30 日間)
Tommy Lim
Tommy Lim 2021 年 12 月 13 日
編集済み: Awais Saeed 2021 年 12 月 13 日
Below is my code, literally get the error and didnt find any solution, pls help me
syms u v x y z
F = @(x,y,z) log (x.^2-2.*y) - z;
x = @(u,v)u+v;
y = @(v)exp(v);
F = subs(F)
Error using symengine
Arithmetical expression expected.
Error in sym/subs>mupadsubs (line 160)
G = mupadmex('symobj::fullsubs',F.s,X2,Y2);
Error in sym/subs (line 145)
G = mupadsubs(F,X,Y);
Error in subs (line 68)
r_unique_name = subs(sym(f_unique_name),varargin{:});
  1 件のコメント
Tommy Lim
Tommy Lim 2021 年 12 月 13 日
i run this code in MATLAB r2014a, everthing fine... but when i switch to MATLAB r2020a, i get error

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

回答 (2 件)

Awais Saeed
Awais Saeed 2021 年 12 月 13 日
編集済み: Awais Saeed 2021 年 12 月 13 日
It is good to provide a variable list and expressions you want to replace using subs(). Read more about subs() here.
syms u v x y z
F = @(x,y,z) log (x.^2-2.*y) - z
F = function_handle with value:
@(x,y,z)log(x.^2-2.*y)-z
old = {x,y}; % replace these with 'new' expressions
new = {@(u,v)u+v,@(v)exp(v)};
Fnew = subs(F, old, new)
Fnew = 

Walter Roberson
Walter Roberson 2021 年 12 月 13 日
syms u v x y z
x(u,v) = u+v;
y(u,v) = exp(v);
F = log (x(u,v).^2-2.*y(u,v)) - z
F = 
This produces the same result as would have been produced before (I tested.)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by