Ask Your Question

LRM's profile - activity

2022-12-23 12:45:19 +0200 received badge  Notable Question (source)
2022-12-23 12:45:19 +0200 received badge  Popular Question (source)
2020-12-26 20:26:03 +0200 received badge  Famous Question (source)
2020-12-26 20:26:03 +0200 received badge  Notable Question (source)
2020-12-26 20:26:03 +0200 received badge  Popular Question (source)
2020-11-18 11:41:31 +0200 received badge  Famous Question (source)
2019-04-18 19:51:49 +0200 received badge  Notable Question (source)
2017-11-30 15:48:19 +0200 received badge  Notable Question (source)
2017-11-10 15:23:01 +0200 received badge  Famous Question (source)
2017-07-18 14:35:47 +0200 received badge  Notable Question (source)
2017-07-18 14:35:47 +0200 received badge  Popular Question (source)
2017-06-25 23:54:15 +0200 received badge  Popular Question (source)
2016-09-16 00:24:08 +0200 asked a question If , else, case?

Hallo!

Is there a function to help me out to test a condition without a 'cascade' of 'else(s)'? Like a "case"? I'm trying hard to find out a solution using the build-in help/manual and could not find a "case" statement. Thank you in advance.

r = randint(1,3)
if r == 1:
        print 'One.'
if r == 2:
        print 'Two.'
if r == 3:
        print 'Three.'
2016-08-20 15:24:19 +0200 asked a question Should I use numpy and cython for complex numbers?

Here is the problem:

if I try this:

var('z')
z = 1+2*I
type(z)
<type 'sage.symbolic.expression.Expression'>

So, it isn't a complex number. BUT, if I do this:

I = CC.0
z = 1+2*I
type(z)

then I get a complex number

<type 'sage.rings.complex_number.ComplexNumber'>

Should I use numpy and cython for complex numbers?

2016-08-11 11:09:34 +0200 received badge  Citizen Patrol
2016-08-08 01:51:30 +0200 commented question Installing on Windows 10

The .ova 7.2 works great on my VirtualBox. I use it at home and at work or when I don't have a machine with Linux installed. Describe what is your problem with it and all the steps you take when you try to run it, so that we will be able to help you.

2016-07-29 00:28:06 +0200 received badge  Scholar (source)
2016-07-28 02:40:31 +0200 received badge  Editor (source)
2016-07-28 02:36:47 +0200 commented answer How to return a list from a recursive function?

This is not what the OP asked. He said: I need to return something like this: [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880] and not the final result.

2016-07-28 01:14:58 +0200 received badge  Popular Question (source)
2016-07-28 01:09:54 +0200 asked a question How to return a list from a recursive function?

Hello,

I am trying to make a recursive function that will return a list but I get a SyntaxError. Here is the code working so far (just an example):

def myfactorial(n):
    if n == 1: 
        return 1
    else: 
        return n * myfactorial(n-1)

myfactorial(10)

I need to return something like this: [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880]

I know that there is already a build in factorial function, I created this recursive function only as an example of what I am trying to get: a list. To return a list of all values of a given recursion, the steps of it...

[myfactorial(n) for n in range(1, 10)]

    [1, 2, 6, 24, 120, 720, 5040, 40320, 362880]

Now, how to put it "inside" in the recursive function?

Thank you for your attention.

2016-05-22 00:30:39 +0200 answered a question terminal for sage/ipython/virtualbox on Windows 10

To get to the command line from Jupyter, go to the upper right dropdown icon/link New option.

Then choose Terminal

To run Sage, just type: cd sage-7.2 and then ./sage

To remap your keyboard layout just follow the SageAppliance tutorial / wiki.

Everything working fine on Windows 10, Sage 7.2.

Hope it helped.

2016-02-05 00:41:42 +0200 asked a question Why patching path? (Installation)

Hi.

I just installed a fresh copy of Linux Mint and then unpacked the sage *.bz2 in my user directory. Then gave the command: ./sage and then the following appears:

patching / home / username / file * etc etc etc and the process takes HOURS!

I remember I have installed previous versions and after a few seconds, was ready to run the notebook () command.

What has changed? I found no information about it. Am I doing something wrong?

Thanks in advance.

2015-06-29 23:12:18 +0200 commented question Problem with matrix_plot ?

Hi @kcrisman , I saw the ticked #18463 and #18612 and tried the matrix_plot with the option aspect_ratio='automatic' and it worked fine in version 4.7

matrix_plot([[mod(i,5)^j for i in range(5)] for j in range(1,6)],aspect_ratio='automatic', cmap='Oranges')

How to know when Sage 6.8 will be released?

2015-06-24 19:18:52 +0200 commented question Problem with matrix_plot ?
2015-06-24 19:16:20 +0200 commented question Problem with matrix_plot ?

*.lrz: lrzuntar *.tar.lrz (you may need to install 'lrzip')

Following the instructions of the official page. As I said, everything is working fine and plotting correctly... With the exception of matrix_plot()

2015-06-24 17:20:57 +0200 asked a question Problem with matrix_plot ?

Hello,

I am using Linux Mint (latest version) with Sage Math 6.7 64bits . All 3D and 2D graphics are working perfectly but matrix_plot. When I use the example (of help):

matrix_plot(matrix([[1,3,5,1],[2,4,5,6],[1,3,5,7]]))

I got only a vertical axis from 2 to -2 . It happens in Firefox and Chrome.

Can someone help me, please? Thank you in advance.

2015-03-25 15:33:04 +0200 received badge  Supporter (source)
2015-03-25 15:33:02 +0200 commented answer How to define / create a new Ring

I will take a look now. Thank you for your attention.

2015-03-24 08:58:46 +0200 asked a question How to define / create a new Ring

Hi!

I just installed the version 6.5 of Sage. Then I saw in the help some page/tutorial about Basic Rings but I could not find an article (I googled) or an answer for the following:

How can I create a new ring? For example: How can I create a kind of ring of Integers (called ZZ in Sage) where I have only , say, even numbers?

Examples:

sage: sqrt(4) in myZZ True

sage: 3 in myZZ False

Thank you for any help!

2015-02-03 15:17:03 +0200 received badge  Self-Learner (source)
2015-02-03 15:17:03 +0200 received badge  Teacher (source)
2015-02-03 09:37:56 +0200 received badge  Student (source)
2015-02-03 04:56:59 +0200 answered a question Series and Sequences (Sage x Mathematica)

I found my own answer based on a related question, here is how I can do the same:

[(n,4*n^2 + 3) for n in range(51)]

Maybe I can find more ways to generate such sequences, maybe using lambda / "pure functions"

2015-02-03 04:50:47 +0200 asked a question Series and Sequences (Sage x Mathematica)

Hello, all.

I am trying to move from Mathematica to Sage Math but I'm facing basic issues. I had read the manual and searched for the answer in many results from google and found no answer to things like this:

In Mathematica, if I want to generate a sequence of integers I do the following (just an example):

Table[4*n^2 + 3, {n, 0, 50}]  **or** Array[4 #^2 + 3 &, 44, 0]

and it will output the following:

{3, 7, 19, 39, 67, 103, 147, 199, 259, 327, 403, 487, 579, 679, 787, 903, 1027, 1159, 1299, 1447, 1603, 1767, 1939, 2119, 2307, 2503, 2707, 2919, 3139, 3367, 3603, 3847, 4099, 4359, 4627, 4903, 5187, 5479, 5779, 6087, 6403, 6727, 7059, 7399}

I saw the command range() but it doesn't accept a formula. Also, there is a mix of commands between Maxima and Python ... I'm really lost.

How can I generate the same list using Sage?

Thank you.