[sage-support] problem with matrix over finite field

2019-07-11 Thread Hal Snyder
This works on sage-8.5:

sage: a = var('a')
: matrix(GF(25, a), [[1,0], [0, 1]])
: 
[1 0]
[0 1]

but not on sage-8.6 or later:

sage: a = var('a')
: matrix(GF(25, a), [[1,0], [0, 1]])
: 
p025.zzz: No such file or directory
---
RuntimeError  Traceback (most recent call last)
 in ()
  1 a = var('a')
> 2 matrix(GF(Integer(25), a), [[Integer(1),Integer(0)], [Integer(0), 
Integer(1)]])

/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/matrix/constructor.pyx
 
in sage.matrix.constructor.matrix 
(build/cythonized/sage/matrix/constructor.c:2417)()
623   :class:`MatrixArgs`, see :trac:`24742`
624 """
--> 625 return MatrixArgs(*args, **kwds).matrix()
626 
627 

/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/matrix/args.pyx 
in sage.matrix.args.MatrixArgs.matrix 
(build/cythonized/sage/matrix/args.c:7765)()
656 break
657 else:
--> 658 M = self.space(self, coerce=convert)
659 
660 # Also store the matrix to support multiple calls of 
matrix()

/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/matrix/matrix_space.pyc
 
in __call__(self, entries, coerce, copy)
815 [t]
816 """
--> 817 return self.element_class(self, entries, copy, coerce)
818 
819 def change_ring(self, R):

/ext/sage/sage-8.8_1804/local/lib/python2.7/site-packages/sage/matrix/matrix_gfpn_dense.pyx
 
in sage.matrix.matrix_gfpn_dense.Matrix_gfpn_dense.__init__ 
(build/cythonized/sage/matrix/matrix_gfpn_dense.c:5245)()
427 cdef long nc = ma.ncols
428 
--> 429 self.Data = MatAlloc(fl, nr, nc)
430 self._converter = FieldConverter(ma.base)
431 

RuntimeError: Cannot select field GF(25) in file matcore.c (line 130)

This is on Ubuntu 18.04, on CoCalc.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/edfa5067-b473-4242-8879-1a35a93cca33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Numerical integration and parametic curves

2014-09-10 Thread Hal Snyder
Appreciate the pointers.

Plot statement in prior posting could also be

  parametric_plot((g,h),(-pi,pi))

which has a nicer default aspect ratio.

BTW there is sage code for Cornu spiral in the wikipedia article, Euler 
spiral http://en.wikipedia.org/wiki/Euler_spiral.



On Wednesday, September 10, 2014 4:56:05 AM UTC-5, Volker Braun wrote:

 The s = var('s') is not necessary (the argument s inside the functions 
 shadows it).

 As for the original question, IMHO there is a learning opportunity here. 
 Numerical integration is powerful, but it doesn't give you symbolic 
 answers. Even if you make the integration bound a symbolic variable. 

  

 On Wednesday, September 10, 2014 6:09:06 AM UTC+1, Hal Snyder wrote:

 This works on my sage-6.1.1:

 s = var('s')

 def g(s):
 return numerical_integral(cos(pi*x^2/2), 0, s, max_points=100)[0]

 def h(s):
 return numerical_integral(sin(pi*x^2/2), 0, s, max_points=100)[0]

 p = plot((g,h),(-pi,pi),parametric=True)
 show(p)

 On Tuesday, September 9, 2014 5:17:14 PM UTC-5, Jotace wrote:

 Hi all,

 I want (my students) to plot Cornu's spiral, givent in parametric form 
 by 

 x(t) = integral cos(pi/u^2/2), u going from 0 to t , and y(t) defined 
 analogously using the sine function. The integral connot be evaluated 
 symbolically, I guess.

 The first attempt would be

 parametric_plot([integrate(cos(pi*u^2/2),u,0,t),integrate(sin(pi*u^2/2),u,0,t)],(t,-pi,pi))
 which failw (coercion)

 The second attempt would be:

 parametric_plot([integral_numerical(cos(pi*u^2/2),0,t),integral_numerical(sin(pi*u^2/2),0,t)],(t,-pi,pi))
 which also fails.

 I finally did:
 def x(t):
 return integral_numerical(cos(pi*u^2/2),0,t)[0]

 def y(t):
 return integral_numerical(sin(pi*u^2/2),0,t)[0]

 Points = [(x(t),y(t)) for t in sxrange(-pi,pi,2*pi/200)]
 line(Points).show(figsize=[5, 5],aspect_ratio=1)

 This works, but it looks highly inelegant. Also, i cannot expect my 
 students to come up with something like this in a first year undergrad 
 course.

 Is there a way to fix one of the first two options?

 Regards,
 JC



