[sage-support] Re: Reconstructing a symbolic expression with derivative from the string representation

2017-02-22 Thread Nils Bruin
On Wednesday, February 22, 2017 at 10:49:11 PM UTC-8, Ralf Stephan wrote:
>
> Yes, there is no symbolic diff function and so it does not appear
> in the dictionary for translating strings to expressions. It has other
> consequences too so I consider writing a dummy function like
> Function_sum a good idea.
>
 
I agree. In fact, this printing has only been in place since 
https://trac.sagemath.org/ticket/21286 . Before we'd get D[0](f)(x). That's 
in fact also not so hard to parse. With something along the lines of:

from sage.symbolic.operators import FDerivativeOperator
class Doperator(object):
  def __getitem__(self,L):
if not(isinstance(L,tuple)):
  L=(L,)
return lambda f: FDerivativeOperator(f,L)
D=Doperator()
 
in place, we can just write D[0](sin)(x) .

If you're going to make diff(...) parseable, perhaps we can make the above 
as well. Whether we can bind this to the toplevel letter D is another 
matter.

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


[sage-support] Re: Reconstructing a symbolic expression with derivative from the string representation

2017-02-22 Thread Ralf Stephan
On Wednesday, February 22, 2017 at 7:11:50 PM UTC+1, Nils Bruin wrote:
>
> Clearly, SR('diff(...)') operates in a scope where "diff" isn't bound to 
> the toplevel "diff".
>

Yes, there is no symbolic diff function and so it does not appear
in the dictionary for translating strings to expressions. It has other
consequences too so I consider writing a dummy function like
Function_sum a good idea.

Regards,

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


[sage-support] Re: integrate problem (bug?)

2017-02-22 Thread Eric Gourgoulhon
This is fixed in Sage 7.6.beta2:

┌┐
│ SageMath version 7.6.beta2, Release Date: 2017-02-01   │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
┏┓
┃ Warning: this is a prerelease version, and it may be unstable. ┃
┗┛
sage: integrate(x/(1+x^2),x,0,infinity)
---
ValueErrorTraceback (most recent call last)
...
ValueError: Integral is divergent.



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


[sage-support] integrate problem (bug?)

2017-02-22 Thread robin hankin
Hi.


I seem to be getting zero for a divergent integral:


SageMath % ./sage
┌┐
│ SageMath version 7.5.1, Release Date: 2017-01-15   │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘
sage: var('x')
x
sage: integrate(x/(1+x^2),x,0,infinity)
0



This integral is definitely divergent so I'd say that reporting zero is
misleading,  I would expect either an error or to return 'infinity', or to
report that the integral is divergent.

best wishes

Robin


-- 
Robin Hankin
Neutral theorist
hankin.ro...@gmail.com

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


[sage-support] Reconstructing a symbolic expression with derivative from the string representation

2017-02-22 Thread Eric Gourgoulhon
Hi, 

I am puzzled by the following code in sage 7.5:

sage: df = diff(function('f')(x), x); df
diff(f(x), x)
sage: repr(df)
'diff(f(x), x)'
sage: df1 = SR(repr(df)); df1
diff(f(x), x)

df and df1 look the same and we even have

sage: bool(df1 == df)
True

However, they are not identical:

sage: latex(df)
\frac{\partial}{\partial x}f\left(x\right)
sage: latex(df1)
{\rm diff}\left(f\left(x\right), x\right)

sage: df.operator()
D[0](f)
sage: df1.operator()
diff

sage: diff(df, x)
diff(f(x), x, x)
sage: diff(df1, x)
D[0](diff)(f(x), x)*diff(f(x), x) + D[1](diff)(f(x), x)

Any thoughts? Shouldn't SR(repr(df)) always give back df? If not, how to 
recover df from repr(df) in the current case?

Eric.

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


[sage-support] Re: Ssh problems

2017-02-22 Thread Simon King
Hi Dima,

On 2017-02-21, Dima Pasechnik  wrote:
> first of all, put your (new?) ssh key to trac, and also to github, if you 
> have an account there.

For *cloning*? Sure, I need it for pushing. But I don't think I have
ever made Sage aware of my github account (not sure if I have one).

> Some firewalls prevent plain "git" protocol, in effect, you need to use ssh 
> or https
> to connect to github.
> Assuming your ssh key is there, do
>
> git clone g...@github.com:sagemath/sage.git 
> 
>
> this will make sure you go via ssh...

I didn't try that, as the suggestion "use https://github... instead of
git://github..." works for me.

Thank you very much,
Simon

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


[sage-support] Re: Ssh problems

2017-02-22 Thread Simon King
Hi Eric,

On 2017-02-21, Eric Gourgoulhon  wrote:
> What about 
> git clone https://github.com/sagemath/sage.git
> (note the change "git:" --> "https:")
> Does it work better for you ?

