Re: [sage-support] Re: strange plot

2024-09-28 Thread Fernando Gouvea
Thanks for the answers! Both plot3d(floor(min_symbolic(x, y)),(x,1,7),(y,1,7)) and plot3d(lambda a, b: floor(min(a, b)),(x,1,7),(y,1,7)) produce the right plot. I wonder whether the result of ?min might mention the existence of min_symbolic, and similarly for max. When the first attempt fail

[sage-support] strange plot

2024-09-25 Thread Fernando Gouvea
Recently I was trying to get SageMath to plot something: plot3d(floor(min(x,y)),(x,1,7),(y,1,7)) The result looks like this: I checked, and it does seem that both floor(min(7,1)) and floor(min(1,7)) are equal to 1, as they should be. But that's not what the plot shows. Any explanations of wha

[sage-support] Issues with real precision

2024-02-23 Thread Fernando Gouvea
In an introductory probability class, one computes the probability of getting all of n possible coupons in r individual purchases. The naive approach with inclusion-exclusion leads to the awful formula f(n,r) = \sum_{k=0}^n \binom{n,k} \frac{(n-k)^r}{n^r} Computing this in GP is straightforwar

Re: [sage-support] Re: limitations of "solve"?

2023-12-03 Thread Fernando Gouvea
Is there a way to change the default when calling "solve"? Fernando On 12/3/2023 8:37 AM, Dima Pasechnik wrote: Yes, Sage modifies the defaults of Maxima, in particular we set domain to complex. On 3 December 2023 12:28:45 GMT, Oscar Benjamin wrote: On Wed, 29 Nov 2023 at 12:40, Eric Gourg

[sage-support] A very short introduction to Sage

2023-04-17 Thread Fernando Gouvea
I'm in the final stages of writing a book on infinite series for calculus students. (I claim my way to do it is better than what you find in standard textbooks.) I use Sage throughout, but only very simple stuff. Most of my students use SageMath Cell and find that more than adequate for what th

Re: [sage-support] what am I missing?

2023-04-13 Thread Fernando Gouvea
f the most severe bugs in sage ever, since it is so likely to be randomly misleading... On Thu, Apr 13, 2023 at 1:15 PM Fernando Gouvea wrote: I must be missing something here... sage: g(x)=x^10/(1-x)^11 sage: plot(g(x),(0,0.9)) sage: g(0.7) 15945.8104850773 What&#x

[sage-support] what am I missing?

2023-04-13 Thread Fernando Gouvea
I must be missing something here... sage: g(x)=x^10/(1-x)^11 sage: plot(g(x),(0,0.9)) sage: g(0.7) 15945.8104850773 What's wrong? Fernando -- = Fernando Q. Gouveahttp://www.colby.edu/~fqgouvea Carter Professor of Mathematics Dept. of

[sage-support] when was real_nth_root added?

2022-06-10 Thread Fernando Gouvea
My college provides a Jupyter interface to Sage that runs version 9.0. I just tried using the real_nth_root function and got a "no such function" error. Was the function added after 9.0? Or is this an installation problem? Thanks, Fernando -- ==

Re: [sage-support] Re: SageMath on Microsoft Windows

2022-02-27 Thread Fernando Gouvea
Ubuntu includes python3, but not python without a number. I guess I could make a symlink? Fernando On Sun, Feb 27, 2022 at 5:57 PM Dima Pasechnik wrote: > On Sun, Feb 27, 2022 at 9:59 PM Fernando Gouvea > wrote: > > > > I was trying to install SageMath using WSL, mostly

Re: [sage-support] Re: SageMath on Microsoft Windows

2022-02-27 Thread Fernando Gouvea
I was trying to install SageMath using WSL, mostly to learn how it is done. Alas, the latest available Ubuntu distribution for WSL seems to be 20.04, which comes with SageMath 9.0. I have 9.2 running on Windows, so no advantage to that. I did find Ubuntu 20.04 binaries for SageMath 9.4 in htt

Re: [sage-support] Re: SageMath on Microsoft Windows

2022-02-27 Thread Fernando Gouvea
I don’t see archlinux in the Microsoft store. Fernando On Sun, Feb 27, 2022 at 10:05 AM Dima Pasechnik wrote: > > > On Sun, 27 Feb 2022, 14:37 G. M.-S., wrote: > >> >> Thanks, Samuel. >> >> I think it is a pity there is nothing more straightforward… >> >> But you will tell me (to look for some

Re: [sage-support] Re: Inter-versions reproducibility problem of random elements.

2022-02-06 Thread Fernando Gouvea
9.2 on Windows: sage: print(sage.version.version) : with seed(0): M = matrix(AA, 3, 3, lambda u,v: AA.random_element()) : M.apply_map(lambda u:u.radical_expression()) 9.2 [-2  2 -2] [-2  0  2] [-1  2  2] sagecell.sagemath.org: 9.4 [-2 2 -2] [-2 0 2] [-1 2 2] I'll try 9.3 on Windo

Re: Fwd: [sage-support] Sage 9.3 for Windows crashing

2021-11-26 Thread Fernando Gouvea
- https://trac.sagemath.org/ticket/32424 (waiting for review) - https://trac.sagemath.org/ticket/32488 (which will be in 9.5.beta2) On Thursday, September 23, 2021 at 2:49:40 AM UTC-7 Dima Pasechnik wrote: On Wed, Sep 22, 2021 at 10:12 PM Fernando Gouvea

Re: Fwd: [sage-support] Sage 9.3 for Windows crashing

2021-09-22 Thread Fernando Gouvea
Update: the problem is machine-dependent. On one Dell laptop, plot works with no problem. On a different one, big crash. Fernando On 9/22/2021 3:49 PM, William Stein wrote: -- Forwarded message - From: Fernando Q. Gouvea Date: Wed, Sep 22, 2021 at 12:26 PM Subject: Re: [sage-s

[sage-support] documentation for simplify?

2021-02-05 Thread Fernando Gouvea
I just realized that when faced with log(a)-log(b) Sage does not normally simplify that log(a/b), or vice-versa. I tried using f.simplify_full() and friends with no effect. Then I tried to enter ?simplify_full and got Object `simplify_full` not found. I notice that there is a simplify_log

Re: [sage-support] Re: integrating sin(t)/t

2020-09-29 Thread Fernando Gouvea
Good news! When is 9.2 expected to be ready? Fernando On 9/29/2020 3:54 AM, Eric Gourgoulhon wrote: I confirm the issue with the Taylor series with Sage 9.1. Fortunately, the bug seems to have been fixed for Sage 9.2. As Emmanuel, I get the correct Taylor series with Sage 9.2.beta13. Le mard

Re: [sage-support] Re: integrating sin(t)/t

2020-09-29 Thread Fernando Gouvea
I'm running Sage 9.0 on a Windows 10 machine. I get the same incorrect series from the built-in sin_integral function, so the problem is not the integration. sage: taylor(sin_integral(x),x,0,10) 73/466560*x^9 - 127/35280*x^7 + 31/600*x^5 - 7/18*x^3 + x Fernando On 9/29/2020 3:36 AM, Emmanuel

Re: [sage-support] Re: solve and numerical answers

2020-09-15 Thread Fernando Gouvea
Thanks! I've already learned more. What I first did was this: sage: PP -0.625*t^4 + 23.55000*t^3 - 264.0510*t^2 + 1026.900*t - 853.8000 sage: L=solve(PP==0,t) sage: L[1] t == -1/1250*sqrt((390625*(4/1953125*I*sqrt(37468876945450884598)*sqrt(5) - 39

[sage-support] solve and numerical answers

2020-09-14 Thread Fernando Gouvea
I still don't know my way around the Sage documentation... Sorry for the elementary question. I just tried to use the *solve* command to find the roots of a polynomial of degree 4 with real coefficients. The result is a list of solutions expressed in (complicated) symbolic form. When I attempt

[sage-support] another naive question

2020-04-06 Thread Fernando Gouvea
I'm working with ideals in the polynomial ring in three variables. sage> R.=QQ[] sage> f=u*v-w sage> g=u^2-v sage> I=Ideal(f,g) sage> I.is_prime()     True sage> I.associated_primes()     [Ideal (v^2 - u*w, u*v - w, u^2 - v) of Multivariate Polynomial Ring in u, v, w over Rational Field] That

[sage-support] naive question

2020-03-06 Thread Fernando Gouvea
OK, so I'm doing a computation and my result is something I called thirdroot. I'm trying to test whether it's equal to a particular expression. Can someone explain what is wrong here? (s*t+1)^2/(s+t)^2 (s*t + 1)^2/(s + t)^2 factor(thirdroot+1) (s*t + 1)^2/(s + t)^2 thirdroot+1-(s*t+1)^2/(s+

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Fernando Gouvea
),(u,-1,1),(v,-1,1)) On Thu, Mar 5, 2020 at 4:51 PM Dima Pasechnik wrote: On Thu, Mar 5, 2020 at 2:32 PM Fernando Gouvea wrote: This works, in the sense that there's no error. One does get a bunch of extraneous points near the boundary of the disk. It's as if plot_points were trying

Re: [sage-support] Re: Plotting algebraic curves