-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Numerical integration and parametic curves

2014-09-09 Thread Hal Snyder
This works on my sage-6.1.1:

s = var('s')

def g(s):
return numerical_integral(cos(pi*x^2/2), 0, s, max_points=100)[0]

def h(s):
return numerical_integral(sin(pi*x^2/2), 0, s, max_points=100)[0]

p = plot((g,h),(-pi,pi),parametric=True)
show(p)

On Tuesday, September 9, 2014 5:17:14 PM UTC-5, Jotace wrote:

 Hi all,

 I want (my students) to plot Cornu's spiral, givent in parametric form by 

 x(t) = integral cos(pi/u^2/2), u going from 0 to t , and y(t) defined 
 analogously using the sine function. The integral connot be evaluated 
 symbolically, I guess.

 The first attempt would be

 parametric_plot([integrate(cos(pi*u^2/2),u,0,t),integrate(sin(pi*u^2/2),u,0,t)],(t,-pi,pi))
 which failw (coercion)

 The second attempt would be:

 parametric_plot([integral_numerical(cos(pi*u^2/2),0,t),integral_numerical(sin(pi*u^2/2),0,t)],(t,-pi,pi))
 which also fails.

 I finally did:
 def x(t):
 return integral_numerical(cos(pi*u^2/2),0,t)[0]

 def y(t):
 return integral_numerical(sin(pi*u^2/2),0,t)[0]

 Points = [(x(t),y(t)) for t in sxrange(-pi,pi,2*pi/200)]
 line(Points).show(figsize=[5, 5],aspect_ratio=1)

 This works, but it looks highly inelegant. Also, i cannot expect my 
 students to come up with something like this in a first year undergrad 
 course.

 Is there a way to fix one of the first two options?

 Regards,
 JC



-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Quick Search missing/broken for OSX 10.9.4?

2014-09-06 Thread Hal Snyder
I'm adding info to a problem previously reported on this group - 
https://groups.google.com/d/msg/sage-support/W02WUZjnX9I/1pr4MiVHpLEJ

- if I launch notebook() from the Sage binary, browse to help and then to 
any of the top row of links (Tutorial, Reference Manual, etc.), the left 
navbar has the text for Quick Search, but there is no input field. If I 
view source for the localhost page, the form definition form 
class=search action=search.html method=get.../form that shows up 
in the online version at www.sagemath.org/doc/reference is absent.

- if I launch tutorial() or manual() directly from the sage prompt, the 
search text field appears in the left navbar, but when I enter text in it, 
I am taken to a screen that says preparing search. There is a sequence of 
dots that animate, but the search does not complete. I don't see any 
processes consuming appreciable CPU time.

I've reproduced this on two Macs running OS X 10.9.4, with versions of sage 
built from 6.3 through 6.4 beta2 source, as well as from the pre-built 
binary at boxen: sage-6.3-x86_64-Darwin-OSX_10.9_x86_64.dmg, and with 
Chrome, Safari, and Firefox.

I wonder if others are seeing this, or if there is some obvious config 
setting I can check.

-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] exponents with units of measurement?

2014-09-01 Thread Hal Snyder
Is there a way to simplify sqrt(some_unit_of_measurement^2) without knowing 
what's in the expression? Often a chain of computations will lead to a 
result like the following:

7.5 * sqrt(units.length.meter^2)

I would sage to simplify the units and give me

7.50*meter

but haven't found symbolic expression ops to get past this output:

7.50*sqrt(meter^2)


-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] exponents with units of measurement?

2014-09-01 Thread Hal Snyder
how could I have missed that? Thank you!

On Monday, September 1, 2014 10:35:11 PM UTC-5, shersonb wrote:

  Try the .simplify_radical() method.

 ~Brian
  

-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: My Reference Manualdoesnt have a Quick search input box.

2014-08-10 Thread Hal Snyder
Reproduced here with Sage Version 6.3, Release Date: 2014-08-10 on OS X 
10.9.4 and Google Chrome.

1. No search box at bottom of left navbar in reference manual if I follow 
link from notebook() and help, or visit the help link directly in the 
notebook server at http://localhost:8080/doc/live/reference/index.html.

2. But search box is there if I do manual() from the sage command prompt 
and view in the same browser, which is using file URL: file:///Users/.../
sage/src/doc/output/html/en/reference/index.html

