Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem symvar/findsymbols don't detect symfun #519

Closed
latot opened this issue Aug 31, 2016 · 1 comment
Closed

problem symvar/findsymbols don't detect symfun #519

latot opened this issue Aug 31, 2016 · 1 comment
Labels

Comments

@latot
Copy link
Contributor

latot commented Aug 31, 2016

Hi again, well i found this trying to edit the diff function, i think its more simple with a example:

>> syms t f(g) g(t)
>> symvar(f)
ans = (sym) g
>> symvar(symvar(f))
ans = (sym) g

as you can see this is weird, the first part its fine the symbol of f is g, but the symbol of g is t and we get g again, as a note, symvar return a list of symbols but it don't exactly match with the input, its correct say the vars of f is g, but in the text g is printed as a symbol and should be a symfun, theoretically, this should be like this:

>> syms t f(g) g(t)
>> symvar(f)
ans = (symfun) g
>> symvar(symvar(f))
ans = (sym) t

a little trick is do this (i don't like this):

>> syms t f(g) g(t)
>> eval(disp(symvar(f)))
ans = (symfun) g
>> eval(disp(symvar(eval(disp(symvar(f))))))
ans = (sym) t

And this don't works inside a functions D:
the idea in this its can apply correctly the diff to functions, for that reason this is necessary.

Thx. Cya.

@cbm755
Copy link
Collaborator

cbm755 commented Oct 4, 2016

Well, here's what SMT does:

>> syms t f(g) g(t)
>> t

t =

t

>> f

f(g) =

f(g)

>> g

g(t) =

g(t)

>> symvar(f)

ans =

g

>> 

syms goes left to right. It first makes f(g) then it makes g(t) which overwrites the sym g. It think messing around with previous symfun's would be too magical and probably annoy someone.

@cbm755 cbm755 added the invalid label Oct 4, 2016
@cbm755 cbm755 closed this as completed Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants