Issue with reality assumption of an implicit function

13 views (last 30 days)
Why is the assumption on the reality of f(t) lost by assuming real a different function?
Is this a bug?
In fact:
syms f(t) g(t) t real
assume(f(t),'real')
isreal(f(t))
assume(g(t),'real')
isreal(f(t))
returns:
ans =
logical
1
ans =
logical
0
Any help would be appreciated.
  1 Comment
David Wilson
David Wilson on 20 Apr 2019
My version throws a couple of warnings: I'd look at these first. It seems to me reasonable that a function cannot be restricted easily.
>> syms f(t) g(t) t real
Warning: Can only make assumptions on variable names, not 'f(t)'.
> In syms (line 248)
Warning: Can only make assumptions on variable names, not 'g(t)'.
> In syms (line 248)
Do you get warnings?

Sign in to comment.

Accepted Answer

Marcello Romano
Marcello Romano on 20 Apr 2019
I solved the problem by using assumeAlso instead of assume, inspired by the answer to https://www.mathworks.com/matlabcentral/answers/78614-how-do-you-declare-a-symbolic-function-of-time-as-a-real-variable
The following code gives no warning and the expected result.
syms f(t) g(t) t
assumeAlso(f(t),'real')
isreal(f(t))
assumeAlso(g(t),'real')
isreal(f(t))
No idea still why "assume" would not work...

More Answers (1)

Marcello Romano
Marcello Romano on 20 Apr 2019
Yes, I do get the same warning, but no errors, as I would have expected for an erratic result.
For a particular symbolic computation, I am in the need to restrict several functions f(t), g(t), etc. to have real value only.
How to proceed in order to achieve this?

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!