On Sunday, August 10, 2014 7:47:31 AM UTC-5, Emmanuel Charpentier wrote:

 Hmmm... Turns out it's not that simple :

 From the *NOTEBOOK*, when you click on help, you get a new browser 
 window displaying  http://localhost:8080/help, which as a Reference 
 manual button leading you to 
 http://localhost:8080/doc/live/reference/index.html, which has, in bottom 
 of the left panel the mention quick search in large character, and the 
 mention Enter search terms or a module, class or function name. in 
 normal characters, but no input box for searching.

 From the *COMMAND LINE*, the manual() function directly opens a new 
 browser window opening 
 file:///usr/local/sage-6.3/src/doc/output/html/en/reference/index.html, 
 which has the same mentions as from notebook AND an input box and a Go 
 bytton between title and explanatory text. Calling sage from emacs with 
 sage_mode gives the same behaviour.

 So it *seems* that the notebook, which passes its requests to the sage 
 server, gets a Web page somewhat different from the raw file the browser 
 gets from the files of the local documentation.

 I hope it's clear, but it's difficult to describe.

 HTH,

 --
 Emmanuel Charpentier

 Le dimanche 10 août 2014 13:38:58 UTC+2, Volker Braun a écrit :

 The reference manual (http://www.sagemath.org/doc/reference/index.html 
 http://www.google.com/url?q=http%3A%2F%2Fwww.sagemath.org%2Fdoc%2Freference%2Findex.htmlsa=Dsntz=1usg=AFQjCNFI6s6W9Th6tx9BQ_dcDf0rMsiLfg)
  
 does have the search box even in recent versions for me. It doesn't have 
 interactive cells. What are you looking at exactly?


 On Sunday, August 10, 2014 10:07:51 AM UTC+1, Emmanuel Charpentier wrote:

 I just noticed that in the recent versions of Sage (6.3betaSomething), 
 the reference manual I get after compilation does not have an input box for 
 quick search in the left panel.

 I checked that this was not a browser problem : I have no proble 
 accessing the online manual's http://www.sagemath.org/doc/reference/ 
 quick search box.

 I also checked that (my) manual *is* interactive (I can modify celle 
 contents and get relevant results). So I probably missed something in the 
 compilation configuration. The question is, of course, What ?.

 Sincerely,

 --
 Emmanuel Charpentier



-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: numerical approximation with units of measurement?

2014-06-06 Thread Hal Snyder
Thank you! I have a lot to learn about Sage, I can see. Will study  
experiment with recn.

In most cases, an integer exponent should look like 2 and not 
2.000, don't you think? So I guess I would not n() the exponents.

I have just started using Sage and SMC with some online classes. It's great 
to:
- check work with units of measure
- take notes that look like math rather than COBOL (+1 typeset_mode)
- do symbolic and numerical calculations in those same typeset notes

I'm hooked. :-)

On Friday, June 6, 2014 6:53:18 PM UTC-5, Nils Bruin wrote:

 On Thursday, June 5, 2014 6:32:42 PM UTC-7, Hal Snyder wrote:

 IIs there a simple way to take n() of things without getting into the 
 following?

 You could automate the application, but you'll quickly see you need to be 
 a bit careful:

 #unfortunately, the operators returned for sums and products of multiple
 #arguments are callable, but don't accept multiple arguments, so we need to
 #do a little surgery ourselves (borrow the functionality from elsewhere):
  
 opdict = {
   operator.mul : sage.interfaces.maxima_lib.mul_vararg,
   operator.add : sage.interfaces.maxima_lib.add_vararg,
 }
 def recn(e):
 try:
 return n(e)
 except TypeError:
 pass
 op=e.operator()
 if op:
 if op in opdict:
   op = opdict[op]
 return op(*[recn(c) for c in e.operands()])
 else:
 return e
 --

 This now works, a little bit:

 sage: recn(area)
 21.5161409036487*meter^2.00

 As you can see, the exponent in meter^2 was also numerified. Perhaps you 
 didn't want that?

 Nonetheless, a recursive n(..) method seems eminently reasonable and 
 desirable to implement.


-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] numerical approximation with units of measurement?

2014-06-05 Thread Hal Snyder
Is there a preferred way of taking numerical approximation of a quantity in 
Sage with units of measure? Here is a contrived example:

r = 123/47 * units.length.meter
r
area = pi * r^2
area

output:

123/47*meter
15129/2209*pi*meter^2

Now imagine that r is not a literal but the result of other calculations 
involving units of measure, so you can't easily apply n() at the time of 
assignment to r. Is there a simple way to take n() of things without 
getting into the following?

# n(r)
n(r.coeffs()[0][0]^r.coeffs()[0][1])*r.args()[0]
==
2.61702127659574*meter

# n(area)
(n(area.coeffs()[0][0])*(area.args()[0])^area.coeffs()[0][1])
==
21.5161409036487*meter^2

###

-- 
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 http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.