Thank you! That seems to do the trick. So, should the development
mantual be changed accordingly?

Cheers,
Simon

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


Re: [sage-support] Silly Cython question

2017-02-22 Thread John Cremona
On 21 February 2017 at 22:02, Watson Ladd  wrote:
>
>
> On Tuesday, February 21, 2017 at 1:07:43 PM UTC-8, Jeroen Demeyer wrote:
>>
>> On 2017-02-21 22:02, Watson Ladd wrote:
>> > I am having trouble figuring out which imports I need to get the
>> > right names to appear
>>
>> Use the import_statements() function to determine which import
>> statements you need. There shouldn't be a difference between Python and
>> Cython regarding import statements.

After newarly 10 years of work on Sage I did not know of
import_statements()!  Just yesterday I was doing things like
search_src("import", "primes") when I could have just done
import_staements(primes).

Thanks, Jeroen.



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

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


[sage-support] Re: splitting field vs. Galois closure

2017-02-22 Thread Johan S. H. Rosenkilde
On Sunday, January 8, 2017 at 10:14:32 AM UTC+1, Marc Mezzarobba wrote:
>
> Simon King wrote: 
> > Wouldn't it be better to [...] or change the 
> > arithmetic operations by *avoiding* a call to __init__()? 
>
> That's what the branch I pointed to tries to do, to some extent at 
> least. But the structure of generic polynomial classes (with many 
> operations implemented in an abstract a base class, then a Cython 
> subclass for the generic dense data structure, and a hierarchy of Python 
> sub-subclasses that uses multiple inheritance) doesn't make it easy to 
> avoid the calls to __init__() entirely without deeper changes. 
>
> -- 
> Marc 
>
 
Sorry for hijacking the thread, but is this something that could be 
interesting to keep in mind / work on if the GSoC project on redesigning 
polynomials in Sage gets underway:

https://wiki.sagemath.org/GSoC/2017#Redesigning_the_polynomial_class_hierarchy_and_linking_with_libraries

Best,
Johan

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


[sage-support] Re: Patterson Algorithm

2017-02-22 Thread Johan S. H. Rosenkilde
Hi Panos

The snippet you gave  certainly does not work since it will compute the gcd 
of 1 and something else, which is - of course - 1.

What you need is to compute the *half gcd* of R and g, i.e. run the 
Extended Euclidean algorithm about half-way and then stop. The Bezout 
relation from that iteration will give you what you want:

   u_i * R + v_i * g = r_i

i.e.

   r_i == u_i * R mod g

For Patterson's algorithm, the restriction you need, if I recall correctly, 
is something like deg r_i > deg u_i. Use this as stopping-criteria for your 
half-gcd and you should be good.

A half-gcd as described above is already included in Sage for the 
Gao-decoding algorithm of Reed-Solomon codes. It's implemented in 
sage/coding/grs.py and called partial_xgcd.

If you're implementation becomes nice, Goppa codes is really something we 
need in Sage. Consider opening a ticket and feel free to cc me on it.

Good luck,
Best,
Johan




On Monday, February 13, 2017 at 1:41:49 AM UTC+1, Panos Phronimos wrote:
>
> Hello,
>
> I am trying to implement Patterson's Algorithm for decoding Goppa codes.
>
> I am stuck in the part that I have to find two polynomials a(x) and b(x) 
> so that a(x)=b(x)R(x)mod(g(x))
> where g(x) is the goppa poly and deg(a(x)) must be <= t/2.
> I know that i have to use extended Euclidean Algorithm and i have decoded 
> several random examples but 
> i can't find a general solution for any given equation.
>
> P.S. A paper i advised proposed the following code:
> (d,u,v) = xgcd(PR(1),PR(R.list())); #Where PR is a polynomial ring over an 
> extension of GF(2)
> a = g*u; b = g*v;
> But I don't think is working correctly in the way i implemented it!
>
>
> Thanks in advance!
>
>
>

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


Re: [sage-support] Re: Lattice reduction over polynomial lattice

2017-02-22 Thread Johan S. R. Nielsen
Indeed, Sage has row_reduced_form for a polynomial matrix. The row reduced 
form is sufficient to find a vector in the row space which has minimal 
degree.

The method used to be called weak_popov_form, but that form is slightly 
stronger and the algorithm does not compute it. Hence the warning.

The current implementation is very slow. The next beta release of Sage 
should feature #21024 which introduces an implementation of the 
Mulders-Storjohann algorithm, which computes the weak Popov form, and does 
so much faster than the current row_reduced_form (hence, row_reduced_form 
will, in the future, actually call weak_popov_form). If you are impatient, 
you can checkout that ticket and recompile Sage to get the new 
implementation right away.

Best,
Johan

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