[sage-support] sagesilent block in a newcommand macro

2012-01-16 Thread jplab
Hi everyone,

I would like to include some nice tikz pictures of polytopes generated
by sage (see http://trac.sagemath.org/sage_trac/ticket/12083 for the
ticket.) in a tex file.

But since I'm a lazy guy, I want tex to do the work for me. That's why
I thought of a tex command that would:

1) take all the needed arguments;
2) run a sagesilent block;
3) include the produced tikz picture (produced in the sagesilent
block, included in a file).

All that in a very nice tex command.

Something like (replacing the polytope things by a matrix for
simplication reasons...):

\newcommand{\tikzimage}[1]{\begin{sagesilent}
   M=matrix([[1,1],
[2,2]])
   Image=latex(M)
 
open('dessin.tex', 'w').write(Image);
  \end{sagesilent}
  \input{dessin.tex}
  }

But, there is a problem: \newcommand doesn't like the environment
sagesilent. It accepts center blocks and others, but as soon as a
sagesilent is in there... There's a problem:

Runaway argument?
! File ended while scanning use of \next.

Where could the problem come from? My idea is that the sagesilent
misses something. What, I personally don't know... :-S

If you have any ideas, it would be great!

Thanks,
J-P Labbé

-- 
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] Factors of an integer

2012-01-16 Thread Santanu Sarkar
Is there any function in Sage by which I can get the
number of prime factors,  number of factors of a
positive ineger?

-- 
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


Re: [sage-support] Factors of an integer

2012-01-16 Thread Renan Birck Pinheiro
2012/1/16 Santanu Sarkar sarkar.santanu@gmail.com

 Is there any function in Sage by which I can get the
 number of prime factors,  number of factors of a
 positive ineger?

 If I understand you correctly:

sage: factor(372)
2^2 * 3 * 31

One can get the number of factors by using 'len' on the result of this or
in tuples form by using 'list':

sage: len(factor(372))
3
sage: list(factor(372))
[(2, 2), (3, 1), (31, 1)]

Renan
-- 
Renan Birck Pinheiro, Grupo de Microeletrônica
http://www.ufsm.br/gmicro, Engenharia
Elétrica http://www.ufsm.br/cee, UFSM http://www.ufsm.br - Santa Maria,
Brazil

http://renanbirck.blogspot.com / skype: renan.ee.ufsm

-- 
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


Re: [sage-support] Problem building sage-4.7.2

2012-01-16 Thread Jeroen Demeyer
To be more precise: use the 4.8 release candidate sage-4.8.rc0 source
tarball:

http://boxen.math.washington.edu/home/release/sage-4.8.rc0/sage-4.8.rc0.tar

Please let us know whether this fixes your problem.

-- 
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] [ANN] global constrained optimization solver with discrete variables and specifiable accuracy

2012-01-16 Thread dmitrey
hi all,
I've done support of discrete variables for interalg (http://
openopt.org/interalg) - free (license: BSD) global optimization solver
with specifiable accuracy, you can take a look at an example here:
http://trac.openopt.org/openopt/browser/PythonPackages/FuncDesigner/FuncDesigner/examples/exactGlobalMINLP.py

It is written in Python + NumPy, and I hope it's speed will be
essentially increased when PyPy (Python with dynamic compilation)
support for NumPy will be done (some parts of code are not vectorized
and still use CPython cycles). Also, NumPy funcs like vstack() or
append() produce only copy of data, and it also slows the solver very
much (for mature problems).

Maybe some bugs still present somewhere - interalg code already became
very long, but since it already works, you could be interested in
trying to use it right now.

Regards, D.

-- 
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


Re: [sage-support] Re: Problem building sage-4.7.2

2012-01-16 Thread Prof. Dr. Ulrich Tipp
Hello,

I downloaded the readline-6.2.p3 and now the build goes through. Thank
you very much.

Ulrich



-- 
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: plots in 3d are not published?

2012-01-16 Thread Jason Grout

On 1/14/12 5:55 PM, David wrote:

It does appear that this may be a misconfiguration of sagenb.org. In
addition to the canterbury site, I've published a worksheet with jmol
plots on our internal server, v. 4.6, and it works fine. When I try to
do it at sagenb.org, my javascript console complains that jmol_applet
is undefined. This seems to be some sage-specific applet, not part of
jmol.


I've pushed a fix to test.sagenb.org [1].  Can people test it?  Existing 
published worksheets won't work, but things should work if you publish a 
new worksheet, and possibly if you republish a worksheet.


Thanks,

Jason


[1] https://github.com/sagemath/sagenb/pull/26, which needs review

--
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


Re: [sage-support] sagesilent block in a newcommand macro

2012-01-16 Thread Dan Drake
On Mon, 16 Jan 2012 at 03:10AM -0800, jplab wrote:
 But since I'm a lazy guy, I want tex to do the work for me. That's why
 I thought of a tex command that would:
 
 1) take all the needed arguments;
 2) run a sagesilent block;
 3) include the produced tikz picture (produced in the sagesilent
 block, included in a file).
 
 All that in a very nice tex command.
 
 Something like (replacing the polytope things by a matrix for
 simplication reasons...):
 
 \newcommand{\tikzimage}[1]{\begin{sagesilent}
M=matrix([[1,1],
 [2,2]])
Image=latex(M)
  
 open('dessin.tex', 'w').write(Image);
   \end{sagesilent}
   \input{dessin.tex}
   }

My first thought is, why do you need to write to an external file? It
looks like you could just do

\newcommand{\tikzimage}[1]{\sage{matrix([1,1],[2,2])}}

Another (untested!) idea is: use a regular sagesilent block to set up a
function that does what you want, and then use \sagestr to pull in the
code you want. Something like

\begin{sagesilent}
  def foo(x):
return 'some tikz code with {0} in it'.format(x)
\end{sagesilent}

\newcommand{\tikzimage}[1]{\sagestr{#1}}

The \sagestr macro just pulls in a string, it doesn't run latex() on its
argument -- see the Make Sage write your LaTeX for you and the
Plotting functions in TikZ with SageTeX sections of the example file:
https://bitbucket.org/ddrake/sagetex/src/tip/example.tex (and the
typeset version:
https://bitbucket.org/ddrake/sagetex/downloads/example.pdf.

Do any of these ideas work for you?

Dan

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


signature.asc
Description: Digital signature