-
-
Notifications
You must be signed in to change notification settings - Fork 601
Modify subs so that it can accept multiple equations just like subs_expr #12834
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
Comments
comment:1
Note that behaviour at the moment is a bit random:
|
comment:2
I would argue that we accept the weird behaviour in the cases above, but document it. Most users are (hopefully) unlikely to use such mixed arguments, and trying to predict the desired behaviour of those that do will probably result in the wrong answer. |
Attachment: sage-trac_12834.patch.gz Make Expression.subs() accept lists, throw errors on subs conflicts, and doc cleanup. |
comment:3
Some Cython limitations made this more of an event than it had to be, but the patch implements the requested feature and Nils' suggestions from comment 1. When you pass The new |
comment:5
Well I tried the patch out on my example and it seems to work well. |
comment:6
Patch needs to be rediffed for current Sage... |
comment:7
Attachment: sage-trac_12834.2.patch.gz Updated! |
This comment has been minimized.
This comment has been minimized.
Commit: |
comment:12
Hello, I updated the patch as a git branch (trivial conflict) and I propose some cleanup in a second commit. Tell me what you think. Vincent New commits:
|
Branch: public/12384 |
This comment has been minimized.
This comment has been minimized.
comment:14
As it happens, I had started doing my own version of something similar a while ago at a time where I had no internet access and hence without seeing this ticket. The implementation here is probably better, but I pushed mine to |
comment:15
Hi Marc, There is some difference of designs.
Vincent |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:35
Replying to @orlitzky:
The lookup is O(1). And once for each key in d2 gives O(m). There is no for loop on d1, isn't it? |
comment:36
Looks good to me. Can I add a commit to show a more relevant example about comparisons of maple/mathematica with respect to substitution? |
comment:37
Replying to @videlec:
Ah, I was using the worst-case O(n) instead of the average O(1).
Sure. |
comment:38
Sorry for the delay! I added a more complete example comparing maxima/maple/mathematica. Tested with the last version of maple but I do not have access to Mathematica. So it lacks some test. I think I am done. So I let you review my last commit. note: it is based on 6.7.rc0 Vincent Last 10 new commits:
|
Changed branch from u/mjo/ticket/12834 to u/vdelecroix/12834 |
Changed branch from u/vdelecroix/12834 to u/mjo/ticket/12834 |
comment:39
I made some minor cosmetic fixes (typo fix and word-wrap). Other than that it looks good to me. As long as those optional tests work (I don't have maple/mathematica), you can mark it positive review. Last 10 new commits:
|
comment:40
Thanks for the last fixes! |
comment:41
|
comment:42
My mistake. Sorry. New commits:
|
Changed branch from u/mjo/ticket/12834 to u/vdelecroix/12834 |
comment:44
This time all tests pass. |
Changed branch from u/vdelecroix/12834 to |
In this ticket:
expr.substitute(in_dict, **kwds)
asexpr.substitute(*args, **kwds)
and make it accepts any kind of arguments (symbolic equalities, dictionnaries or lists of them)subs_expr
as a duplicate ofsubs
This came up as a method of passing solutions from solve back into symbolic equations:
The solution provided by Michael Orlitzky was
Anycase, as noted by Michael, it would be nice if subs had the same behaviour:
With the branch applied we have:
CC: @kcrisman
Component: symbolics
Keywords: subs algebra solving
Author: Michael Orlitzky, Vincent Delecroix
Branch/Commit:
cb5347e
Reviewer: Vincent Delecroix, Michael Orlitzky
Issue created by migration from https://trac.sagemath.org/ticket/12834
The text was updated successfully, but these errors were encountered: