[sage-support] Re: jmol won't display
On 2/6/12 10:06 PM, David wrote: No line number. If I click on the url in the error I get the source, but it just leaves me at the top. Here's the error: http://skink.whitman.edu/sage_error.png Hmmm. Double Hmmm... Here's a possible cause: http://stackoverflow.com/questions/227552/common-sources-of-unterminated-string-literal Here's an idea: jmol is launched via javascript that is sent to the browser. That javascript is eval'd in the browser. Somewhere in that javascript that is sent to the browser, there is some sort of problem. Here's one way to diagnose if this is the problem. In SAGE_ROOT/devel/sagenb/sagenb/data/sage/js/notebook_lib.js, modify the eval_script_tags function to log the string it eval()'s. (In other words, put console.log(code) just above eval(code) in that function). Then we can see exactly what code is being evaluated. There are a few other places that code is evaled, but my guess is that it is in the eval_script_tags function. Do other javascript things work? For example, does shift-enter evaluate a cell? Thanks, Jason -- 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: jmol won't display
More information: I get a black square where the jmol figure should be, and the jmol menus are active. -- David -- 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: jmol won't display
No line number. If I click on the url in the error I get the source, but it just leaves me at the top. Here's the error: http://skink.whitman.edu/sage_error.png -- 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: jmol won't display
On 2/6/12 9:38 PM, David wrote: I just tried test.sagenb.org on a 10.04 machine at home, same problem. All machines are sun java, I think the latest version of java 1.6. I have also tried turning off all firefox extensions, no help. HmmmYou said you had an error message. Usually console error messages include a line number, IIRC, and if you click on the line number, it brings up the file in question. Do you see a line number for the error, by chance? Jason -- 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: jmol won't display
I just tried test.sagenb.org on a 10.04 machine at home, same problem. All machines are sun java, I think the latest version of java 1.6. I have also tried turning off all firefox extensions, no help. -- David -- 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: jmol won't display
On 2/6/12 8:56 PM, David wrote: It happens on sagenb.org 4.7.2 and on our internal 4.6 sage server. I'll check the test server when I go to work tomorrow. Do you have the Sun Java installed, or the Iced Tea thing? IIRC, you need to install the sun jdk; the iced tea version won't work. I know others have dealt with java issues with jmol on ubuntu before (for example, Dan Drake, if I recall correctly). Thanks, Jason -- 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: jmol won't display
It happens on sagenb.org 4.7.2 and on our internal 4.6 sage server. I'll check the test server when I go to work tomorrow. -- David -- 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: jmol won't display
On 2/6/12 6:08 PM, David wrote: Hi all-- This has been driving me nuts. In firefox on two computers running ubuntu 10.04, jmol plots do not appear, and I get this in the javascript error console: unterminated string literal window.top.status='script compiler ERROR: command expected Using chrome on the same machines, or the same version of firefox on an ubuntu 11.04 machine I have no problem. I can view other jmol instances (not in sage) just fine in firefox on the two problem machines. In fact, I can take the same jmol output from sage and put it as a standalone jmol applet on another server and firefox is happy. Anyone run across this? Any ideas? Is this with sagenb.org? Or with 4.8 on a local machine? What happens on sagenb.org and test.sagenb.org? Thanks, Jason -- 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: Changing the latex representation of the output of derivative.
On Feb 6, 4:22 pm, Oscar Lazo wrote: > That worked excelent! I made the following code: > > from sage.symbolic.function import BuiltinFunction > class AiryAi(BuiltinFunction): > def __init__(self): > BuiltinFunction.__init__(self, "ai", > latex_name=r"\operatorname{Ai}") > def _derivative_(self, x, diff_param=None): return aip(x) > > class AiryAiPrime(BuiltinFunction): > def __init__(self): > BuiltinFunction.__init__(self, "aip", > latex_name=r"\operatorname{Ai}'") > > class AiryBi(BuiltinFunction): > def __init__(self): > BuiltinFunction.__init__(self, "bi", > latex_name=r"\operatorname{Bi}") > def _derivative_(self, x, diff_param=None): return bip(x) > > class AiryBiPrime(BuiltinFunction): > def __init__(self): > BuiltinFunction.__init__(self, "bip", > latex_name=r"\operatorname{Bi}'") > > ai=AiryAi() > bi=AiryBi() > aip=AiryAiPrime() > bip=AiryBiPrime() > ai(x)+bi(x)+aip(x)+bip(x) > > And now stuff like > f=A1*ai(k*x)+B1*bi(k*x) > f > diff(f,x).subs(x=x0) > > works exactly the way I wanted. > > Thank you! > Great! Oscar, you have a Trac account, right? Would you mind opening up a ticket to make these functions "symbolic", put your code up as a "protopatch", add the ticket to an appropriate place on http://trac.sagemath.org/sage_trac/wiki/symbolics/functions, and cc: users kcrisman, burcin, and benjaminfjones on the ticket?Since we have robust numerical evaluation for this, we might as well add them in this way. Thanks! - kcrisman -- 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] f2py throws strange error
Hello I've got this code in fortran: !f90 !f90 ! ALGORITHM 819, COLLECTED ALGORITHMS FROM ACM. ! THIS WORK PUBLISHED IN TRANSACTIONS ON MATHEMATICAL SOFTWARE, ! VOL. 28,NO. 3, September, 2002, P. 325--336. ! Code converted using TO_F90 by Alan Miller ! Date: 2002-11-04 Time: 15:13:16 MODULE AiryFunction IMPLICIT NONE !INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(12, 60) PRIVATE PUBLIC :: aiz, biz ! COMMON /param1/ pi, pihal REAL , PARAMETER :: pi = 3.1415926535897932385, & pihal = 1.5707963267948966192 ! COMMON /param2/ pih3, pisr, a, alf REAL , PARAMETER :: pih3 = 4.71238898038469, & pisr = 1.77245385090552 REAL , SAVE :: a, alf ! COMMON /param3/ thet, r, th15, s1, c1, r32 REAL , SAVE :: thet, r, th15, s1, c1, r32 ! COMMON /param4/ facto, th025, s3, c3 REAL , SAVE :: facto, th025, s3, c3 CONTAINS SUBROUTINE aiz(ifun, ifac, x0, y0, gair, gaii, ierro) ! ! COMPUTATION OF THE AIRY FUNCTION AI(Z) OR ITS DERIVATIVE AI'(Z) ! THE CODE USES: ! 1. MACLAURIN SERIES FOR |Y| < 3 AND -2.6 < X <1.3 (Z=X + I*Y) ! 2. GAUSS-LAGUERRE QUADRATURE FOR |Z| < 15 AND WHEN ! MACLAURIN SERIES ARE NOT USED. ! 3. ASYMPTOTIC EXPANSION FOR |Z| > 15. ! ! INPUTS: ! IFUN: ! * IFUN=1, THE CODE COMPUTES AI(Z) ! * IFUN=2, THE CODE COMPUTES AI'(Z) ! IFAC: ! * IFAC=1, THE CODE COMPUTES AI(Z) OR AI'(Z) ! * IFAC=2, THE CODE COMPUTES NORMALIZED AI(Z) OR AI'(Z) ! X0: REAL PART OF THE ARGUMENT Z ! Y0: IMAGINARY PART OF THE ARGUMENT Z ! OUTPUTS: ! GAIR: REAL PART OF AI(Z) OR AI'(Z) ! GAII: IMAGINARY PART OF AI(Z) OR AI'(Z) ! IERRO: ERROR FLAG ! * IERRO=0, SUCCESSFUL COMPUTATION ! * IERRO=1, COMPUTATION OUT OF RANGE ! ! ACCURACY: ! 1) SCALED AIRY FUNCTIONS: ! RELATIVE ACCURACY BETTER THAN 10**(-13) EXCEPT CLOSE TO THE ZEROS, ! WHERE 10**(-13) IS THE ABSOLUTE PRECISION. ! GRADUAL LOSS OF PRECISION TAKES PLACE FOR |Z|>1000 ! (REACHING 10**(-8) ABSOLUTE ACCURACY FOR |Z| CLOSE TO 10**(6)) ! IN THE CASE OF PHASE(Z) CLOSE TO PI OR -PI. ! 2) UNSCALED AIRY FUNCTIONS: ! THE FUNCTION OVERFLOWS/UNDERFLOWS FOR ! 3/2*|Z|**(3/2) > LOG(OVER). ! FOR |Z| < 30: ! A) RELATIVE ACCURACY FOR THE MODULUS (EXCEPT AT THE ZEROS) ! BETTER THAN 10**(-13). ! B) ABSOLUTE ACCURACY FOR MIN(R(Z),1/R(Z)) BETTER THAN 10**(-13), ! WHERE R(Z)=REAL(AI)/IMAG(AI) OR R(Z)=REAL(AI')/IMAG(AI'). ! FOR |Z| > 30, GRADUAL LOSS OF PRECISION TAKES PLACE AS |Z| INCREASES. !CCC ! AUTHORS: ! AMPARO GIL (U. AUTONOMA DE MADRID, MADRID, SPAIN). ! E-MAIL: amparo@uam.es ! JAVIER SEGURA (U. CARLOS III DE MADRID, MADRID, SPAIN). ! E-MAIL: jseg...@math.uc3m.es ! NICO M. TEMME (CWI, AMSTERDAM, THE NETHERLANDS). ! E-MAIL: nico.te...@cwi.nl ! ! REFERENCES: ! COMPUTING AIRY FUNCTIONS BY NUMERICAL QUADRATURE. ! NUMERICAL ALGORITHMS (2002). ! A. GIL, J. SEGURA, N.M. TEMME ! INTEGER, INTENT(IN) :: ifun INTEGER, INTENT(IN) :: ifac REAL , INTENT(IN) :: x0 REAL , INTENT(IN) :: y0 REAL , INTENT(OUT) :: gair REAL , INTENT(OUT) :: gaii INTEGER, INTENT(OUT) :: ierro REAL :: over, under, dl1, dl2, cover REAL :: f23, pi23, sqrt3, xa, ya, f23r, df1, df2, s11, c11, dex, dre, & dima, gar, gai, c, s, u, v, v0, ar, ai, ar1, ai1, ro, coe1, & coe2, rex, dfr, dfi, ar11, ai11 INTEGER :: iexpf, iexpf2, n ! COMMON /param1/ pi, pihal ! COMMON /param2/ pih3, pisr, a, alf ! COMMON /param3/ thet, r, th15, s1, c1, r32 ! COMMON /param4/ facto, th025, s3, c3 REAL , PARAMETER :: x(1:25) = (/ & .283891417994567679D-1, .170985378860034935D0, & .435871678341770460D0, .823518257913030858D0, & 1.33452543254227372D0, 1.96968293206435071D0, & 2.72998134002859938D0, 3.61662161916100897D0, & 4.63102611052654146D0, 5.77485171830547694D0, & 7.05000568630218682D0, 8.45866437513237792D0, & 10.0032955242749393D0, 11.6866845947722423D0, & 13.5119659344693551D0, 15.4826596959377140D0, & 17.6027156808069112D0, 19.8765656022785451D0, & 22.3091856773962780D0, 24.9061720212974207D0, & 27.6738320739497190D0, 30.6192963295084111D0, & 33.7506560850239946D0, 37.0771349708391198D0, & 40.6093049694341322D0 /) REAL , PARAMETER :: w(1:25) = (/ & .143720408803313866D0, & .230407559241880881D0, .242253045521327626D0, & .203636639103440807D0, .143760630622921410D0, & .869128834706078120D-1, .454175001832915883D-1, & .206118031206069497D-1, .814278821268606972D-2, & .280266075663377634D-2, .840337441621719716D-3, & .219303732907765020D-3, .497401659009257760D-4, & .978508095920717661D-5, .166542824603725563D-5, & .244502736801316287D-6, .308537034236207072D-7, & .333296072940112245D-8, .306781892316295828D-9, & .239331309885375719D-10, .157294707710054952D-11, & .864936011664392267D-13, .394819815638647111D-14, & .148271173082850884D-15, .453390377327054458D-17 /) REAL ,
[sage-support] jmol won't display
Hi all-- This has been driving me nuts. In firefox on two computers running ubuntu 10.04, jmol plots do not appear, and I get this in the javascript error console: unterminated string literal window.top.status='script compiler ERROR: command expected Using chrome on the same machines, or the same version of firefox on an ubuntu 11.04 machine I have no problem. I can view other jmol instances (not in sage) just fine in firefox on the two problem machines. In fact, I can take the same jmol output from sage and put it as a standalone jmol applet on another server and firefox is happy. Anyone run across this? Any ideas? -- David -- 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] functions
On Mon, Feb 6, 2012 at 3:12 PM, Chappman wrote: > Hi, I am currently trying to write a program for my project and am > trying to make the following syntax work: > > > if y_1=y_2: > [y_1,y_2]=2 > elif y_1>y_2: > [y_1,y_2]=1 I think you want is > if y_1 = y_2: > y_1 = y_2 = 2 > elif y_1>y_2: > y_1 = y_2 = 1 "[a,b] = x" essentially means "tmp = list(x); a = tmp[0]; b = tmp[1]" > x=0 > for y_1 in [1..2]: > for y_2 in [1..y_1]: > x += [y_1,y_2] > print x What are you trying to do here? x is an integer, [y_1, y_2] is a list of integers. It doesn't really make sense to add an integer to a list. > The error messages I am getting is " TypeError: > 'sage.rings.integer.Integer' object is not iterable ". > > When this code is fixed and does work, the answer would be x=5. > Can anybody see where my code is going wrong please? > > Kind Regards > Chappman > > -- > 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 -- 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] functions
Hi, I am currently trying to write a program for my project and am trying to make the following syntax work: if y_1=y_2: [y_1,y_2]=2 elif y_1>y_2: [y_1,y_2]=1 x=0 for y_1 in [1..2]: for y_2 in [1..y_1]: x += [y_1,y_2] print x The error messages I am getting is " TypeError: 'sage.rings.integer.Integer' object is not iterable ". When this code is fixed and does work, the answer would be x=5. Can anybody see where my code is going wrong please? Kind Regards Chappman -- 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: Evaluate quickly a complex expression
On Mon, Feb 6, 2012 at 1:01 PM, Jason Grout wrote: > On 2/6/12 1:33 PM, Oscar Lazo wrote: >> >> That is very nice! Unfortunately I need to evaluate many different >> expressions quickly, so the copy-paste aproach is not an option. >> That's why I wrote the fast_complex function. I'll be working in such >> a general implementation, do you think it's worth getting it into >> sage, or should fast_float be modified to accept complex expressions? > > > fast_callable is the answer to getting fast_float to accept complex > expressions. Seeing how fortran just stomps on fast_callable and even > copy-paste of Cython (i.e., it's *way* faster), I think it would be really > cool to get a fast_callable backend that uses fortran. A step towards that > would be your fortran-generating fast_complex. > > It could be called as fast_callable(expr, domain=CDF, compiler="fortran") or > something. Note that fast_callable (and fast_float) before it use an interpreter because actually invoking the compiler can be literally millions of times slower than a sub-optimal evaluation (with domain=RDF or domain=CDF). That can mean that if you're actually evaluating the function less then a million (or thousand, or whatever depending on the ratio) times then you're not gaining anything even if the compiled code runs in no time at all. That being said, fast_callable construction could stand to be faster, and even more there's *lots* of low-hanging for fast_callable over the complex field here: sage: z_fast_callable=fast_callable(z,vars=[K1,K2],domain=CC) sage: z_fast_callable.python_calls() [exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp, exp] sage: z_fast_callable=fast_callable(z,vars=[K1,K2],domain=CDF) sage: z_fast_callable.python_calls() [(^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^3), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^2), (^3), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^2), (^3), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^2), (^3), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^3), (^2), (^3), (^3), (^2), (^2), (^3), (^2), (^2)] Common sub-expression elimination (and constant folding) would be really handy here for this particular example as well, I wonder if that's the trick that the Fortran compiler is able to pull. I don't have time to play with it now, but it may also be worth trying "cdef extern from "complex.h": pass" to use c99 complex numbers in the Cython version. - Robert -- 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: Changing the latex representation of the output of derivative.
That worked excelent! I made the following code: from sage.symbolic.function import BuiltinFunction class AiryAi(BuiltinFunction): def __init__(self): BuiltinFunction.__init__(self, "ai", latex_name=r"\operatorname{Ai}") def _derivative_(self, x, diff_param=None): return aip(x) class AiryAiPrime(BuiltinFunction): def __init__(self): BuiltinFunction.__init__(self, "aip", latex_name=r"\operatorname{Ai}'") class AiryBi(BuiltinFunction): def __init__(self): BuiltinFunction.__init__(self, "bi", latex_name=r"\operatorname{Bi}") def _derivative_(self, x, diff_param=None): return bip(x) class AiryBiPrime(BuiltinFunction): def __init__(self): BuiltinFunction.__init__(self, "bip", latex_name=r"\operatorname{Bi}'") ai=AiryAi() bi=AiryBi() aip=AiryAiPrime() bip=AiryBiPrime() ai(x)+bi(x)+aip(x)+bip(x) And now stuff like f=A1*ai(k*x)+B1*bi(k*x) f diff(f,x).subs(x=x0) works exactly the way I wanted. Thank you! Oscar On 6 feb, 14:32, kcrisman wrote: > > I can live with that, but I also need to be able to visualize in > > typesetted form some complicated expressions involving the derivatives > > of Airy functions, so I would very much prefer if diff(ai) would be > > typesetted the same way as > > > aip=function('aip',x,latex_name='Ai\'') > > Airy functions are in > Maximahttp://maxima.sourceforge.net/docs/manual/en/maxima_15.html#Item_003a... > and > mpmathhttp://docs.sympy.org/0.7.0/modules/mpmath/functions/bessel.html#airyai > so we should be able to make them symbolic and evaluate them and get > derivatives and related integrals nicely. > > Seehttp://hg.sagemath.org/sage-main/file/tip/sage/functions/trig.py#l305 > for a class definition you could mimic. I don't think there is any > other way to get custom derivatives, not on the fly, and not with > 'function'. > > Though if there is, that would be very useful! It would be nice to > have something like this work. > > sage: F = function('ai',x) > sage: F > ai(x) > sage: G = function('aip',x) > sage: G > aip(x) > sage: F._derivative = G > --- > AttributeError: 'sage.symbolic.expression.Expression' object attribute > '_derivative' is read-only > sage: F.__setattr__('_derivative',G) > --- > AttributeError: 'sage.symbolic.expression.Expression' object attribute > '_derivative' is read-only > > - kcrisman -- 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: Evaluate quickly a complex expression
On 2/6/12 1:33 PM, Oscar Lazo wrote: That is very nice! Unfortunately I need to evaluate many different expressions quickly, so the copy-paste aproach is not an option. That's why I wrote the fast_complex function. I'll be working in such a general implementation, do you think it's worth getting it into sage, or should fast_float be modified to accept complex expressions? fast_callable is the answer to getting fast_float to accept complex expressions. Seeing how fortran just stomps on fast_callable and even copy-paste of Cython (i.e., it's *way* faster), I think it would be really cool to get a fast_callable backend that uses fortran. A step towards that would be your fortran-generating fast_complex. It could be called as fast_callable(expr, domain=CDF, compiler="fortran") or something. Thanks, Jason -- 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: Programming animation
On Feb 6, 2:58 pm, Socius wrote: > On 6 Feb, 18:57, LFS wrote: > > > I have to admit that I use GeoGebra for almost everything not 3d. It > > is absolutely fantastic (I do videos on the youtube.com/ > > geogebrachannel and have a wiki and a moodle on ggb.) > > > But sage is great (and I have started a youtube.com/sagemath channel > > and a sage wiki, but they are in their infancy.) > > (a) for 3d and > > (b) for creating "solvers" because of its linearity which helps kids > > focus on the steps. > > (c) I really like the "organization" in sage with the text fields and > > sage fields. > > > (I also use scratch to teach my kids to test their probability > > results). > > Hi Linda. > Congrats for your activities with Geogebra and now Sage. Do you > publish videos on the official Youtube geogebra channel? I often visit > the channel, and I am surely interested also in new videos about Sage. So you did http://www.youtube.com/sagemath ? Very interesting! Jason Grout has already been singing your 3D worksheets' praises. We do post a lot of videos from Sage Days at YouTube (see http://www.youtube.co/user/wstein389, William's posted videos), but I didn't realize someone (LFS) had started a channel. That could be useful. cc:ing sage-devel - there should be some coordination here among people who upload videos. > Actually my secret (not so) dream is a program with all the modules of > Sage, the simplicity and interactivity (also for animations) of > Geogebra, and a free structure notebook-style as Mathcad. I hope that > both GG and Sage (maybe together one day?) will develop towards that > goal. Could be hard! But at least you can use Geogebra from within Sage to some extent because of the web start for GG. http://flask.sagenb.org/home/pub/87/ A longer-term ticket, with a lot of work on it done already: http://trac.sagemath.org/sage_trac/ticket/7489 - kcrisman -- 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: Changing the latex representation of the output of derivative.
> I can live with that, but I also need to be able to visualize in > typesetted form some complicated expressions involving the derivatives > of Airy functions, so I would very much prefer if diff(ai) would be > typesetted the same way as > > aip=function('aip',x,latex_name='Ai\'') Airy functions are in Maxima http://maxima.sourceforge.net/docs/manual/en/maxima_15.html#Item_003a-airy_005fai and mpmath http://docs.sympy.org/0.7.0/modules/mpmath/functions/bessel.html#airyai so we should be able to make them symbolic and evaluate them and get derivatives and related integrals nicely. See http://hg.sagemath.org/sage-main/file/tip/sage/functions/trig.py#l305 for a class definition you could mimic. I don't think there is any other way to get custom derivatives, not on the fly, and not with 'function'. Though if there is, that would be very useful! It would be nice to have something like this work. sage: F = function('ai',x) sage: F ai(x) sage: G = function('aip',x) sage: G aip(x) sage: F._derivative = G --- AttributeError: 'sage.symbolic.expression.Expression' object attribute '_derivative' is read-only sage: F.__setattr__('_derivative',G) --- AttributeError: 'sage.symbolic.expression.Expression' object attribute '_derivative' is read-only - kcrisman -- 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: Programming animation
On 6 Feb, 18:57, LFS wrote: > I have to admit that I use GeoGebra for almost everything not 3d. It > is absolutely fantastic (I do videos on the youtube.com/ > geogebrachannel and have a wiki and a moodle on ggb.) > > But sage is great (and I have started a youtube.com/sagemath channel > and a sage wiki, but they are in their infancy.) > (a) for 3d and > (b) for creating "solvers" because of its linearity which helps kids > focus on the steps. > (c) I really like the "organization" in sage with the text fields and > sage fields. > > (I also use scratch to teach my kids to test their probability > results). Hi Linda. Congrats for your activities with Geogebra and now Sage. Do you publish videos on the official Youtube geogebra channel? I often visit the channel, and I am surely interested also in new videos about Sage. Actually my secret (not so) dream is a program with all the modules of Sage, the simplicity and interactivity (also for animations) of Geogebra, and a free structure notebook-style as Mathcad. I hope that both GG and Sage (maybe together one day?) will develop towards that goal. Ciao A. -- 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] Changing the latex representation of the output of derivative.
Hello I'm working with Airy functions. Although sage can evaluate airy_ai(1.0), it cannot form a symbolic expression like: A*airy_ai(x)+B*airy_bi, which is what i need. So I decided to define the symbolic functions: ai=function('ai',x,latex_name='Ai') bi=function('bi',x,latex_name='Bi') this way f=A*airy_ai(x)+B*airy_bi f looks nice, but I also need to use their derivatives, un fortunately, the diff function returns a rather ugly output: A1*D[0](ai)(x) + B1*D[0](bi)(x) I can live with that, but I also need to be able to visualize in typesetted form some complicated expressions involving the derivatives of Airy functions, so I would very much prefer if diff(ai) would be typesetted the same way as aip=function('aip',x,latex_name='Ai\'') Can this be done? Thank you! Oscar -- 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: Programming animation
On Feb 5, 8:20 am, LFS wrote: > Hiya! > > Is there a relatively simple way to get a point to animate a point > through a cycle keeping in mind my low programming skills ((like > adding a "wait" between iterations?) ? You are probably aware of the "animate" command that does this for 2d graphics. It really does stop-motion animation, but it automates the whole process, so it is easy to use. With a bit of surgery you can adapt the procedure to animate 3d as well. The bit below should work in your example worksheet. For a non-interactive movie, this will basically be the way to go. For more interactive things (move the point by moving a slider), you'd probably want to look at "interact". % def scene(f): return C+point3d(s(t=f*(t2-t1)),size=15,color='purple') os.mkdir("my_anim") N=10 for f in [0..N]: scene(f/N).save("my_anim/frame%s.png"%sage.misc.misc.pad_zeros(f, 8)) delay=1 iterations=10 cmd = ''' cd "my_anim"; sage-native-execute convert -delay %s -loop %s *.png "movie.gif" '''%(int(delay), int(iterations)) from subprocess import check_call, CalledProcessError check_call(cmd, shell=True) os.system("mv my_anim/movie.gif movie.gif; rm my_anim/*; rmdir my_anim") % the animated gif movie.gif should now be in the current directory %(of the notebook cell, if you're using the notebook) %% -- 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: Evaluate quickly a complex expression
That is very nice! Unfortunately I need to evaluate many different expressions quickly, so the copy-paste aproach is not an option. That's why I wrote the fast_complex function. I'll be working in such a general implementation, do you think it's worth getting it into sage, or should fast_float be modified to accept complex expressions? Thanks! Oscar On 3 feb, 08:04, Jason Grout wrote: > On 2/3/12 8:02 AM, Jason Grout wrote: > > > The end result was that the straight Cython version was about 13.6 us, > > the expanded version (where e**(k*I) were precomputed) was about 9 us. > > The straight fortran version was 10.2 us, and the expanded fortran > > version (with the powers of e precomputed) was an amazing 3.26 us! > > Seehttp://sagenb.org/home/pub/4204/for details > > Thanks, > > Jason -- 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: Programming animation
Thanks A. That is good to hear about the sage slider! I have to admit that I use GeoGebra for almost everything not 3d. It is absolutely fantastic (I do videos on the youtube.com/ geogebrachannel and have a wiki and a moodle on ggb.) But sage is great (and I have started a youtube.com/sagemath channel and a sage wiki, but they are in their infancy.) (a) for 3d and (b) for creating "solvers" because of its linearity which helps kids focus on the steps. (c) I really like the "organization" in sage with the text fields and sage fields. (I also use scratch to teach my kids to test their probability results). On Feb 6, 5:31 pm, Socius wrote: > On 5 Feb, 17:20, LFS wrote: > > > Hiya! > > > Is there a relatively simple way to get a point to animate a point > > through a cycle keeping in mind my low programming skills ((like > > adding a "wait" between iterations?) ? > > > I made this video with stop animation and an animated gif but it was a > > real pain.http://www.youtube.com/watch?v=2ddeHKk9ssg > > > Now I really want to show how the parameter moves through 3d curves > > (and then surfaces) > > e.g. I would like to animate a point through the first curve > > on:http://sagenb.org/home/pub/4212/ > > Hi Linda. > Recently Jason wrote that they are developing a new framework for the > Slider control in the new versions of Sage. I don't know if that will > allow to directly animate the slider. I hope so, because probably that > would solve your problem. I recently started to experiment a little > with Geogebra, and apart the fact that it is obviously more limited > and less ambitious than Sage, there is a very nice and simple > animation feature for each parameter associated with a slider, really > useful for quickly creating animated graphs. > > A. -- 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: reference pages
On Mon, Feb 6, 2012 at 9:41 AM, Kenneth A. Ribet wrote: > Hi All, > > This message is about the Sage Reference pages. I'm looking specifically at > http://www.sagemath.org/doc/reference/sage/rings/finite_rings/constructor.html > . My comment, which is more of a recommendation, is that it would probably > be helpful to have a date at the bottom that shows the date of last > modification. Looking at the material on the Finite Fields page, I can't > really tell how old it is. (Am I missing something?) > > The reason that I was led to this page is because of a discussion in my > crypto class last week. I mentioned to my class that one knows "by general > theory" that two finite fields of the same cardinality are isomorphic. On > the screen at the front of the room, I had two fields F and K of cardinality > 7^3; they were made with different "moduli" (irreducible polynomials). A > student asked whether sage could exhibit an isomorphism between the two > fields. Unfortunately, I didn't know the answer right away. When I read the > bottom of the page, I was pessimistic that sage could do what the student > asked: > >> While Sage supports basic arithmetic in finite fields some more advanced >> features for computing with finite fields are still not implemented. For >> instance, Sage does not calculate embeddings of finite fields yet. > The above means that the function "embeddings" just isn't implemented yet: sage: K. = GF(7^3) sage: L. = GF(7^3, modulus=(a^2).minimal_polynomial()) sage: L.embeddings(K) AttributeError However, one might expect embeddings to be implemented, because it is implemented for number fields: sage: x=var('x'); K. = NumberField(x^2+2) sage: L. = NumberField(x^2+8) sage: K.embeddings(L) [ Ring morphism: From: Number Field in a with defining polynomial x^2 + 2 To: Number Field in b with defining polynomial x^2 + 8 Defn: a |--> 1/2*b, Ring morphism: From: Number Field in a with defining polynomial x^2 + 2 To: Number Field in b with defining polynomial x^2 + 8 Defn: a |--> -1/2*b ] sage: > It then occurred to me that I could get maps from F to K by factoring over K > the > irreducible polynomial corresponding to a generator of F. This works > beautifully, > and one gets the required embeddings (which are isomorphisms in this case). Yes, that's how the function works over number fields under the hood. It sounds like you should contribute a patch to add this functionality to Sage (or get one of your students to). :-). > > Ken -- William Stein Professor of Mathematics University of Washington http://wstein.org -- 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: Programming animation
On 5 Feb, 17:20, LFS wrote: > Hiya! > > Is there a relatively simple way to get a point to animate a point > through a cycle keeping in mind my low programming skills ((like > adding a "wait" between iterations?) ? > > I made this video with stop animation and an animated gif but it was a > real pain.http://www.youtube.com/watch?v=2ddeHKk9ssg > > Now I really want to show how the parameter moves through 3d curves > (and then surfaces) > e.g. I would like to animate a point through the first curve > on:http://sagenb.org/home/pub/4212/ Hi Linda. Recently Jason wrote that they are developing a new framework for the Slider control in the new versions of Sage. I don't know if that will allow to directly animate the slider. I hope so, because probably that would solve your problem. I recently started to experiment a little with Geogebra, and apart the fact that it is obviously more limited and less ambitious than Sage, there is a very nice and simple animation feature for each parameter associated with a slider, really useful for quickly creating animated graphs. A. -- 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