Ask Your Question

banksiaboy's profile - activity

2021-04-26 09:33:44 +0100 received badge  Popular Question (source)
2021-04-26 09:33:44 +0100 received badge  Notable Question (source)
2020-06-19 01:28:34 +0100 commented answer Ubuntu 18.04 apt install - ModuleNotFoundError: No module named 'sage'

Oh and the :: syntax in the environment.yml forces the module to be loaded from ether particular repository. It is a supported, but undocumented feature. I have asked for it to be documented.

2020-06-19 01:25:15 +0100 received badge  Commentator
2020-06-19 01:25:15 +0100 commented answer Can I express an abstract, symbolic range of reals?

Thanks @Sebastien - I think you are right. Though I found numpy arrays seem to do the ellipses nicely. Maybe I really need to write a class for a symbolically parameterised range, which can be realised. Seems weird not to have one. I keep feeling I’ve missed something obvious.

Very hard to work out which way to do things when starting out - unsurprisingly :-)

2020-06-15 06:26:14 +0100 commented answer Can I express an abstract, symbolic range of reals?

The answer from @Sebastien displayed ellipses in its output summary, maybe this feature is broken in sage's jupyter notebook implementation?

2020-06-15 06:24:51 +0100 answered a question Can I express an abstract, symbolic range of reals?

This is not an abstract symbolic expression for a range - which I would still like, but this answer uses numpy to provide its default output summary with ellipses for large arrays. Solves my practical problem of too much output.
ref: https://doc.sagemath.org/html/en/thematic_tutorials/numerical_sage/numpy.html

  import numpy as np

  l = np.array(srange(-3.0, 3.0, 0.002))
    show(l)

   [⎯𝟹.⎯𝟸.𝟿𝟿𝟾⎯𝟸.𝟿𝟿𝟼...𝟸.𝟿𝟿𝟺𝟸.𝟿𝟿𝟼𝟸.𝟿𝟿𝟾]
2020-06-15 00:55:41 +0100 received badge  Supporter (source)
2020-06-15 00:55:01 +0100 commented answer Why doesnt 'Answer your own question" work?

See @rburing answer - I was most likely lacking Karma :-)

2020-06-15 00:54:16 +0100 commented answer Why doesnt 'Answer your own question" work?

Thanks @rburing, There was no error message, just deathly quiet, though if I tried again to enter an answer, the text of my previous attempt was restored. So it's weird that it worked when I logged in using FireFox... Probably I was mistaken. I see my Karma is now 51. So Chrome/Firefox probably wasn't the issue.

2020-06-15 00:35:43 +0100 received badge  Nice Question (source)
2020-06-14 23:50:51 +0100 received badge  Teacher (source)
2020-06-14 23:50:51 +0100 received badge  Self-Learner (source)
2020-06-14 23:42:06 +0100 answered a question Why doesnt 'Answer your own question" work?

Fails if using Google Chrome
Works if using FireFox

Ubuntu 18.04

2020-06-14 23:38:36 +0100 commented question Ubuntu 18.04 apt install - ModuleNotFoundError: No module named 'sage'

That's like 'cycle-the-power'. Which we all use sometimes :-)

2020-06-14 23:36:51 +0100 answered a question Ubuntu 18.04 apt install - ModuleNotFoundError: No module named 'sage'

I have a reliable install method for SageMath on Ubuntu 18.04. referring to: https://doc.sagemath.org/html/en/inst...

in the conda base environment:
% conda install mamba -c conda-forge

using an ./environment.yml in a chosen directory:

name: SageMath
channels:
  - conda-forge
  - anaconda
  - defaults
dependencies:
  - conda-forge::sage
  - conda-forge::mamba
  - anaconda::python>=3.7
  - nodejs
  - pip

run:
mamba env create --file ./environment.yml

2020-06-14 23:35:56 +0100 received badge  Student (source)
2020-06-14 23:26:00 +0100 asked a question Why doesnt 'Answer your own question" work?

I have tried to answer my own question. I am logged in. I tap the Add Answer hyperlink. I enter the text, and press the 'answer your own question' button, and my answer disappears. Extra-double-annoying.

Cheers...

2020-06-14 21:44:14 +0100 commented answer Can I express an abstract, symbolic range of reals?

Thanks, Have already tried that. Same swamped output. Want to be able to have symbolic parameters to the range expression. Or equivalent - with a compact show() output.

srange( a, b, delta)

2020-06-14 21:39:10 +0100 commented answer 'DeprecationWarning' when using list comprehension

OK, Thank-you.

2020-06-13 10:14:21 +0100 commented question 'DeprecationWarning' when using list comprehension

list_plot(list(map(sigmoid,input_range)))

is ok

2020-06-13 10:03:51 +0100 commented question 'DeprecationWarning' when using list comprehension

markup keeps failing :-(

2020-06-13 09:58:33 +0100 asked a question 'DeprecationWarning' when using list comprehension

input_range = srange(-3,3,.02)

[sigmoid(x) for x in input_range]

gives warning:

DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)
    See _blah_ trac.sagemath.org/5930 for details.

Am I really doing something wrong here?

List comprehension syntax is prefered idiom in Python AFAIK

2020-06-13 04:47:42 +0100 commented question Can I express an abstract, symbolic range of reals?

In Jupyter notebook I'm up to here, could be horribly unconventional:

from typing import List, Dict, Callable
# A Function takes in an ndarray as an argument and produces an ndarray
Array_Function = Callable[[ndarray], ndarray]
Chain = List[Array_Function]

identity_function(x) = SR('x')

def compose(chain: Chain)-> Callable:
    if not chain:
        return identity_function
    else:
        return chain[0](compose(chain[1:]))

input_range = np.arange(-3, 3, 0.02)

c0: Chain = [x ** 2, max(0.2 * x,x), 1 / (1 + exp(-x))]
sigmoid,lru,square = c0
show([sigmoid,lru,square])

show(compose(c0))
2020-06-13 04:07:37 +0100 received badge  Editor (source)
2020-06-13 04:03:56 +0100 asked a question Can I express an abstract, symbolic range of reals?

Hello, I'm very new at sage. I'd like to express a range like range(-3.0,3.0,0.02) but with symbols for all the parameters, like range(a,b,delta), that displays nicely with show(). I would like to be able to substitute in floats at some later stage.

a. I'm not sure what a conventional symbolic expression for a range of floats is

b. Not sure how to express it in SageMath.

My goal is to be able to express constructing a chain rule over a finite input range. I seem to be able to express the chaining of functions ok, but am getting stuck with what i'm calling the constant function which is this range. If I use the range(-3.0,3.0,0.02) I get swamped by the output.

P.S. I don't want to use a built-in differentiate, I'm going to use finite differences.

Cheers...

2020-05-26 10:19:36 +0100 asked a question Ubuntu 18.04 apt install - ModuleNotFoundError: No module named 'sage'

I'm on Ubuntu 18.04.4 LTS.

 % sudo aptitude install sage  
[...]
% which sage                    
/usr/bin/sage
 % sage --version 
SageMath version 8.1, Release Date: 2017-12-07

then

% sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.1, Release Date: 2017-12-07                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
  File "/usr/share/sagemath/bin/sage-ipython", line 7, in <module>
    from sage.repl.interpreter import SageTerminalApp
ModuleNotFoundError: No module named 'sage'

Conda provides my Python. I did not install sagemath using Conda - couldn't get it to run. I was assuming the platform package would work.

Is there a simple solution?

Cheers, --PG