From: <noreply@so...>  20021108 18:35:05

Bugs item #635627, was opened at 20021108 13:35 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 
From: <noreply@so...>  20021116 16:43:27

Bugs item #635627, was opened at 20021108 10:35 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  Comment By: Nobody/Anonymous (nobody) Date: 20021116 08:43 Message: Logged In: NO The info tells you to use SUBLIS if you want to do substitution in parallel.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 
From: <noreply@so...>  20021119 19:48:23

Bugs item #635627, was opened at 20021108 13:35 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  >Comment By: Stavros Macrakis (macrakis) Date: 20021119 14:48 Message: Logged In: YES user_id=588346 Sublis is broken for operators, e.g. sublis(["+"="*"],x+y) And the online documentation (describe) of subst does not mention the parallel substitution issue. I do not think we need both subst([...]) and sublis([...]...). My guess is that sublis was defined before subst was extended to cover the multiple substitution case.  Comment By: Nobody/Anonymous (nobody) Date: 20021116 11:43 Message: Logged In: NO The info tells you to use SUBLIS if you want to do substitution in parallel.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 
From: SourceForge.net <noreply@so...>  20030712 20:23:34

Bugs item #635627, was opened at 20021108 13:35 Message generated for change (Comment added) made by macrakis You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  >Comment By: Stavros Macrakis (macrakis) Date: 20030712 16:23 Message: Logged In: YES user_id=588346 Another case where simultaneous substitution is necessary... subst([a=[1,2],b=[3,4]],a+b) => [[4,5],[5,6]] instead of the expected [4,6] because [1,2]+b => [1+b,2+b], then 1+[3,4] => = [4,5] etc. I am arguing that simultaneous substitution is the only reasonable default behavior.  Comment By: Stavros Macrakis (macrakis) Date: 20021119 14:48 Message: Logged In: YES user_id=588346 Sublis is broken for operators, e.g. sublis(["+"="*"],x+y) And the online documentation (describe) of subst does not mention the parallel substitution issue. I do not think we need both subst([...]) and sublis([...]...). My guess is that sublis was defined before subst was extended to cover the multiple substitution case.  Comment By: Nobody/Anonymous (nobody) Date: 20021116 11:43 Message: Logged In: NO The info tells you to use SUBLIS if you want to do substitution in parallel.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 
From: SourceForge.net <noreply@so...>  20060701 04:09:56

Bugs item #635627, was opened at 20021108 11:35 Message generated for change (Settings changed) made by robert_dodier You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. >Category: Lisp Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  Comment By: Stavros Macrakis (macrakis) Date: 20030712 14:23 Message: Logged In: YES user_id=588346 Another case where simultaneous substitution is necessary... subst([a=[1,2],b=[3,4]],a+b) => [[4,5],[5,6]] instead of the expected [4,6] because [1,2]+b => [1+b,2+b], then 1+[3,4] => = [4,5] etc. I am arguing that simultaneous substitution is the only reasonable default behavior.  Comment By: Stavros Macrakis (macrakis) Date: 20021119 12:48 Message: Logged In: YES user_id=588346 Sublis is broken for operators, e.g. sublis(["+"="*"],x+y) And the online documentation (describe) of subst does not mention the parallel substitution issue. I do not think we need both subst([...]) and sublis([...]...). My guess is that sublis was defined before subst was extended to cover the multiple substitution case.  Comment By: Nobody/Anonymous (nobody) Date: 20021116 09:43 Message: Logged In: NO The info tells you to use SUBLIS if you want to do substitution in parallel.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 
From: SourceForge.net <noreply@so...>  20100418 17:30:58

Bugs item #635627, was opened at 20021108 19:35 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Stavros Macrakis (macrakis) Assigned to: Nobody/Anonymous (nobody) Summary: subst([...] is orderdependent Initial Comment: I would have expected subst([a=...,b=...],...) to substitute a and b simultaneously (like Lisp Sublis), but it does not, and it simplifies along the way. Here are some cases where it matters. The most obvious case is subst([b=c,a=b],b) => c This means that subst cannot be used to permute variables, e.g. subst([x=y,y=x],...) That is not good.  But there are other cases:  subst([a=0,b=0],atan2(a,b)) Depending on the answers to a>0 etc., this can return 0 or %pi, whereas subst([b=0,a=0],...) can return pi/2 or  pi/2. I believe that it should give the error: atan2(0.0) has been generated.  subst(["="="+","["="*"],[x=1,x=2]); gives (x+1) * (x+2) as expected, but subst(["["="*","="="+"],[x=1,x=2]); gives x^2+2 ((It would have been nice if minus were nary, so that I could use "="=""...))  These two cases can be worked around by turning simp off temporarily, e.g. subst(["["="*","="="+"],[x=1,x=2]), simp:false; but the workaround for the first case is much clumsier: subst([x=x0,y=x,x0=y],...)  >Comment By: Dieter Kaiser (crategus) Date: 20100418 19:30 Message: A function psubst has been added in comm.lisp revision 1.41. This function does the desired parallel substitutions: (%i1) psubst ([a=b,b=a], sin(a)+sin(b)); (%o1) sin(b)+sin(a) (%i2) psubst([a=0,b=0],atan2(a,b)); atan2: atan2(0,0) is undefined.  an error. To debug this try: debugmode(true); (%i3) psubst(["="="+","["="*"],[x=1,x=2]); (%o3) (x+1)*(x+2) (%i5) psubst(["["="*","="="+"],[x=1,x=2]); (%o5) (x+1)*(x+2) (%i6) psubst([a=[1,2],b=[3,4]],a+b); (%o6) [4,6] In addition to the function sublis psubst can do parallel substitution not only for atoms on the left hand side, but for expressions too: (%i7) psubst([x^2=y^2,y^2=x^2],exp(x^2)+sin(y^2)); (%o7) %e^y^2+sin(x^2) The function subst is not changed. Closing this bug report as fixed. Dieter Kaiser  Comment By: Stavros Macrakis (macrakis) Date: 20030712 22:23 Message: Logged In: YES user_id=588346 Another case where simultaneous substitution is necessary... subst([a=[1,2],b=[3,4]],a+b) => [[4,5],[5,6]] instead of the expected [4,6] because [1,2]+b => [1+b,2+b], then 1+[3,4] => = [4,5] etc. I am arguing that simultaneous substitution is the only reasonable default behavior.  Comment By: Stavros Macrakis (macrakis) Date: 20021119 20:48 Message: Logged In: YES user_id=588346 Sublis is broken for operators, e.g. sublis(["+"="*"],x+y) And the online documentation (describe) of subst does not mention the parallel substitution issue. I do not think we need both subst([...]) and sublis([...]...). My guess is that sublis was defined before subst was extended to cover the multiple substitution case.  Comment By: Nobody/Anonymous (nobody) Date: 20021116 17:43 Message: Logged In: NO The info tells you to use SUBLIS if you want to do substitution in parallel.  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=635627&group_id=4933 