Ask Your Question

nooniensoong97's profile - activity

2020-12-16 03:46:18 +0200 commented question Questions about zip(*[iter(s)]*n)

thanks. all of the posts I saw online about this was ten years back.

2020-12-15 00:02:33 +0200 received badge  Editor (source)
2020-12-15 00:01:49 +0200 asked a question Questions about zip(*[iter(s)]*n)


I have been researching on ways to partition a set into equal quantity sub-sets. I came across this code zip(*[iter(s)]*n) however, the code does process, but it outputs a < zip object at 'HEX code location' > and not the actual set of subsets. I tried using show, and print, but that didn't work. Is there something I am missing?

2020-11-08 07:12:02 +0200 asked a question Combining and sorting multiple enumerated lists


I have a bunch of lists that have been enumerated. I would like to combine them into a single list in the number order of the lists. For example: I have these lists a = [2,8,10], b = [0,3,5], c = [1,4,7], d = [6,9,11] I would like to combine them into one list like this [b,c,a,b,c,b,d,c,a,d,a,d]. However, due to my actual work all enumerated lists are of different lengths. Even a few of them are null sets at this time until I am ready to process a much bigger set.

2020-11-08 06:53:37 +0200 commented answer Plotting in base n?

I am referring the program being able to switch to any base to process any calculations. For example, I might want to do all my calculations in base 8, and be able to also have the plots in base 8.

2020-10-12 15:33:10 +0200 commented answer Plotting in base n?

I was expecting that this program would be designed to have full support for any bases from base 2 to base 36. I guess maybe a possible add on in future updates? Also looks like the ticks, tick_labels, and tick_format only works on plot function. I tried it on list_plot and got an error.

2020-10-12 14:11:33 +0200 received badge  Commentator
2020-10-12 14:11:33 +0200 commented question Plotting in base n?

So the program isn't designed to actually do any processing in other bases, and the only way is to format the plot to represent the said data as the intended base.

2020-10-11 00:16:07 +0200 commented question Plotting in base n?

Say I would like to use list_plot for a list of prime numbers in a base other then base10.

2020-10-10 15:20:18 +0200 asked a question Plotting in base n?

In sagemath is there a way to represent plots in bases other then base10? If at all possible being able to plot from base2 to base36.

2020-05-08 16:33:44 +0200 commented question Issues with numpy.linspace()

Anyways thanks for the link to the other example. I had to change a few things around. I still needed to have access each individual data for other data analysis. So I used the .tolist() function on the generated arrays.

2020-05-08 14:50:19 +0200 commented question Issues with numpy.linspace()

How could there be a lot of syntax errors? I was following a couple of youtube videos on ODE?

2020-05-08 05:45:23 +0200 asked a question Issues with numpy.linspace()

The following code:

# Restricted Three Body Problem
# Plotting x,y,dx,dy

# Import
import numpy as np
from scipy.integrate import odeint
import matplotlib.pyplot as plt

# Variables
a,x,y,u,v,xdot,ydot,udot,vdot = var('a,x,y,u,v,xdot,ydot,udot,vdot')

# Sun-Jupiter Ratio
Em = 317.83
Ms = 5.9736*10^24
Sm = Em/Ms
b = Sm/(1+Sm)

# Restricted Three Body Problem
def r3bp(a,x,y,t):
  a = b
  x = x[0]
  y = y[0]
  u = u[0]
  v = v[0]
  xdot = u
  ydot = v
  udot = -(1-a)*((x-a)/(sqrt((x-a)^2 + y^2))^3)-a*((x+1-a)/(sqrt((x+1-a)^2 + y^2))^3)+x+2*v
  vdot = -(1-a)*(y/(sqrt((x-a)^2 + y^2))^3)-a*(y/(sqrt((x+1-a)^2 + y^2))^3)+y-2*u

# Initial conditions
x0 = -0.509
y0 = 0.883
u0 = 0.0259
v0 = 0.0149
t = np.linspace(0,100,num=1000)
x,y,u,v = odeint(r3bp,x0,y0,u0,v0,t)

# Data
x = x[:,0]
y = y[:,0]
u = u[:,0]
v = v[:,0]

# Plot functions
px = plt.plot(t,x)
py = plt.plot(t,y)
pu = plt.plot(t,u)
pv = plt.plot(t,v)

produces the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-37-2a6a37bd25e9> in <module>()
     34 u0 = RealNumber('0.0259')
     35 v0 = RealNumber('0.0149')
---> 36 t = np.linspace(Integer(0),Integer(100),num=Integer(1000))
     37 x,y,u,v = odeint(r3bp,x0,y0,u0,v0,t)

/opt/sagemath-9.0/local/lib/python3.7/site-packages/numpy/core/ in linspace(start, stop, num, endpoint, retstep, dtype, axis)
    136     stop  = asanyarray(stop)  * 1.0
--> 138     dt = result_type(start, stop, float(num))
    139     if dtype is None:
    140         dtype = dt

TypeError: data type not understood
2020-04-18 18:49:29 +0200 commented answer Txt to CSV conversion

Thanks for the input. I thought that the number was going to be too big for memory.

2020-04-17 03:32:01 +0200 commented answer Txt to CSV conversion

I would eventually like to create a csv database with a bunch of mathematical constants that are all the way out to the millionth digit.

2020-04-17 00:51:34 +0200 answered a question Txt to CSV conversion

First of all I can't call up the full txt. It is Pi to the millionth digit. So I have to call the individual digit, and place each individual digit in it's own cell.

2020-04-16 07:53:26 +0200 received badge  Student (source)
2020-04-16 02:21:48 +0200 asked a question Txt to CSV conversion

I would like to convert mathematical constants in txt format to csv format where each digit is its own entry in the csv file.

Here is my code so far, which does not do what I want.

import csv

with open('constants/PiDec.txt','r') as rf:

    with open('constants/PiDec.csv','a') as wf:

        csv_writer = csv.writer(wf)

        s_t_r = 1
        i = 1

        f_contents =

        while len(f_contents) > 0:

            f_contents =
            i = i+1
            f_contents =
2020-04-10 02:36:45 +0200 commented answer pandas in sage notebook in virtual box?

I tried installing pandas, but I get a RuntimeError: Cannot cythonize without Cython installed. How does one install Cython in sage?

2020-03-26 23:01:17 +0200 commented answer From number field to interval field

I have been getting bugs from time to time as well. There are times when Sagemath can't even call out digits of pi for me. I have to close out the program, and browser that does fix the issues most of the time, but not all the time.

2020-03-26 22:46:55 +0200 commented answer Scaling images

Thanks for the advise. However, when I tried using figsize that also includes the white border around the image. I am not wanting to include that border. Plus I had to use figsize = [9,7] to get close to 800 x 600, and with using a dpi value of 96. This gave me an image of 795 x 595 after cropping out the white border. I might have to live with this setup since both values are really close to the target values.

2020-03-25 22:59:18 +0200 asked a question Scaling images


I am trying to figure out how to create say an 800 x 600 image that will be able to fit different size sheets of paper. Eventually I would like to expand this algorithm to include all the other screen resolutions. However, when Sage generates an image there is the boarder of white. So I have to go in and crop it out with image editing software. This then changes the pixel dimension. I would like to get a ratio of 1:1 between the m x n image and the image generated. I have figured out this ratio when dpi value is at 100, and it turns out that a dpi value of about 172 will get me really close to creating an image of 800 x 600. However, the actual image is roughly 795 x 596, and if I use 173 it turns out to be 801 x 600.

I am wondering if someone has already created an algorithm to print a 1:1 scale for screen resolution to printed image?