[GiNaC-list] Substitution troubles

Westbury, Bruce Bruce.Westbury at warwick.ac.uk
Mon Feb 23 21:12:17 CET 2009

This is for Jeremy and not the mailing list.

Can this method be used for the Jones polynomial (and other link polynomials)?

Bruce Westbury

-----Original Message-----
From: ginac-list-bounces at ginac.de on behalf of Jeremy Jay
Sent: Mon 23-Feb-09 5:37 PM
To: ginac-list at ginac.de
Subject: [GiNaC-list] Substitution troubles

Hello all, I'm new to GiNaC, but so far I've been very impressed by its
power. But, I seem to be having a problem with the substitutions, can
anyone tell me what I'm doing wrong?  A short example is the following


#include <iostream>
#include <ginac/ginac.h>

using namespace std;
using namespace GiNaC;


// delta( c_i, c_j ) = 1 if c_i==c_j otherwise 0
REGISTER_FUNCTION(delta, dummy());


int main(int argc, char **argv) {
	symbol q("q"), c0("c0"), c1("c1"), c2("c2");

	ex poly( (1-delta(c0,c1))*(1-delta(c0,c2)) );

	cout << "START             : " << poly << endl;

	poly = poly.subs( 1 == q );
	cout << "sub 1 => q        : " << poly << endl;
	return 0;


which gives the output:


START             : 1-delta(c0,c2)-delta(c0,c1)+delta(c0,c2)*delta(c0,c1)
sub 1 => q        : 1-delta(c0,c2)-delta(c0,c1)+delta(c0,c2)*delta(c0,c1)


which is not what I would expect. I've also tried using the 'numeric'
type instead of the literal 1's, but get the same effect. Am I missing
something?  BTW, for anyone interesed in the point of this, I'm trying
to implement the algorithm in this paper:

Thanks in advance!

GiNaC-list mailing list
GiNaC-list at ginac.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20090223/1da07fea/attachment.htm>

More information about the GiNaC-list mailing list