Ask Your Question

philipp7's profile - activity

2023-09-08 15:29:53 +0100 received badge  Famous Question (source)
2023-08-18 16:27:59 +0100 received badge  Notable Question (source)
2023-07-20 17:15:40 +0100 received badge  Popular Question (source)
2023-01-25 10:14:22 +0100 commented question Zero check for certain numbers fail

Thank you! For me, this is not a big problem. I am, however, confused as https://sagecell.sagemath.org/ produces the sam

2023-01-25 09:21:41 +0100 commented question Zero check for certain numbers fail

I install it by calling make after cloning form the github repo as described here: https://ask.sagemath.org/question/431

2023-01-02 10:52:49 +0100 received badge  Popular Question (source)
2023-01-01 13:39:43 +0100 received badge  Popular Question (source)
2022-12-19 08:59:16 +0100 commented question Zero check for certain numbers fail

maxima(1) works in my installation and gives me a sage.interfaces.maxima.MaximaElement object.

2022-12-15 13:26:23 +0100 marked best answer Compute common number field of algebraic numbers

Suppose we have a list of algebraic numbers, e.g., a1,a2,a3 in QQbar. I want to compute the minimal number field K which contains all these algebraic numbers and I want to get the minimal polynomial of a1,a2,a3 in K. How can I do this?

I know how to convert one element from QQbar to a number field element, e.g.,

sage: a = [QQbar(sqrt(3)), QQbar(sqrt(17)), QQbar(sqrt(5))]
sage: Ka, aK, emb = a[0].as_number_field_element()
sage: aK.absolute_minpoly()
x^2 - 3

I can also define the common number field

sage: K.<u> = NumberField([ai.minpoly() for ai in a])

But now I have no idea how to convert for instance a[0] to an element of K.

2022-12-15 13:26:13 +0100 answered a question Compute common number field of algebraic numbers

I came up with such a function which for given algebraic numbers returns the common number field and the algebraic numbe

2022-12-15 10:03:53 +0100 asked a question Zero check for certain numbers fail

Zero check for certain numbers fail The following zero check yields an error in my copy of Sage (version 9.5): real_par

2022-12-13 14:07:35 +0100 asked a question Compute common number field of algebraic numbers

Compute common number field of algebraic numbers Suppose we have a list of algebraic numbers, e.g., a1,a2,a3 in QQbar. I

2022-12-02 20:06:23 +0100 received badge  Famous Question (source)
2022-04-14 18:27:59 +0100 received badge  Popular Question (source)
2022-04-14 18:27:59 +0100 received badge  Notable Question (source)
2022-04-04 12:53:13 +0100 marked best answer qepcad stopped working after updating to Sage 9.5

