Ask Your Question

Daniel Krenn's profile - activity

2020-04-27 23:39:46 +0200 received badge  Popular Question (source)
2020-03-20 17:41:55 +0200 received badge  Famous Question (source)
2019-05-15 17:46:09 +0200 received badge  Good Question (source)
2019-03-21 21:59:59 +0200 received badge  Popular Question (source)
2019-03-21 21:59:59 +0200 received badge  Notable Question (source)
2017-07-28 00:44:30 +0200 received badge  Notable Question (source)
2017-02-15 16:22:18 +0200 received badge  Good Answer (source)
2016-12-18 05:00:24 +0200 received badge  Nice Answer (source)
2016-12-16 21:38:26 +0200 received badge  Necromancer (source)
2016-12-13 09:09:40 +0200 answered a question sage terminal colors

FYI, %colors offers NoColor, Linux and LightBG.

2016-09-19 22:47:56 +0200 received badge  Notable Question (source)
2016-08-06 16:57:47 +0200 commented answer How well print a list of matrices ?

Seems to not be possible anymore (in SageMath 7.2)

2015-12-22 06:20:46 +0200 received badge  Famous Question (source)
2015-12-22 06:20:46 +0200 received badge  Notable Question (source)
2015-12-22 06:20:46 +0200 received badge  Popular Question (source)
2015-11-15 08:55:29 +0200 received badge  Popular Question (source)
2014-12-08 12:39:58 +0200 received badge  Popular Question (source)
2014-06-29 03:14:42 +0200 marked best answer working directory for load/attach

Question

Is there a command to change the current working directory inside sage, so that the load (or attach) command uses that directory as base?

Background

I have the following file-directory-situtation:

  • directory project-base
    • file blub.sage (contains some useful functions)
    • file run.sage (contains a load blub.sage command)

To start the project i call sage run.sage in the directory project-base. Everything works fine.

If I now want to run the project from any other directory with sage path/project-base/run.sage, I get the error message, that the file tools.sage is not found. The error message is kind of clear, because in run.sage the file is loaded without any directory specifications.

A similar problem occours, when you want to call run.sage from the browser-notebook-interface.

Is there any possibility to solve this problem (except using absolute paths everywhere (which is clearly not a satisfying solution) or changing the directory structure or using soft-links)?

2014-02-09 09:33:53 +0200 asked a question changing authentication method here on ask.sagemath.org fails

Since myopenid [1] is history now, I have to find a different authentication method here on ask.sagemath.org. (I logged in at the end of January, so for a short time I'm able to ask here). The problem is, that "manage login methods" on my profile gives the following error message:

Internal server error
system error log is recorded, error will be fixed as soon as possible
please report the error to the site administrators if you wish

back to previous page
see latest questions
see tags

Can someone do something against it?

PS: I sent a similar message in the middle of January via "give feedback".

[1] [https://www.myopenid.com/]()

2013-11-01 17:18:01 +0200 received badge  Good Answer (source)
2013-06-23 14:42:07 +0200 received badge  Taxonomist
2012-11-28 20:14:06 +0200 received badge  Famous Question (source)
2012-05-09 16:55:42 +0200 received badge  Nice Answer (source)
2012-02-26 16:13:39 +0200 answered a question Easy (beginner) sum problem:"need a summation variable"?
sage: var('k,n'); sum(k^2, k, 1, n+1)
(k, n)
1/3*n^3 + 3/2*n^2 + 13/6*n + 1
2012-01-11 04:23:50 +0200 received badge  Notable Question (source)
2012-01-04 06:01:09 +0200 commented question How to do mul(function, i=1..n); like in Maple?

The Problem is the ``range``, which cannot take an symbolic input. E.g. defining ``r(n) = range(n)`` does not work.

2011-12-21 20:24:48 +0200 marked best answer working directory for load/attach

You can add the following lines to the top of run.sage in order to change the current directory to path/project-base

import os
os.chdir(os.path.dirname(__file__))

How it works is that when you run sage path/project-base/run.sage, it converts run.sage into a Python module run.py. Within that module __file__ is a special global variable which is automatically set to the absolute path of that module.

2011-12-02 16:38:38 +0200 received badge  Enlightened (source)
2011-12-02 16:38:38 +0200 received badge  Guru (source)
2011-11-30 13:50:53 +0200 received badge  Great Answer (source)
2011-11-30 09:36:57 +0200 received badge  Good Answer (source)
2011-11-30 08:15:37 +0200 received badge  Nice Answer (source)
2011-11-30 03:55:00 +0200 answered a question Substitute list of expressions

The nice solution:

sage: model.substitute_expression(*sol)
x |--> -2.0000000000000031*x^3 + 14.500000000000021*x^2 - 31.500000000000046*x + 23.000000000000028
2011-11-30 03:48:00 +0200 received badge  Editor (source)
2011-11-30 03:46:06 +0200 answered a question Substitute list of expressions

The following works (although, there might be a nicer solution):

sage: m = {}
sage: for eq in sol:
....:     m[eq.lhs()]=eq.rhs()
sage: model.subs(m)
x |--> -2.0000000000000031*x^3 + 14.500000000000021*x^2 - 31.500000000000046*x + 23.000000000000028
2011-11-19 15:49:43 +0200 commented question development of a framework for numeral systems

The reason I put it here is the following: Here are maybe more people working in numeration than on sage-devel. Some comments of them would help...

2011-11-19 13:25:07 +0200 commented question development of a framework for numeral systems

See also [sage-devel](http://groups.google.com/group/sage-devel/browse_thread/thread/b72a75c33a61e4da)

2011-11-19 13:22:37 +0200 asked a question development of a framework for numeral systems

I plan do build a framework for numeral systems. Below you find some thoughts written down. A draft of the possible class hierachy can also be found there. If you have any comments on those things or anything that should be also included in that framework, then don't hesidate to post them.

Daniel


Numeral Systems in Sage

draft

Goals

  • representation of elements as digital expansions
  • support of infinite expansions, multi-expansions (one position can have more digits)
  • (fast) arithmetic of expansions (+, -, *, /, **)
  • action of expansion on something (e.g. act on points of elliptic curve and e.g. performed a by a Horner scheme)
  • support of languages on the expansion (e.g. w-NAF (non-adjacent form))
  • different algorithms to calculate expansions (e.g. w-NAF (non- adjacent form))
  • test for optimality of language
  • calculation of sequences in conjunction with dynamical system together with the calculation of the expansions (cf. shift radix systems)
  • support of continued fractions (some algorithms already exist for that and maxima supports continued fractions)
  • support of joint expansions (digits are tuples)
  • numeral systems often have connections to transducer; keep that in mind during the design process

Class Hierachy

Examples (of classes) of numeral systems are written with [].

NumeralSystem
 +-- PositionalNumeralSystem
 |    +-- IntegerTupleIndexNumeralSystem
 |         +-- IntegerIndexNumeralSystem
 |         |    +-- AbstractNumeralSystem
 |         |    |    +-- BaseNumeralSystem
 |         |    |         +-- AlgebraicBaseNumeralSystem
 |         |    |              +-- ImaginaryQuadraticBaseNumeralSystem
 |         |    |              |    +-- [QuaterImaginary]
 |         |    |              |    +--
[ImaginaryQuadraticBaseMNRDigits]
 |         |    |              +-- RealBaseNumeralSystem
 |         |    |                   +-- IntegerBaseNumeralSystem
 |         |    |                   |    +--
PositiveIntegerBaseNumeralSystem
 |         |    |                   |    |    +-- [Binary]
 |         |    |                   |    |    +-- [Decimal]
 |         |    |                   |    |    +-- [BalancedTernary]
 |         |    |                   |    |    +-- [Babylonian]
 |         |    |                   |    +--
NegativeIntegerBaseNumeralSystem
 |         |    |                   +-- [GoldenRatioBase]
 |         |    +-- MixedRadixNumeralSystem
 |         |    |    +-- RecurrenceNumeralSystem
 |         |    |    |    +-- [FibonacciBase]
 |         |    |    +-- [Money]
 |         |    |    +-- [FactorialNumeralSystem]
 |         |    |    +-- [DateTime]
 |         |    +-- [FactorNumeralSystem]
 |         +-- [IntegerDoubleBases]
 +-- [RomanNumeralSystem]
 +-- [UnaryNumeralSystem]

Some Notes on the classes

NumeralSystem:

  • base class for everything (abstract base class)
  • elements have +,-,*,/, but none is implemented (implementation in inherited class)

PositionalNumeralSystem:

  • has function value_at_position(position, value) which gives value of singleton
  • operation to add singletons can be given (e.g. addition)
  • the positions can be everything (every hashable element of Sage)

IntegerTupleIndexNumeralSystem:

  • positions are tuples (of fixed length) of integers

IntegerIndexNumeralSystem:

  • positions are integers, special case of IntegerTupleIndexNumeralSystem

AbstractNumeralSystem:

  • function \phi from base i to base i+1

MixedRadixNumeralSystem

  • bases are fixed numbers b_0, b_1, b_2,...
  • digits and bases are multiplied

BaseNumeralSystem

  • inherited from both AbstractNumeralSystem and MixedRadixNumeralSystem
  • bases are b^i

AlgebraicBaseNumeralSystem

  • base b is a complex number (root of polynomial over ZZ)

ImaginaryQuadraticBaseNumeralSystem, RealBaseNumeralSystem, ...

  • special cases of AlgebraicBaseNumeralSystem

RecurrenceNumeralSystem:

  • recurrence on bases, e.g. b_n=2*b_{n-1}+b_{n-2}
  • e.g. [FibonacciBase] # b_n = b_{n-1} + b_{n-2}

[Money]

  • bases, e.g. for Euro, are 0.01, 0.02, 0.05, 0.10, 0.20, 0.50, 1, 2, 5, 10, 20, 50, 100, 200, 500

[FactorialNumeralSystem]

  • bases 0!,1!,2!,... digits for position n! are 0...(n-1)

[DateTime]

  • bases year, month, day, hour, minute, second
2011-11-09 11:24:51 +0200 commented answer sage notebook server + ssh tunneling + port forwarding

You can also use `nohup` to keep the server running when closing the SSH tunnel.

2011-11-08 06:38:19 +0200 commented question memory increasing when generating lots of hyperelliptic curves (without storing them)

The problem appears on my system with 4.7.1, but now with the upgrade to 4.7.2 it seems that the problem is gone. I will run some more tests...

2011-11-04 14:27:33 +0200 commented answer memory increasing when generating lots of hyperelliptic curves (without storing them)

Thank you for that, I didn't know. (In my original code, the generation of f and h works different than in the minimal example posted, so I won't need it there, but it's good to know)

2011-11-04 10:59:41 +0200 asked a question memory increasing when generating lots of hyperelliptic curves (without storing them)

Executing the code given below (it generates hyperelliptic curves), the used memory increases all the time. Since nothing is stored permanently, this should not happen. How do I avoid it? (It is not really a problem with the example given, but using more loops, it becomes a problem.)

Here an example code:

F = GF(4, 'a')
R.<t> = PolynomialRing(F)

for x in F:
    for y in F:
        for z in F:
            h = x*t^2 + y*t + z

            for a in F:
                for b in F:
                    for c in F:
                        for d in F:
                            for e in F:
                                f = t^5 + a*t^4 + b*t^3 + c*t^2 + d*t + e

                                C = HyperellipticCurve(f,h)
2011-11-04 09:53:27 +0200 received badge  Nice Answer (source)
2011-11-04 09:04:13 +0200 received badge  Teacher (source)