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
Effectively can't create a symbolic variable named 'lambda' #18694
Comments
This comment has been minimized.
This comment has been minimized.
comment:2
|
comment:3
This ticket is about using |
comment:4
I maybe agree. That said, for the sanity of the system it might be a good idea to make some checks on what kind of math symbols we allow. These things tend to end up in strings to various interfaces (although we wouldn't really need to do that for maxima, but we still do). It might even be that we end up "eval"-ing expressions in python, in which case python identifiers shouldn't be allowed. |
comment:5
Is that |
comment:6
Replying to @sagetrac-wonder:
I don't know. I think the standard representation we use is valid python syntax (modulo keyword clashes), and otherwise it would be easy to render them into valid python syntax. I'm not sure if we ever do. The fact is symbolic expressions DO get rendered as strings in various languages. Even in maxima, the whole SAGE_VAR wrapping thing is relatively recent. We have various implicit restrictions on what symbols survive the various translation processes. I'm not entirely sure whether lambda is one of those implicit restrictions. |
comment:7
Would it be helpful to relax the restriction and see if the tests fail?
Out of curiosity, how is "D0(x)" made into valid python syntax? |
comment:8
No, of course not. New tests would have to be written. Never mind that. |
comment:9
Replying to @sagetrac-wonder:
It already is: you don't get a syntax error if you type it into sage. If you want to ensure it executes properly in addition to being valid syntax you have to bind D to an object that puts the information in the right places. I posted this example elsewhere but I can't locate it right now:
With this binding, you get:
EDIT: Found the original code (it's painful how google results now depend on which computer you use!) in |
comment:10
Note also that |
comment:11
@kcrisman thanks, that's good to know.
@nbruin thanks - this seems to say that |
This is closely related to #13545, but is not a duplicate.
It is possible to create a variable whose name is 'lambda' by bypassing the
SR.var()
function, which prohibits it. However, this leads to crashes later, when that function is used internally:If the reason for prohibiting this name is that it can't be used when
var()
creates a Python global variable, that prohibition should be enforced invar()
, not inSR.var()
.Component: symbolics
Issue created by migration from https://trac.sagemath.org/ticket/18694
The text was updated successfully, but these errors were encountered: