[sage-devel] Re: BUG??? in function "implicit_plot"

2014-11-28 Thread Dox
I found the answer... to use the option "aspect_ratio='automatic'".

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: BUG??? in function "implicit_plot"

2014-11-28 Thread Dox
I found the answer... to use the option "aspect_ratio='automatic'"

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] BUG??? in function "implicit_plot"

2014-11-28 Thread Dox
Dear all, I'm trying to plot an implicit function with a "y"-axis range 
three orders of magnitude greater than the range of the "x"-axis. 

If I use logarithmic scale, the resulting plot is the one shown in 
"sage0.png"... However, when a linear scale is used, the plot collapses 
(see the file "sage1.png")

I would say this is a BUG, because the expected result should be an 
automatic linear scaling of the "y"-axis. But I could be misusing the code.

THX


CODE:

sage: reset()
sage: var('MN', domain='positive', latex_name=r"M_N")
sage: var('Vtausq', domain='positive', latex_name=r"\left|V_{\tau N}\right|^2")
sage: var('MWR', domain='positive', latex_name=r"M_{W_R}")


sage: mmu = 0.105  # GeV
sage: mtau= 1.7# GeV
sage: Eff = 1  # To be scaled
sage: Nevents = 5  # Number of observed events
sage: Ntaus   = 4.9E8  # Taus generated on the experiment (ShiP??)
sage: npot= 2E20   # Potential number of events
sage: xcc = 4.5E-4 #
sage: BrDs  = 0.0554  # Branching ratio D_s -> tau + nu_tau
sage: Brtau = 1   # Branching ratio tau -> X + nu_tau
sage: BrN   = 0.036   # Branching ratio N -> mu + mu + nu
sage: BB   = BrDs * Brtau * BrN * (80.385/MWR)^4 * ( 1 - (MN/mtau)^2 ) * ( 1 - 
(2*mmu/MN)^2 ) * heaviside(MN - 2*mmu) * heaviside(mtau - MN) 
sage: edet = 8E-5 * MN^5 * 1E7 * (80.385/MWR)^4 * Eff
sage: eq = npot * 2 * xcc * BB * edet - Nevents
sage: eq

sage: G = Graphics()
sage: G = implicit_plot(eq, (MN,.1,2), (MWR,5E3,11E3), scale=('semilogy',2)) 
sage: G

sage: G1 = Graphics()
sage: G1 = implicit_plot(eq, (MN,.1,2), (MWR,5E3,11E3)) 
sage: G1

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] How could I use a general connection with SageManifold?

2013-10-28 Thread Dox
Hi dear community:

I've seen the examples given in the homepage of 
sagemanifolds, 
and still have not a clue about how to use (or define) a general 
connection, because all the examples work with the Levi-Civita connection.

Does anyone knows how to work with a general connection?

Thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


[sage-devel] Re: SageManifolds: differential geometry and tensor calculus in Sage

2013-07-08 Thread Dox
Thx Michael, I didn't know that feature of sage notebook!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] Re: SageManifolds: differential geometry and tensor calculus in Sage

2013-07-08 Thread Dox
I'm trying to reproduce the examples in the page, starting with 
"Schwarzschild spacetime"

So far I'm getting the following:

* When defining a `Chart`, say `X`, t
from manifolds.all import *
M = Manifold(4, 'M', r'M'); M
X = Chart(M, r't, r:positive, th:positive:\theta, ph:\phi', 'BL')
X
does not return the latex output, but this

chart 'BL' (t, r, th, ph)

this is not a problem because after trying 
X.show()
the expected output pops up!

When using the `show()`method on the metric the output is not shown in the 
way I expected (with the tensor product of the basis,
g[0,0], g[1,1], g[2,2], g[3,3] = -(1 - 2*m/r), 1/(1 - 2*m/r), r^2, (r*sin(th
))^2; show(g)

g = (2*m/r - 1) dt*dt - 1/(2*m/r - 1) dr*dr + r^2 dth*dth +
r^2*sin(th)^2 dph*dph

I try a couple of things and non of them yields the result shown in the 
documentation. Similar behaviour goes on and on through the WS.

* I'd add the following line to the WS
nab[:]
because people can see the components of the connection.

* Additionally, I shall propose to define a method to show only the 
non-trivial components of the tensors... including the `name` of the 
component (in indices). The code below will do the work, but of course it 
can be improved.
for i in M.irange():
for j in M.irange():
for k in xrange(j,M.dimension()):
if (nab[:][i][j][k] != 0):
print "Gam_{%d %d %d}: "  %(i, j, k)
print "\t", nab[:][i][j][k], "\n\n"
This method should be implemented for tensors.

I'm still learning the stuff, and should be posting more suggestions later! 
Thank you for the wonderful work done with this package!!! Cheers



-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] Re: SageManifolds: differential geometry and tensor calculus in Sage

2013-07-08 Thread Dox



I just installed SageManifolds package, and tried 

> sage: Chart?

to review the documentation, and the format is not OK, Is it just me or a 
documentation `bug`?


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] Re: SageManifolds: differential geometry and tensor calculus in Sage

2013-07-08 Thread Dox
Impressive work! I started improving my programming skills to try 
implementing the Hodge star on DifferentialForms, I see you went much 
further!

I'll immediately install the package, working on several examples, and asap 
start contributing with it!

Congratulations! 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-devel] Re: _cleanup method in DifferentialForms class

2013-06-28 Thread Dox
I could try to change something... However, What is the way to provide a 
patch? Is it through github?

On Friday, 28 June 2013 09:36:47 UTC-4, Joris Vankerschaver wrote:
>
>
> Symbolic expressions have a .is_trivial_zero() method which is more 
>> suitable for use here. It doesn't try anything advanced so it has 
>> predictable runtime. 
>>
>
> I just wanted to say that I had no idea that this function existed when I 
> wrote that code, and it seems like a good idea to use it here. If anybody 
> wants to fix this, great, otherwise I'll do it myself in a few days when I 
> have time.
>
> All the best,
> Joris 
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] _cleanup method in DifferentialForms class

2013-06-24 Thread Dox
Dear developers,

I was looking through the class DifferentialForm, and there is a note in 
the `__eq__` method pointing that "...most of the execution time is spent" 
in cleaningpu the differential forms
def __eq__(self, other):
if type(other) == type(self):
if self._degree != other._degree:
return False
else:
# TODO: the following two lines are where most of the 
# execution time is spent.  
self._cleanup()
other._cleanup()

if len(self._components) != len(other._components):
return False

# We compare the component dictionary of both differential 
# forms, keeping in mind that the set of keys is 
# lexicographically ordered, so that we can simply iterate 
# over both dictionaries in one go and compare (key, value) 
# pairs as we go along.

for (key1, val1), (key2, val2) in \
zip(self._components.iteritems(), \
other._components.iteritems()):
if key1 != key2 or str(val1) != str(val2):
return False
return True
else:
return False



Then, I found the `_cleanup` method

def _cleanup(self):
r"""
Helper function to clean up self, i.e. to remove any
zero components from the dictionary of components.

EXAMPLES::

sage: F = DifferentialForms()
sage: f = DifferentialForm(F, 1)
sage: f[0] = 0
sage: f[1] = 1
sage: f[2] = 0
sage: f._dump_all()
{(2,): 0, (0,): 0, (1,): 1}
sage: f._cleanup()
sage: f._dump_all()
{(1,): 1}

"""
zeros = []

for comp in self._components:
if self._components[comp].is_zero():
zeros.append(comp)

for comp in zeros:  
del self._components[comp]  

And I wonder... Is it possible to delete directly the `zeros` from `self`? 
I guess it was not done like that because it is not possible!

However, then it occur to me that copying `self` to `other` and then 
reassign to `self` only the notzero component could be faster

Is it possible?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.




[sage-devel] Re: Paper publication of the book "Calcul Mathematique avec Sage"

2013-06-11 Thread Dox
Great work! Congratulations!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [sage-devel] Defining Clifford Algebras

2013-01-15 Thread Dox
Hi David,

Thank you for pointing out such an interesting feature of SymPy. I've been 
checking the documentation, and it seems to do nice things, but I feel it a 
bit extrange... the notation and the usage in not quite clear.

Although I tried some of the examples in the documentation and got no 
output. (of course I could be doing something wrong).

However, it seems a good start point for implementing what I'd like to have.

Thank you again. Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Defining Clifford Algebras

2013-01-14 Thread Dox
Dear all,

I've asked in asksage how to define a Clifford 
Algebra. 
Benjaminfjones has suggested I start by looking at the Quaternion algebras 
code, 
while Burcin has directed my attention toward the GiNac package.

Due to my lack of knowledge about GiNaC, I somehow prefer the first option. 
And moreover, I am thinking that would be nice to write a little code say 
SAGE native... to managing Clifford algebras.

I have never done something like this, thus I'm asking for help.

*Questions

*
   
   1. How should I define objects which inherit the properties of an 
   associative algebra?
   2. In the quaternionic case, there are 2 basic objects (thought as 
   generators of a Clifford algebra), which generate the basis of the algebra 
   (4 elements, to know 1, i, j, k.). For more general Clifford algebras I 
   would like to name the basic elements $e_1, e_2, ...$ whist the basis could 
   be $e_{12}, e_{13}, ...$ and so on. How could this be done? *Note* that 
   in dimension *D* there are $2^{|D/2|}$ elements in the basis.

I know this is a long term work, thus I shall be asking more in the future. 
I thank any help I can get.


Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Re: Defining anti-commutator

2012-10-09 Thread Dox
Thank you Simon, a very complete answer to my problem.

I've already tested my definition and is fantastic.

Cheers!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Defining anti-commutator

2012-10-09 Thread Dox
Thank you for the tip! That's an impressive command.

Cheers.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Defining anti-commutator

2012-10-09 Thread Dox
Dear all,

I'm interested in defining the anti-commutator (function or method) for 
matrices. I look up the definition of the commutator, and it's very simple

def acomm(self,other):
return self*other + other*self 

providing (of course) the additional information about the usage.

However I tried to add this function to my sage-test branch... and I 
couldn't find where the methods for matrices are. 

Where should I include this changes?

Thx.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Re: Problems with "full output"

2012-10-08 Thread Dox
Yes Nils, In fact it was a browser problem. William makes me notice it.

Thank you all.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Re: Problems with "full output"

2012-10-08 Thread Dox
Sorry It's not getting updated.

On Monday, 8 October 2012 12:14:42 UTC-3, Simon King wrote:
>
> Hi! 
>
> On 2012-10-08, Dox > wrote: 
> > --=_Part_110_6376496.1349698687928 
> > Content-Type: text/plain; charset=ISO-8859-1 
> > ... 
> > I noticed that after changing the variables, and rerun the calculation 
> the 
> > full_output.txt is now getting updated. 
> > 
> > I guess this is a bug. 
>
> Why? 
>
> If one reruns a calculation, then I'd certainly expect that the output 
> (both what is printed on screen and full_output.txt) is getting updated. 
>
> Or is there a misspelling in your post? Should "...is now getting updated" 
> be "...is not getting updated"? 
>
> Best regards, 
> Simon 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Problems with "full output"

2012-10-08 Thread Dox
Dear community:

I was doing some simple linear algebra calculations, and since the output 
was a long list, Sage gave me a few lines with the option of looking at the 
full_output.txt file.

I noticed that after changing the variables, and rerun the calculation the 
full_output.txt is now getting updated.

I guess this is a bug. Has anyone experienced the same? Should I open a 
trac?

OS: Ubuntu 12.04.1
arch: 64-bits
SAGE: 5.3
browser: Firefox 15.0.1

Cheers

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Installing Sage 5.0.1 on Ubuntu 12.04

2012-06-27 Thread Dox
Thank you Jan, It worked.

I'll compile the source, but I have a doubt, How many cores are in a i7? 4 
or 8?

Dox

On Wednesday, 27 June 2012 16:49:41 UTC-4, Jan Groenewald wrote:
>
> Hi Dox,
>
> On 27 June 2012 22:16, Dox  wrote:
>
>> Dear all:
>> I bought a new laptop yesterday, and it has arch. 64-bits. So, I download 
>> Sage 5.0.1 for Ubuntu 10.04 although it's running Ubuntu 12.04.
>> After the extraction of the pack, I tried as usual (Since v.3), but I'm 
>> getting the error "ERROR:root:code for hash md5 was not found." that so 
>> many people is complaining about.
>> I've also found a post in AskSage, so I installed
>>
>>- m4 
>>- g++ 
>>- gfortran 
>>- libssl-dev 
>>- dh-exec 
>>- dpkg-dev
>>
>> deside the usual perl, make, and so on.
>>
>> Nonetheless, the error holds.
>>
>> What can I do? Should I try to install from the PPA repository?
>>
>> Thank you!
>>
>> P.D.: Additionally I would like to compile the source for a i7 intel, How 
>> many cores should I tell ATLAS to use, 4 or 8?
>>
> Just a guess:
>
> sudo apt-get install libssl0.9.8 (the default on 12.04 is 1.0.0; sage 
> needs 0.9.8).
>
> I'll be updating the PPA soon.
>
> However, with your i7 CPU, why not compile from source?
>
> Regards,
> Jan
>
>
> -- 
>   .~. 
>   /V\ Jan Groenewald
>  /( )\www.aims.ac.za
>  ^^-^^ 
>
>

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


[sage-devel] Installing Sage 5.0.1 on Ubuntu 12.04

2012-06-27 Thread Dox
Dear all:

I bought a new laptop yesterday, and it has arch. 64-bits. So, I download 
Sage 5.0.1 for Ubuntu 10.04 although it's running Ubuntu 12.04.

After the extraction of the pack, I tried as usual (Since v.3), but I'm 
getting the error "ERROR:root:code for hash md5 was not found." that so 
many people is complaining about.

I've also found a post in AskSage, so I installed

   - m4 
   - g++ 
   - gfortran 
   - libssl-dev 
   - dh-exec 
   - dpkg-dev
   
deside the usual perl, make, and so on.

Nonetheless, the error holds.

What can I do? Should I try to install from the PPA repository?

Thank you!

P.D.: Additionally I would like to compile the source for a i7 intel, How 
many cores should I tell ATLAS to use, 4 or 8?


DOX

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


[sage-devel] Irreps of Lie groups

2012-03-05 Thread Dox
Dear all,
a couple of weeks ago I wrote a small program for computing the irreps
of a Lie group,
http://sagenb.org/home/pub/4395/
I'd like to help implementing it for future versions of SAGE...
However, I guess it needs a lot of work for the sake of optimization.

* Could you help me optimize it?

* Where should it be included as a class? (in case it is possible)

Thank you!

DOX

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


[sage-devel] Re: vector products

2012-01-24 Thread Dox
You're very right! Sorry

On Jan 24, 1:06 pm, Jason Grout  wrote:
> On 1/24/12 9:56 AM, Dox wrote:
>
> > Hi Jason,
>
> > Thank you for the suggestion. Nonetheless, the first does not work...
> > I venture to guess that SAGE understand the product (*) as commutative
> > for vectors... or somehow it is rearranged.
>
> u1.column()*u2.row() gives a 3x3 matrix.  u1.row()*u1.column() gives a
> 1x1 matrix, of course.  These work in Sage 4.7.2.
>
> Jason

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


[sage-devel] Re: vector products

2012-01-24 Thread Dox
Hi Jason,

Thank you for the suggestion. Nonetheless, the first does not work...
I venture to guess that SAGE understand the product (*) as commutative
for vectors... or somehow it is rearranged.

The outer_product is OK!

Thank you so much!

On Jan 24, 12:06 pm, Jason Grout  wrote:
> On 1/24/12 8:57 AM, Dox wrote:
>
>
>
>
>
>
>
>
>
> > Hi everyone,
>
> > Today I rediscover a "problem" with the product of vectors.
>
> > I've defined two vectors u1 and u2,
>
> > sage: u1 = vector([a,b,c])
> > sage: u2 = vector([d,f,g])
>
> > then I try to construct the matrix u1*u2.column()
>
> > sage: M = u1*u2.column()
> > sage: show(M)
>
> > but it interprets the command as a vector product and gives and
> > scalar, instead of a matrix.
>
> > How can this be solved?
>
> u1.row()*u2.column()
>
> or u1.outer_product(u2)
>
> (I haven't tested either of those...)
>
> Thanks,
>
> Jason

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


[sage-devel] Re: vector products

2012-01-24 Thread Dox
Thx, this is it!

On Jan 24, 12:01 pm, David Joyner  wrote:
> On Tue, Jan 24, 2012 at 9:57 AM, Dox  wrote:
> > Hi everyone,
>
> > Today I rediscover a "problem" with the product of vectors.
>
> > I've defined two vectors u1 and u2,
>
> > sage: u1 = vector([a,b,c])
> > sage: u2 = vector([d,f,g])
>
> > then I try to construct the matrix u1*u2.column()
>
> > sage: M = u1*u2.column()
> > sage: show(M)
>
> > but it interprets the command as a vector product and gives and
> > scalar, instead of a matrix.
>
> > How can this be solved?
>
> Do you mean the tensor product?
>
> sage: u1 = vector([1,2,3])
> sage: u2 = vector([-1,1,2])
> sage: u1.tensor_product(u2)
> [-1  1  2]
> [-2  2  4]
> [-3  3  6]
>
>
>
>
>
>
>
>
>
> > Thank you guys!
>
> > DOX.
>
> > --
> > To post to this group, send an email to sage-devel@googlegroups.com
> > To unsubscribe from this group, send an email to 
> > sage-devel+unsubscr...@googlegroups.com
> > For more options, visit this group 
> > athttp://groups.google.com/group/sage-devel
> > URL:http://www.sagemath.org

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


[sage-devel] vector products

2012-01-24 Thread Dox
Hi everyone,

Today I rediscover a "problem" with the product of vectors.

I've defined two vectors u1 and u2,

sage: u1 = vector([a,b,c])
sage: u2 = vector([d,f,g])

then I try to construct the matrix u1*u2.column()

sage: M = u1*u2.column()
sage: show(M)

but it interprets the command as a vector product and gives and
scalar, instead of a matrix.

How can this be solved?

Thank you guys!

DOX.

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


[sage-devel] Re: Plotting a dirac_delta

2011-07-05 Thread Dox
Hi kcrisman,

A very useful command that spike_function, but I still don't get how to use 
it as a delta_function, Could you help me with an example? say,

delta_function(log(2+sin(x)))

Thank you,
   Dox

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


Re: [sage-devel] Plotting a dirac_delta

2011-07-05 Thread Dox
Hi Benjamin,

Yes, I'd like to get an automatic plot like that, where the singularity can 
be seen. For example, if I try

sage: var('x')
sage plot(1/x, (x,-2,2), detect_poles=False)

the singularity is shown. But it does not work with the delta distribution. 
Any suggestions? 

Dox

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


[sage-devel] Plotting a dirac_delta

2011-07-05 Thread Dox
Hi group!

I'm trying to plot a dirac_delta function, with the command

sage: var('x')
sage: plot(dirac_delta(x), (x,-1,1), detect_poles=False)

and I get just a line through the x axis. Can this function be plotted with 
the singularity? because I'd like to plot a more complex function and detect 
the singular behaviour by looking at it!

Thx.!!!

Dox

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


[sage-devel] Re: Integration of dirac_delta

2011-05-16 Thread Dox
Thx kcrisman!

very useful workaround.

Dox

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


[sage-devel] solve an algebraic expression

2011-05-14 Thread Dox
Hi again list,

This time I come with a problem of solving an algebraic expression, the 
solution has the variable x on it!

sage: reset()
sage: var('x')
sage: var('mp', latex_name=r"m_\pi")
sage: var('me', latex_name=r"m_e")
sage: f(x) = mp - sqrt(x^2 + me^2) - x
sage: solve(f(x)==0, x)
[x == mp - sqrt(me^2 + x^2)]

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


[sage-devel] Integration of dirac_delta

2011-05-14 Thread Dox
Hi group!

I was trying to integrate a dirac_delta, but SAGE cannot do so... weird 
thing, 'cause that `function' is defined, and in only make sense as part of 
an integration.

Cheers.

Dox.

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


[sage-devel] Re: translate to python

2011-05-03 Thread Dox
Hi Simon, thank you for your quick answer, It's almost what I expected, but 
in fact the arctan function is denoted by atan in python. Of course it's 
possible to correct it by hand, but it's easy to mistype when the 
expressions are too complicated.

Dox.

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


[sage-devel] translate to python

2011-05-03 Thread Dox
Hi group,

I know that for a given expression it's possible to translate it to LaTeX. 
Is it possible to translate it to python?

Say, from x^2*arctan(x) get x**2*atan(x)

Thx.

Dox.

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


[sage-devel] Re: MathJax

2011-03-02 Thread Dox
Looks nice... Thx for the recommendation.

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


[sage-devel] Differentials are defines

2011-02-23 Thread Dox
Hi group!

I'm trying to change the metric from Euclidean to Spherical. I know there 
are several ways of doing so, but I'd like to do something like this:

   1. Define the new coordinates var('phi')
   2. Give the relation between old and new coordinates x = cos(phi) and y = 
   sin(phi)
   3. Finding the differentials, dx and dy
   4. Compute dx^2 + dy^2

Is it possible to define differentials of functions? If so, How?

Thx.

DOX

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


[sage-devel] Re: Series expansion.

2011-02-19 Thread Dox
Thank you very much guys! 

Dox.

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


[sage-devel] Series expansion.

2011-02-18 Thread Dox
Hi everyone!

I'd like to know if there is a way of finding the series expansion of a 
given function around zero and infinity, Is it possible?

I tried with sympy.series, didn't work

sage: reset()
sage: from sympy import *
sage: r = Symbol('r')
sage: sympy.series(2*r/sinh(2*r), r)

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


[sage-devel] Re: Bundle different objects

2011-02-15 Thread Dox
Any other contribution?

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


[sage-devel] Re: Signature of a permutation

2011-02-15 Thread Dox
Wow!

A lot of answers!

Thank you everyone, :-) nice to see so much different contributions!

Dox

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


Re: [sage-devel] Re: Signature of a permutation

2011-02-12 Thread Dox
Thank you Mike! :-)

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


[sage-devel] Re: Signature of a permutation

2011-02-11 Thread Dox
Hi again people!

Just wanted to know if the Levi-Civita tensor can be emulated by using this,
 

sage: G = SymmetricGroup(4)
sage: G([4,2,3,1]).sign()
-1


because I'm not sure if the notation used in the documentation is equivalent 
to mine!

Thx.

Dox
 

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


[sage-devel] Signature of a permutation

2011-02-11 Thread Dox
Hi guys!

Short question! Is there any function equivalent to the *Levi-Civita*
 symbol?

I found *Eijk* in sympy... but seems to work only in 3-dimensions.

Thank you!

Dox

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


[sage-devel] Re: Bundle different objects

2011-02-10 Thread Dox
I've define the action of the exterior derivative on the non-Abelian
connection,

class nAform(object):
def __init__(self, a, b):
self._form = a
self._matrix = b

def __add__(self, other):
if isinstance(other, nAform):
if (self._matrix == other._matrix):
return nAform(self._form + other._form, self._matrix)
else:
raise NotImplemented
raise NotImplemented

def __mul__(self, other):
if isinstance(other, nAform):
return nAform(self._form.wedge(other._form),
self._matrix.commutator(other._matrix))
raise NotImplemented

def diff(self):
return nAform(self._form.diff(), self._matrix)

def __repr__(self):
return str((self._form, self._matrix))

def __str__(self):
return self.__repr__()

* TODO:
** Define the sum for forms with values in different elements of the
algebra.
** Define the product of the forms by a number (or function)

Cheers

 DOX

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


[sage-devel] Re: Bundle different objects

2011-02-10 Thread Dox
Nicalas... Your suggestion almost work, and in fact it is exactly what
I'm talking about!

Specifically, my idea is to work with connections with values in a non-
Abelian Lie algebra, SU(2), so there are 3 generators.

Therefore, the first entry of my function is a form, and the second is
a Lie algebra generator!.

I tried this

class nAform(object):
def __init__(self, a, b):
self._form = a
self._matrix = b

def __add__(self, other):
if isinstance(other, nAform):
if (self._matrix == other._matrix):
return nAform(self._form + other._form, self._matrix)
else:
raise NotImplemented
raise NotImplemented

def __mul__(self, other):
if isinstance(other, nAform):
return nAform(self._form.wedge(other._form),
self._matrix.commutator(other._matrix))
raise NotImplemented

def __repr__(self):
return str((self._form, self._matrix))

def __str__(self):
return self.__repr__()

And for monomials form it can multiply. But I got stacked in the
definition of an addition, if the generators of the algebra are
different! Which is, of course, one of the most important part of the
class.

Any additional help is welcome!

DOX

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


[sage-devel] Re: Bundle different objects

2011-02-10 Thread Dox
I already define my class, and starts Ok, I have changed the operation
to __mul__. But now I'd like to define an __add__ operation which
surpass my knowledge...

Something like this,
sage: A = MyClass( 3, "Hello")
sage: B = MyClass( 4, "World!")
sage: A+B
( 3, "Hello") + ( 4, "World!")

sage: C = MyClass( 5, "World!")
sage: B+C
( 9, "World!")

I'm thinking could be a bit hard, since the function I'm defining has
not a string but a matrix as second entry. The first is not a number
either.

Thx.

Dox.


On Feb 10, 3:42 am, Jason Grout  wrote:
> On 2/9/11 9:18 PM, Robert Bradshaw wrote:
>
> > On Wed, Feb 9, 2011 at 6:43 PM, Dox  wrote:
> >> Hi people!
>
> >> I was wondering if there is a way of bundle two kind of different
> >> objects together and define operations on them.
>
> >> Suppose, I'd like to bundle a number and a string (3, Hello) and (4,
> >> World!!)... then define and operation which multiplies the numbers and
> >> add strings, so the result is (12, HelloWorld!!)
>
> >> Something like that!
>
> > Yes. See, for example, how the sage.misc.preparser.BackslashOperator
> > is implemented. (I think we have a more generic one, but I'm not sure
> > where it is.)
>
> I presume you mean the infix decorator from this patch:
>
> http://trac.sagemath.org/sage_trac/ticket/6245
>
> I was going to point out the page in the reference manual, but
> apparently somehow that file is not documented in the reference manual.
>
> Anyways, do infix_operator?, see sage.misc.decorator, or just look at
> this example:
>
> sage: @infix_operator('add')
> : def my_add(a,b):
> :     return (a[0]*b[0], a[1]+b[1])
> :
> sage: (3,"Hello") +my_add+ (4, "World!!")
> (12, 'HelloWorld!!')
>
> But it might make a lot more sense to make a simple class that prints
> out the string and number and has an operation defined on it.
>
> sage: class MyClass:
> :     def __init__(self, num, s):
> :         self._num=num
> :         self._s=s
> :     def __add__(self, other):
> :         if isinstance(other, MyClass):
> :             return MyClass(self._num*other._num, self._s+other._s)
> :         raise NotImplemented
> :     def __repr__(self):
> :         return str((self._num, self._s))
> :     def __str__(self):
> :         return self.__repr__()
> :
> sage: a=MyClass(3,"Hello")
> sage: b=MyClass(4,"World!!")
> sage: a
> (3, 'Hello')
> sage: b
> (4, 'World!!')
> sage: a+b
> (12, 'HelloWorld!!')
>
> Thanks,
>
> Jason

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


[sage-devel] Re: Bundle different objects

2011-02-10 Thread Dox
Wow!!!

Jason, you're a genius!!! :-)

Thank you for such a complete answer. Now I'll try to define my own
class... :-P

Dox.

On Feb 10, 3:42 am, Jason Grout  wrote:
> On 2/9/11 9:18 PM, Robert Bradshaw wrote:
>
> > On Wed, Feb 9, 2011 at 6:43 PM, Dox  wrote:
> >> Hi people!
>
> >> I was wondering if there is a way of bundle two kind of different
> >> objects together and define operations on them.
>
> >> Suppose, I'd like to bundle a number and a string (3, Hello) and (4,
> >> World!!)... then define and operation which multiplies the numbers and
> >> add strings, so the result is (12, HelloWorld!!)
>
> >> Something like that!
>
> > Yes. See, for example, how the sage.misc.preparser.BackslashOperator
> > is implemented. (I think we have a more generic one, but I'm not sure
> > where it is.)
>
> I presume you mean the infix decorator from this patch:
>
> http://trac.sagemath.org/sage_trac/ticket/6245
>
> I was going to point out the page in the reference manual, but
> apparently somehow that file is not documented in the reference manual.
>
> Anyways, do infix_operator?, see sage.misc.decorator, or just look at
> this example:
>
> sage: @infix_operator('add')
> : def my_add(a,b):
> :     return (a[0]*b[0], a[1]+b[1])
> :
> sage: (3,"Hello") +my_add+ (4, "World!!")
> (12, 'HelloWorld!!')
>
> But it might make a lot more sense to make a simple class that prints
> out the string and number and has an operation defined on it.
>
> sage: class MyClass:
> :     def __init__(self, num, s):
> :         self._num=num
> :         self._s=s
> :     def __add__(self, other):
> :         if isinstance(other, MyClass):
> :             return MyClass(self._num*other._num, self._s+other._s)
> :         raise NotImplemented
> :     def __repr__(self):
> :         return str((self._num, self._s))
> :     def __str__(self):
> :         return self.__repr__()
> :
> sage: a=MyClass(3,"Hello")
> sage: b=MyClass(4,"World!!")
> sage: a
> (3, 'Hello')
> sage: b
> (4, 'World!!')
> sage: a+b
> (12, 'HelloWorld!!')
>
> Thanks,
>
> Jason

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


[sage-devel] Bundle different objects

2011-02-09 Thread Dox
Hi people!

I was wondering if there is a way of bundle two kind of different
objects together and define operations on them.

Suppose, I'd like to bundle a number and a string (3, Hello) and (4,
World!!)... then define and operation which multiplies the numbers and
add strings, so the result is (12, HelloWorld!!)

Something like that!

Thank you all
;-)

Dox

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


[sage-devel] Developing a General Relativity package

2011-01-29 Thread Dox
Hi everyone!

Nowadays I'm working in some complex supergravity calculations, so I'm
much involved into computing GR tensor (Riemann, Ricci and Einstein)
as well as Yang-Mills theories.

I'd like to help or start to develop a package for manipulate this
kind of symbolic manipulation.

How should I begin?

I've already got SAGE 4.6.1 src.

Regards!!!

Dox.

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


[sage-devel] Possible bug in saving a plot!

2011-01-25 Thread Dox
Hi everyone,

Today I was writing a SAGE tip for my blog, about using customized
ticks in plots, and I realize that,

sage: p = plot(sin(x), (x, -7, 7), ticks=pi/2, tick_formatter=pi,
axes_labels=['$x$','$\\sin(x)$'], fontsize=14, color='red')

sage: p.save('/home/me/fig1.pdf')

sage: q = plot(2*x+1,(x,0,5),ticks=[[0,1,e,pi,sqrt(20)],
2],tick_formatter="latex")
sage: q.save('/home/me/fig2.pdf')

saves the figure but the customized ticks are not there, but the usual
numbering. Is this a bug?
I could save this only by showing the figure and save it from the
image viewer (I run Ubuntu 10.10).

An extra comment: Is it possible to write $\frac{3\pi}{2}#$ in the
ticks instead of $\frac{3}{2}\pi$ ? Just for the sake of compactness.

Thank you all!

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


[sage-devel] Re: Transforming exponentials to hyperbolic functions.

2011-01-23 Thread Dox
Thank you very much Francois, much more explicit than I expected!!!

On Jan 23, 4:39 pm, Francois Maltey  wrote:
> Dox a crit :
>
> > Hi guys! I have an easy question... got an expression with
> > exponentials, say exp(x)+exp(-x), How can I get the result in terms of
> > hyperbolic functions
>
> 1/ First you can use the expr.subs method :
>
> y=exp(x)+exp(-x)
> y.subs(exp(x)==sinh(x)+cosh(x)).subs(exp(-x)=cosh(x)-sinh(x))
>
> [You must call subs for all subexpressions : exp(x) and (exp(-x)]
>
> 2/ Second you can also play with match, find and subs :
>
> w0=SR.wild(0)   # w0 is now a matching subexpression
> y.subs(exp(w0)==cosh(w0)+sinh(w0))
>
> The result is sinh(-x) + sinh(x) + cosh(-x) + cosh(x)
> And then y.subs(exp(w0)==cosh(w0)+sinh(w0)).simplify() is pretty.
>
> I think it's impossible to subs the function exp to the other (sum of)
> function(s) exp=cosh+sinh.
> You must use the regular subexpression SR.wild(0) [look at help about
> find, subs and match]
>
> 3/ Third, you can use the outside Sage function rewrite published 
> athttp://wiki.sagemath.org/symbolics/rewriteand get the attachement file
> rewrite.sage, load it.
> and call rewrite (y, rules="exp2sinhcosh").
>
> Choice what you prefer !
>
> F.

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


[sage-devel] Transforming exponentials to hyperbolic functions.

2011-01-23 Thread Dox
Hi guys! I have an easy question... got an expression with
exponentials, say exp(x)+exp(-x), How can I get the result in terms of
hyperbolic functions?

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


[sage-devel] Saving 3D plots

2010-04-17 Thread Dox
Hi guys!
I was wandering... Is it possible to choose the `angle of viewing' a
3D plot at the time of saving it?

Thank you.

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