# Daniel Krenn's profile - activity

2016-12-13 02:09:40 -0500 answered a question sage terminal colors

FYI, %colors offers NoColor, Linux and LightBG.

2016-08-06 09:57:47 -0500 commented answer How well print a list of matrices ?

Seems to not be possible anymore (in SageMath 7.2)

## 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 02:33:53 -0500 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

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".

2012-02-26 09:13:39 -0500 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-03 23:01:09 -0500 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.

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-11-29 20:55:00 -0500 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-29 20:46:06 -0500 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 08:49:43 -0500 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 06:25:07 -0500 commented question development of a framework for numeral systems

2011-11-19 06:22:37 -0500 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

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
|         |    |              |    +-- [QuaterImaginary]
|         |    |              |    +--
|         |    |              +-- RealBaseNumeralSystem
|         |    |                   +-- IntegerBaseNumeralSystem
|         |    |                   |    +--
PositiveIntegerBaseNumeralSystem
|         |    |                   |    |    +-- [Binary]
|         |    |                   |    |    +-- [Decimal]
|         |    |                   |    |    +-- [BalancedTernary]
|         |    |                   |    |    +-- [Babylonian]
|         |    |                   |    +--
NegativeIntegerBaseNumeralSystem
|         |    |                   +-- [GoldenRatioBase]
|         |    |    +-- 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
• 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

• 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)

• 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 04:24:51 -0500 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-07 23:38:19 -0500 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 08:27:33 -0500 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 04:59:41 -0500 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)