[sage-support] Re: computing the cup-product in the cohomology of a simplicial complex

2011-12-04 Thread Felix Breuer
Hi John!

Thanks for your detailed answer! I will try to figure this out and get back 
to you!

Felix

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: computing the cup-product in the cohomology of a simplicial complex

2011-12-04 Thread Felix Breuer
Hello again!

I have followed your instructions and come up with the following:

X = simplicial_complexes.Torus()
C = X.chain_complex(cochain=True)
print C._chomp_repr_()
H = C.homology(generators=True)
gen1 = H[1][1][0]
gen2 = H[1][1][1]
d1 = C.differential()[1]

This works very well so far. In particular d1*gen1 gives the zero vector as 
it should. Now: How can I get the bijection between the indices of the 
vectors gen1 and gen2 and the corresponding 1-faces in X? C._chomp_repr_() 
gives the boundary matrices in the form:

dimension 1
   boundary a1 = - 1 * a3 - 1 * a10 
   boundary a2 = - 1 * a2 - 1 * a5 
   boundary a3 = + 1 * a4 + 1 * a9 
   boundary a4 = + 1 * a6 + 1 * a12 
   boundary a5 = + 1 * a2 + 1 * a11 
   boundary a6 = - 1 * a4 - 1 * a11 
   boundary a7 = + 1 * a4 + 1 * a8 
   boundary a8 = + 1 * a5 + 1 * a14 
   boundary a9 = - 1 * a9 + 1 * a10 
   boundary a10 = + 1 * a1 + 1 * a6 
   boundary a11 = - 1 * a6 - 1 * a8 
   boundary a12 = + 1 * a5 + 1 * a7 
   boundary a13 = + 1 * a8 + 1 * a14 
   boundary a14 = + 1 * a7 + 1 * a9 ...


But I don't see any information what face, say, a1 corresponds to. Am I 
missing something?

Thank you very much for your help!

Felix

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: computing the cup-product in the cohomology of a simplicial complex

2011-12-04 Thread John H Palmieri


On Sunday, December 4, 2011 7:47:13 PM UTC-8, Felix Breuer wrote:
>
> Hello again!
>
> I have followed your instructions and come up with the following:
>
> X = simplicial_complexes.Torus()
> C = X.chain_complex(cochain=True)
> print C._chomp_repr_()
> H = C.homology(generators=True)
> gen1 = H[1][1][0]
> gen2 = H[1][1][1]
> d1 = C.differential()[1]
>
> This works very well so far. In particular d1*gen1 gives the zero vector 
> as it should. Now: How can I get the bijection between the indices of the 
> vectors gen1 and gen2 and the corresponding 1-faces in X? C._chomp_repr_() 
> gives the boundary matrices in the form:
>
> dimension 1
>boundary a1 = - 1 * a3 - 1 * a10 
>boundary a2 = - 1 * a2 - 1 * a5 
>boundary a3 = + 1 * a4 + 1 * a9 
>boundary a4 = + 1 * a6 + 1 * a12 
>boundary a5 = + 1 * a2 + 1 * a11 
>boundary a6 = - 1 * a4 - 1 * a11 
>boundary a7 = + 1 * a4 + 1 * a8 
>boundary a8 = + 1 * a5 + 1 * a14 
>boundary a9 = - 1 * a9 + 1 * a10 
>boundary a10 = + 1 * a1 + 1 * a6 
>boundary a11 = - 1 * a6 - 1 * a8 
>boundary a12 = + 1 * a5 + 1 * a7 
>boundary a13 = + 1 * a8 + 1 * a14 
>boundary a14 = + 1 * a7 + 1 * a9 ...
>
>
> But I don't see any information what face, say, a1 corresponds to. Am I 
> missing something?
>

You should be able to do

  sage: X.n_faces(1) 

to get the list of 1-simplices.  a_i should be dual to the ith element in 
that list.

-- 
John

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] why is this contour integral wrong?

2011-12-04 Thread Dan Drake
I keep wondering whether Sage is making a mistake, or I'm not
understanding complex analysis. I'm a little afraid to learn the answer.
:)

Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere
except at -1/2-I/3, where it has a simple pole. So, if I integrate over
a circle centered at 0 of radius, say, 2, the answer should be

2*pi*I*(residue of f at -1/2 - I/3),

which is pi*(181/27 + 19*I/36). However, when I try to do the contour
integral, I get:

sage: integrate(f(2*exp(I*t)) * 2*I*exp(I*t), (t, 0, 2*pi))
0

even though the contour encloses the pole. It works if I center the
circle around the pole:

sage: integrate(f(-1/2-I/3 + exp(I*t)) * I*exp(I*t), (t, 0, 2*pi))
(19/36*I + 181/27)*pi

and also if I integrate over the square with vertices 1+i, 1-i, -1-i,
-1+i. What's wrong with the circle at the origin?

Note that Mathematica gets this right, although you need to ask for full
simplification: with f[z_] = (z-I)*(z-1)^2/(z-(-1/2-I/3)), you get

In[5]:= Integrate[f[2*Exp[I*t]] * 2*I*Exp[I*t], {t, 0, 2*Pi}]//FullSimplify

 181   19 I
Out[5]= (--- + ) Pi
 27 36

Any ideas?

Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


[sage-support] Re: why is this contour integral wrong?

2011-12-04 Thread achrzesz


On Dec 5, 5:31 am, Dan Drake  wrote:
> I keep wondering whether Sage is making a mistake, or I'm not
> understanding complex analysis. I'm a little afraid to learn the answer.
> :)
>
> Take f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3)). It's analytic everywhere
> except at -1/2-I/3, where it has a simple pole. So, if I integrate over
> a circle centered at 0 of radius, say, 2, the answer should be
>
> 2*pi*I*(residue of f at -1/2 - I/3),
>
> which is pi*(181/27 + 19*I/36). However, when I try to do the contour
> integral, I get:
>
> sage: integrate(f(2*exp(I*t)) * 2*I*exp(I*t), (t, 0, 2*pi))
> 0
>
> even though the contour encloses the pole. It works if I center the
> circle around the pole:
>
> sage: integrate(f(-1/2-I/3 + exp(I*t)) * I*exp(I*t), (t, 0, 2*pi))
> (19/36*I + 181/27)*pi
>
> and also if I integrate over the square with vertices 1+i, 1-i, -1-i,
> -1+i. What's wrong with the circle at the origin?
>
> Note that Mathematica gets this right, although you need to ask for full
> simplification: with f[z_] = (z-I)*(z-1)^2/(z-(-1/2-I/3)), you get
>
> In[5]:= Integrate[f[2*Exp[I*t]] * 2*I*Exp[I*t], {t, 0, 2*Pi}]//FullSimplify
>
>          181   19 I
> Out[5]= (--- + ) Pi
>          27     36
>
> Any ideas?
>
> Dan
>
> --
> ---  Dan Drake
> -  http://mathsci.kaist.ac.kr/~drake
> ---
>
>  signature.asc
> < 1KViewDownload

Note that pari has a good approximate solution:

sage: pari('f(z) = (z-I)*(z-1)^2/(z-(-1/2-I/3))')
(z)->(z-I)*(z-1)^2/(z-(-1/2-I/3))

sage: 2*n(pi)*I*pari('intcirc(z=0,2,f(z))')
21.0603063073982 + 1.65806278939461*I

sage: CC(pi*(181/27 + 19*I/36))
21.0603063073982 + 1.65806278939461*I

Andrzej Chrzeszczyk

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org