I recently updated from Sage 9.4 to Sage 9.5 (using the procedure described in https://ask.sagemath.org/question/431...). Everything seems to work normally. Then, I also installed qepcad again using sage -i qepcad. The qepcad interface is now available in Sage (i.e., the methods qepcad_formula, qepcad, etc. exist and are found), but calling the method qepcad with anything yields an error.

sage: qepcad(x > 0)
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
/tmp/ipykernel_6758/2242876628.py in <module>
----> 1 qepcad(x > Integer(0))

~/sage-9.2/local/lib/python3.9/site-packages/sage/interfaces/qepcad.py in qepcad(formula, assume, interact, solution, vars, **kwargs)

   1636         return qe
   1637     else:
-> 1638         qe.go()
   1639         qe.go()
   1640         qe.go()

~/sage-9.2/local/lib/python3.9/site-packages/sage/interfaces/qepcad.py in __getattr__(self, attrname)
   1236         if attrname[:1] == "_":
   1237             raise AttributeError
-> 1238         if attrname not in self._tab_completion():
   1239             raise AttributeError
   1240         return QepcadFunction(self, attrname)

~/sage-9.2/local/lib/python3.9/site-packages/sage/interfaces/qepcad.py in _tab_completion(self)
   1157             True
   1158         """
-> 1159         _update_command_info()
   1160         return _command_info_cache.keys()
   1161 


~/sage-9.2/local/lib/python3.9/site-packages/sage/interfaces/qepcad.py in _update_command_info()
    685     cache = {}
    686 
--> 687     with open(os.path.join(SAGE_LOCAL, 'share/qepcad', 'qepcad.help')) as help:
    688         assert(help.readline().strip() == '@')
    689 

FileNotFoundError: [Errno 2] No such file or directory: '.../sage-9.2/local/share/qepcad/qepcad.help'

(Note that sage-9.2 is just the original folder name, the version is in fact "SageMath version 9.5, Release Date: 2022-01-30"). The same error appears if I try the example from the documentation (https://doc.sagemath.org/html/en/refe...). Did something go wrong in my personal installation of Sage or qepcad or is this some bug of the recent Sage version?

Thanks!

2022-04-04 08:58:12 +0100 asked a question qepcad stopped working after updating to Sage 9.5

qepcad stopped working after updating to Sage 9.5 I recently updated from Sage 9.4 to Sage 9.5 (using the procedure desc

2022-02-17 13:23:13 +0100 received badge  Critic (source)
2022-02-08 20:28:25 +0100 received badge  Great Answer (source)
2021-10-15 13:01:54 +0100 answered a question How to find orthogonal subspace of a subspace

You can use the method complement. In your case: sage: U_perp = U.complement() sage: U_perp Vector space of degree 4 an

2021-09-03 13:50:30 +0100 received badge  Nice Answer (source)
2021-09-03 09:27:47 +0100 answered a question How to simplify expression

If we assume that all $A,B,C,D$ are real, we can use cylindrical algebraic decomposition (CAD) to simplify such an expre

2021-09-02 14:05:09 +0100 received badge  Self-Learner (source)
2021-09-02 13:18:05 +0100 marked best answer Coercion not commutative

I implemented a new algebraic structure A, derived from CommutativeAlgebra (over the rationals QQ) with element class Aelement derived from CommutativeAlgebraElement. The method A._element_constructor_ can, in particular, coerce an element from QQ into an element Aelement and this works fine if done explicitly. Also if I multiply an element from A with an element from QQ from the right-hand side everything works and the rational number is properly coerced to A. However, if I multiply an element from QQ with an element from A I get an error and the coercion does not work:

sage: A(QQ(2)) # works
sage: C.has_coerce_map_from(QQ)
True
sage: A.an_element()*QQ(2) # works
sage: ZZ(2)*A.an_element() # works
sage: QQ(2)*A.an_element() # does not work

The last call yields the error:

~/sage-9.2/local/lib/python3.8/site-packages/sage/rings/rational.pyx in sage.rings.rational.Rational.__mul__ (build/cythonized/sage/rings/rational.c:20912)()
   2399             return x
   2400 
-> 2401         return coercion_model.bin_op(left, right, operator.mul)
   2402 
   2403     cpdef _mul_(self, right):

~/sage-9.2/local/lib/python3.8/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11304)()
   1246         # We should really include the underlying error.
   1247         # This causes so much headache.
-> 1248         raise bin_op_exception(op, x, y)
   1249 
   1250     cpdef canonical_coercion(self, x, y):

TypeError: unsupported operand parent(s) for *: 'Rational Field' and 'A'

Does someone know what the problem could be? If no one has an idea, I will try to provide a minimal example which exhibits the error. Thank you!

2021-09-02 13:17:49 +0100 answered a question Coercion not commutative

The mistake was quite stupid: The structure A is defined over some base ring. For checking equality of the algebraic str

2021-09-01 16:23:34 +0100 commented question Coercion not commutative

I will try to provide a minimal example which shows the error tomorrow.

2021-09-01 13:05:34 +0100 answered a question using of M.permute_rows_and_columns

The following yields the same result as your function perRandC: G = SymmetricGroup(5) # create the symmetric group on 5

2021-09-01 12:50:04 +0100 asked a question Coercion not commutative

Coercion not commutative I implemented a new algebraic structure A, derived from CommutativeAlgebra (over the rationals

2021-08-25 23:37:33 +0100 received badge  Nice Question (source)
2021-08-25 23:37:19 +0100 marked best answer Installing packages using pip for Sage installed via apt

Recently I tried to install packages for Sage using pip. Often the descriptions says to execute something like

sage -pip install package_name

If I execute that in the terminal I get the error

sage-run received unknown option: -pip

If I start sage in the terminal and execute it there I get invalid syntax errors. I tried the exact string from above, I tried pip install ... and -pip install .... All lead to a syntax error. What do I do wrong? This happens with all packages I tried.

I use a freshly installed virtual machine with Ubuntu 18.04 and SageMath version 8.1 which I installed using sudo apt install sagemath. Sage itself works perfectly fine and I can start it with sage from the terminal.

I have no real experience with linux, the terminal or with any of that stuff, so I am sure that I miss some really obvious things...

2021-07-19 10:02:37 +0100 commented question _invert_ for ring which is not integral

Thank you very much! This works well!

2021-07-16 17:17:51 +0100 received badge  Nice Question (source)
2021-07-16 09:52:41 +0100 asked a question _invert_ for ring which is not integral

_invert_ for ring which is not integral Suppose I have implemented my own ring MyRing which derives (among others) from

2021-07-07 14:07:49 +0100 received badge  Self-Learner (source)
2021-07-07 09:50:40 +0100 answered a question Catch exception from forked subprocess

My, not so nice, solution is the following: The idea is that we catch the exception e in the forked process and just ret

2021-07-06 15:48:49 +0100 received badge  Nice Question (source)
2021-07-06 15:10:22 +0100 asked a question Catch exception from forked subprocess

Catch exception from forked subprocess I use fork to give certain methods only a fixed time for execution. These methods

2021-07-02 10:54:14 +0100 marked best answer Reusing output of QEPCAD

Suppose we get a quantifier-free formula as an output from QEPCAD and we want to use that formula as an input for another call to QEPCAD. How can this be done? The naive approach does not work as the following example shows (a very trivial example as the first qepcad call does not actually do much):

sage: var("a,b")
sage: formula = qepcad(a+b==0)
sage: print(formula)
b + a = 0
sage: qepcad_formula.exists(b,formula)

yields the error

ValueError: Attempting to quantify variable which does not occur in formula

2021-07-01 15:27:33 +0100 received badge  Self-Learner (source)
2021-07-01 09:10:10 +0100 answered a question Reusing output of QEPCAD

Sorry, already got it. For anyone else needing this at some point, there is the function qformula which can be used. The

2021-07-01 08:58:27 +0100 asked a question Reusing output of QEPCAD

Reusing output of QEPCAD Suppose we get a quantifier-free formula as an output from QEPCAD and we want to use that formu

2021-04-23 21:02:37 +0100 marked best answer Convert element from fraction field of polynomial ring to number field

Consider the following

F.<u> = NumberField(x^2-3)
R.<y> = PolynomialRing(F)
Q = R.fraction_field()

Then, F(Q(2*u)) yields an error since

TypeError: unable to convert 2*u to Number Field in u with defining polynomial x^2 - 3

Of course one could expect that this conversion should be not a problem. Doing the same over the base field QQ instead of a number field works as expected.

This problem can be fixed (in this case) by converting first to the polynomial ring and then to the number field, i.e., F(R(Q(2*u))) works fine. However, in practice, if we want to convert some a (where we know it "should" be in F but it might technically not) to F, it is very unpractical to check first whether a belongs in some certain ring and then convert it by going via the polynomial ring.

Is there a good built in way to do this? So we are given some a (which might be already in F or in some construction built upon F) and want to have a in F.

2021-04-23 21:02:37 +0100 commented answer Convert element from fraction field of polynomial ring to number field

Thank you very much to everyone! I'm glad this was a quick fix in Sage!