<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear all,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I got a problem with the function subs, and I am not sure it is a possible bug or not, </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
but it seems <span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">counterintuitive. </span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">Here is the code to reproduce the case:</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">//------------------------------------------------</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">#include "ginac/ginac.h"
<div>using namespace std;</div>
<div>using namespace GiNaC;</div>
<div>int main() {</div>
<div> symbol s("s");</div>
<div> ex t = subs(1/s,s==1/s, subs_options::no_pattern);</div>
<div> cout << t << endl;</div>
<div> return 0;</div>
}<br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">//------------------------------------------------</span><br>
</span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">The output is 1/s instead of s.</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">PS: if I remove the <span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">subs_options::no_pattern,
the output is s as expected.</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">and
I have a look at the source code of basic::subs, it seems it comes from the following code:</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">that
is, the final <span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">substitutions on the new object as a whole,</span></span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">//------------------------------------------------</span><br>
</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">//
Perform substitutions on the new object as a whole<br>
return copy->subs_one_level(m, options);<br>
</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">//------------------------------------------------</span><br>
</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">Thanks very much in advance.</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">Best regards!</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important">Feng</span></span></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="caret-color:rgb(0, 0, 0);background-color:rgb(255, 255, 255);display:inline !important"><br>
</span></div>
</body>
</html>