<!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? A short example is the following<BR>
code:<BR>
<BR>
----<BR>
<BR>
#include <iostream><BR>
#include <ginac/ginac.h><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>
symbol q("q"), c0("c0"), c1("c1"), c2("c2");<BR>
<BR>
ex poly( (1-delta(c0,c1))*(1-delta(c0,c2)) );<BR>
poly=poly.expand();<BR>
<BR>
cout << "START : " << poly << endl;<BR>
<BR>
poly = poly.subs( 1 == q );<BR>
cout << "sub 1 => q : " << poly << endl;<BR>
<BR>
return 0;<BR>
}<BR>
<BR>
----<BR>
<BR>
which gives the output:<BR>
<BR>
----<BR>
<BR>
START : 1-delta(c0,c2)-delta(c0,c1)+delta(c0,c2)*delta(c0,c1)<BR>
sub 1 => q : 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? BTW, for anyone interesed in the point of this, I'm trying<BR>
to implement the algorithm in this paper:<BR>
<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>