Le forum de XCAS

Xcas: un logiciel libre de calcul formel
Nous sommes actuellement le Mer Avr 25, 2018 4:41 pm

Heures au format UTC




Publier un nouveau sujet Répondre au sujet  [ 2 messages ] 
Auteur Message
 Sujet du message: Bug in subst?
MessagePublié: Lun Mar 26, 2018 12:16 pm 
Hors-ligne

Inscrit le: Lun Avr 17, 2017 4:32 pm
Messages: 71
Hi,

Here is a python script that baffles me a bit.

Code:
from giacpy import giac

Tv2= giac("matrix[[(-2*l1*l2+2)/2,(2*l1+2*l2)/2,0,0,(-l1*a2-l1*a1-l2*a2-l2*a1)/2,(-l1*l2*a2-l1*l2*a1+a2+a1)/2,(-l1*d2+l2*d2)/2,(l1*l2*d2+d2)/2,0,0,0,0,0,0,0,0],[0,0,(-2*l1+2*l2)/2,(2*l1*l2+2)/2,(l1*l2*d2-d2)/2,(-l1*d2-l2*d2)/2,(l1*l2*a2-l1*l2*a1+a2-a1)/2,(l1*a2-l1*a1-l2*a2+l2*a1)/2,(-2*l1*l2+2)/2,(2*l1+2*l2)/2,0,0,(-l1*a2-l1*a1-l2*a2-l2*a1)/2,(-l1*l2*a2-l1*l2*a1+a2+a1)/2,(-l1*d2+l2*d2)/2,(l1*l2*d2+d2)/2],[0,0,0,0,0,0,0,0,0,0,(-2*l1+2*l2)/2,(2*l1*l2+2)/2,(l1*l2*d2-d2)/2,(-l1*d2-l2*d2)/2,(l1*l2*a2-l1*l2*a1+a2-a1)/2,(l1*a2-l1*a1-l2*a2+l2*a1)/2],[0,0,0,0,0,0,(l1+l2)/2,(l1*l2-1)/2,0,0,0,0,0,0,0,0],[0,0,0,0,(l1*l2+1)/2,(l1-l2)/2,0,0,0,0,0,0,0,0,(l1+l2)/2,(l1*l2-1)/2],[0,0,0,0,0,0,0,0,0,0,0,0,(l1*l2+1)/2,(l1-l2)/2,0,0],[0,0,(2*l1+2*l2)/2,(-2*l1*l2+2)/2,(-l1*l2*d2-d2)/2,(l1*d2-l2*d2)/2,(-l1*l2*a2-l1*l2*a1+a2+a1)/2,(-l1*a2-l1*a1-l2*a2-l2*a1)/2,0,0,0,0,0,0,0,0],[(-2*l1*l2-2)/2,(2*l1-2*l2)/2,0,0,(-l1*a2+l1*a1+l2*a2-l2*a1)/2,(-l1*l2*a2+l1*l2*a1-a2+a1)/2,(-l1*d2-l2*d2)/2,(l1*l2*d2-d2)/2,0,0,(2*l1+2*l2)/2,(-2*l1*l2+2)/2,(-l1*l2*d2-d2)/2,(l1*d2-l2*d2)/2,(-l1*l2*a2-l1*l2*a1+a2+a1)/2,(-l1*a2-l1*a1-l2*a2-l2*a1)/2],[0,0,0,0,0,0,0,0,(-2*l1*l2-2)/2,(2*l1-2*l2)/2,0,0,(-l1*a2+l1*a1+l2*a2-l2*a1)/2,(-l1*l2*a2+l1*l2*a1-a2+a1)/2,(-l1*d2-l2*d2)/2,(l1*l2*d2-d2)/2],[0,0,0,0,(-l1*l2+1)/2,(-l1-l2)/2,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,(l1-l2)/2,(l1*l2+1)/2,0,0,0,0,(-l1*l2+1)/2,(-l1-l2)/2,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,(l1-l2)/2,(l1*l2+1)/2]]")


print "Bug in subst (there should be no l1 or l2 in the matrix):"
print Tv2.subst("[ll,l2]","[1,1]")


The printed matrix has still entries with l1 and l2 variables in them (although I already made the substitution for them in the code). I get the expected result in Xcas but not in giacpy. Can anyone explain this? Is this a bug in subst?

Edit: using Tv2.subst("[l1=1,l2=1]") does work but that is rather awkward.

Edit2: I think I'm going mad. I can reproduce this sometimes and sometimes not. This is bizzare. I'll let you know if I can always reproduce this.

Jose


Haut
 Profil  
 
 Sujet du message: Re: Bug in subst?
MessagePublié: Mar Mar 27, 2018 5:31 am 
Hors-ligne

Inscrit le: Dim Mai 20, 2007 7:09 am
Messages: 1064
Localisation: Paris
NB: if I cut and paste your post I have a small L instead of a 1:
Code:
print Tv2.subst("[ll,l2]","[1,1]")  # ll instead of l1


Haut
 Profil  
 
Afficher les messages publiés depuis:  Trier par  
Publier un nouveau sujet Répondre au sujet  [ 2 messages ] 

Heures au format UTC


Qui est en ligne ?

Utilisateurs parcourant actuellement ce forum : Aucun utilisateur inscrit et 2 invités


Vous ne pouvez pas publier de nouveaux sujets dans ce forum
Vous ne pouvez pas répondre aux sujets dans ce forum
Vous ne pouvez pas éditer vos messages dans ce forum
Vous ne pouvez pas supprimer vos messages dans ce forum
Vous ne pouvez pas insérer de pièces jointes dans ce forum

Rechercher pour:
Sauter vers:  
Powered by phpBB® Forum Software © phpBB Group
Traduction réalisée par Maël Soucaze © 2009 phpBB.fr