2020-03-05 Thread Fernando Gouvea
      return y^2-x^3+x : implicit_plot(f_uv,(u,-1,1),(v,-1,1)) > > On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea mailto:fqgou...@colby.edu>> wrote: > > Here's what I ended up trying, with r=3: > > var('x y u v') > x=u*sqrt(9/(1-u^2-v^2))

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
;x y u v r phi') : u=r*cos(phi) : v=r*sin(phi) : x=u*sqrt(9/(1-r^2)) : y=v*sqrt(9/(1-r^2)) : implicit_plot(y^2-x^3+x==0,(r,0,999/1000),(phi,-pi,pi)) On Tue, Mar 3, 2020 at 10:28 PM Dima Pasechnik wrote: On Tue, Mar 3, 2020 at 10:10 PM Fernando Gouvea wrote: The whole p

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
^3+x==0,(r,0,999/1000),(phi,-pi,pi)) > > On Tue, Mar 3, 2020 at 10:28 PM Dima Pasechnik wrote: > > > > On Tue, Mar 3, 2020 at 10:10 PM Fernando Gouvea > wrote: > > > > > > The whole point of this is to show the behavior of the curve near > infinity, so c

Re: [sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
The whole point of this is to show the behavior of the curve near infinity, so changing the limits is not an option. Fernando On 3/3/2020 4:15 PM, Dima Pasechnik wrote: On Tue, Mar 3, 2020 at 8:20 PM Fernando Gouvea wrote: Here's what I ended up trying, with r=3: var('x y u v&#x

[sage-support] Re: Plotting algebraic curves

2020-03-03 Thread Fernando Gouvea
, self._py_constants ValueError: negative number to a fractional power not real Is there some way to tell implicit_plot to stay inside u^2+v^2\leq 1? Or to ignore complex values? The equivalent code seems to give the correct graph in Mathematica. Fernando On 2/29/2020 5:29 PM, Fernando Gouvea

Re: [sage-support] Plotting algebraic curves

2020-03-01 Thread Fernando Gouvea
Parametric plots won't work for general algebraic curves. But I'm also not sure how to implement the transformation into a circle. I'll look at the documentation for plots. Fernando On 3/1/2020 8:50 AM, David Joyner wrote: On Sat, Feb 29, 2020 at 5:29 PM Fernando Gouve

[sage-support] Plotting algebraic curves

2020-03-01 Thread Fernando Gouvea
(Repost, as the first message seems to have ended up in the wrong thread.) Some years ago in a book review, David Roberts had the idea of plotting an algebraic curve using the transformation  (u,v) = (x,y)/(r^2  + x^2  + y^2 )^1/2 , which transforms the plane into a circle and makes it easy to

[sage-support] Plotting algebraic curves

2020-02-29 Thread Fernando Gouvea
Some years ago in a book review, David Roberts had the idea of plotting an algebraic curve using the transformation (u,v) = (x,y)/(r2 + x2 + y2)1/2, which transforms the plane into a circle and makes it easy to visualize the projective completion of the curve. You can see some of his plots at http

[sage-support] Newbie question on Mac

2020-02-03 Thread Fernando Gouvea
I typically use Windows, but today I was trying to install Sage on the Mac in one of my classrooms. It turns out to be running OSX 10.13.6, and the only binaries I could find were version 8.7. I managed to download and install those. It runs in a terminal window. The instructions say to type notebo

[sage-support] power series and strings for p-adics

2019-08-08 Thread Fernando Gouvea
If I create the p-adics in the default way, p-adic numbers are power series: K=Qp(7) a=K(1/42) print a 6*7^-1 + 5 + 5*7 + 5*7^2 + 5*7^3 + 5*7^4 + 5*7^5 + 5*7^6 + 5*7^7 + 5*7^8 + 5*7^9 + 5*7^10 + 5*7^11 + 5*7^12 + 5*7^13 + 5*7^14 + 5*7^15 + 5*7^16 + 5*7^17 + 5*7^18 + O(7^19) On the other hand

Re: [sage-support] Re: Sage equivalent for GP's "padicappr"?

2019-08-02 Thread Fernando Gouvea
Thanks to both Vincent and Nils! Sage seems to include lots of ways to do things... Let me see if I understand. Vincent suggested R = PolynomialRing(Qp(7), 'x') x = R.gen() p = x^2 - 2 pari.padicappr(p, 4 + O(7^10)) Which works, but relies on using the built-in pari support; on the cell serv

[sage-support] Sage equivalent for GP's "padicappr"?

2019-08-01 Thread Fernando Gouvea
Hi, everyone. I'm an old user of GP and a very raw beginner when it comes to Sage, so please forgive the naiveté! For a new edition of my book on the p-adics I am trying to add pointers to how to do things on a computer with p-adic numbers. Everything in the book is very elementary, so I'