<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [GiNaC-list] Substitution troubles</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>This is for Jeremy and not the mailing list.<BR>
<BR>
Can this method be used for the Jones polynomial (and other link polynomials)?<BR>
<BR>
Bruce Westbury<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: ginac-list-bounces@ginac.de on behalf of Jeremy Jay<BR>
Sent: Mon 23-Feb-09 5:37 PM<BR>
To: ginac-list@ginac.de<BR>
Subject: [GiNaC-list] Substitution troubles<BR>
<BR>
<BR>
Hello all, I'm new to GiNaC, but so far I've been very impressed by its<BR>
power. But, I seem to be having a problem with the substitutions, can<BR>
anyone tell me what I'm doing wrong?&nbsp; A short example is the following<BR>
code:<BR>
<BR>
----<BR>
<BR>
#include &lt;iostream&gt;<BR>
#include &lt;ginac/ginac.h&gt;<BR>
<BR>
using namespace std;<BR>
using namespace GiNaC;<BR>
<BR>
//////////////////////////////////////////////////////////////<BR>
<BR>
// delta( c_i, c_j ) = 1 if c_i==c_j otherwise 0<BR>
DECLARE_FUNCTION_2P(delta);<BR>
REGISTER_FUNCTION(delta, dummy());<BR>
<BR>
//////////////////////////////////////////////////////////////<BR>
<BR>
int main(int argc, char **argv) {<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; symbol q(&quot;q&quot;), c0(&quot;c0&quot;), c1(&quot;c1&quot;), c2(&quot;c2&quot;);<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ex poly( (1-delta(c0,c1))*(1-delta(c0,c2)) );<BR>
&nbsp; poly=poly.expand();<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;START&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : &quot; &lt;&lt; poly &lt;&lt; endl;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; poly = poly.subs( 1 == q );<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; &quot;sub 1 =&gt; q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : &quot; &lt;&lt; poly &lt;&lt; endl;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 0;<BR>
}<BR>
<BR>
----<BR>
<BR>
which gives the output:<BR>
<BR>
----<BR>
<BR>
START&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1-delta(c0,c2)-delta(c0,c1)+delta(c0,c2)*delta(c0,c1)<BR>
sub 1 =&gt; q&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 1-delta(c0,c2)-delta(c0,c1)+delta(c0,c2)*delta(c0,c1)<BR>
<BR>
----<BR>
<BR>
which is not what I would expect. I've also tried using the 'numeric'<BR>
type instead of the literal 1's, but get the same effect. Am I missing<BR>
something?&nbsp; BTW, for anyone interesed in the point of this, I'm trying<BR>
to implement the algorithm in this paper:<BR>
&nbsp; <A HREF="http://www.iop.org/EJ/abstract/1367-2630/11/2/023001/">http://www.iop.org/EJ/abstract/1367-2630/11/2/023001/</A><BR>
<BR>
Thanks in advance!<BR>
<BR>
Jeremy<BR>
_______________________________________________<BR>
GiNaC-list mailing list<BR>
GiNaC-list@ginac.de<BR>
<A HREF="https://www.cebix.net/mailman/listinfo/ginac-list">https://www.cebix.net/mailman/listinfo/ginac-list</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>