Ask Your Question

mirgee's profile - activity

2021-12-20 20:58:10 +0200 received badge  Notable Question (source)
2020-10-07 22:17:57 +0200 received badge  Popular Question (source)
2019-06-12 21:23:50 +0200 received badge  Good Question (source)
2019-04-18 19:52:12 +0200 received badge  Popular Question (source)
2017-11-24 10:59:24 +0200 received badge  Nice Question (source)
2017-02-13 07:20:44 +0200 received badge  Famous Question (source)
2016-04-29 10:14:37 +0200 commented answer Coercion on continued fractions

Alright, done.

2016-04-27 15:50:37 +0200 received badge  Notable Question (source)
2016-04-27 15:48:01 +0200 commented answer Coercion on continued fractions

I have already implemented an algorithm performing a Mobius transformation on an input continued fraction. My goal is to call the corresponding method upon a * continued_fraction(x) or continued_fraction(x) * a, where a is an integer, or continued_fraction(x) + continued_fraction(y). I apologize if the wording of my question was confusing. Can you provide any advice, please?

2016-04-26 17:00:45 +0200 commented question Coercion on continued fractions

@triviality: But this soultion would work only for cases where the first operand is a continued fraction, wouldn't it? Or modifying all the classes whose objects a continued fraction can be added, multiplied by....

2016-04-21 12:58:22 +0200 received badge  Good Question (source)
2016-04-20 20:43:04 +0200 commented answer Coercion on continued fractions

"It does not make much sense to mix these considerations with arithmetic." I am not sure I understand your point. Can you please explain what considerations do you mean?

"There is a ticket for that purpose: #19120" Yes, I know, this is the ticket I have been working on. Do you have any idea how to make it work, please?

2016-04-20 19:20:54 +0200 received badge  Nice Question (source)
2016-04-17 14:49:52 +0200 asked a question Coercion on continued fractions

Currently, when user types

sage: x = continued_fraction(pi)
sage: y = 3*x

an TypeError is raised saying

TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and '<class 'sage.rings.continued_fraction.ContinuedFraction_real'>'

I understand that Sage tries to find common parent of Integer element and ContinuedFraction_real and fails. It seems that continued fractions in Sage are not implemented as elements of any particular field, and are derived directly from SageObject.

I am implementing an algorithm for arithmetical operations on continued fractions. Is it possible to make Sage call a particular method when the user tries to perform an arithmetical binary operation, where one of the operands is a continued fraction?

I have found those 1, 2, 3 links, but it seems that the topic of coercion is rather extensive and I don't know what to look for, as I don't know what the correct solution to the problem is.

Thank you for any response!

2016-02-29 14:50:16 +0200 commented answer Implementing new CF class advice

What would be the proper way to implement Homography class? Where should I put it?

2016-02-26 14:50:40 +0200 commented answer Implementing new CF class advice

This is great advice, thank you.

2016-02-26 11:43:17 +0200 received badge  Supporter (source)
2016-02-26 10:19:29 +0200 received badge  Popular Question (source)
2016-02-26 07:29:45 +0200 asked a question Implementing new CF class advice

My goal is to implement Gosper's algorithm for algebraic operations on continued fractions into Sage. To begin with, I would like to implement a functionality to perform a homographic transformation

$$x \rightarrow \frac{ax + b}{cx + d}$$

where $x$ is a CF.

The easiest way to do this is probably to create a new class in sage.rings.continued_fraction that would on inicialization accept the integer constants $a, b, c, d$ and a descendant of ContinuedFraction_base class. The most important method of this class would be next() or _iter_(), which would read the input $x$ until it can output new term using Gosper's algorithm.

How do I create an instance of this class with proper arguments, when for example $(3*x + 1)/2$, where $x$ is a CF, is called from Sage? (Instead of _mul_() being called, than _add_() and so on...)

Simplifying using inbuilt Sage methods and then evaluating the expression as a string using regular expressions somehow (like this) might be a solution, but I am not sure if the best one.

Thank you very much for any advice on this!

EDIT: I have found this promising link, but haven't found anything useful in there so far...

2015-12-28 14:57:53 +0200 commented answer Add a row / column to a matrix

Note that insert_row method is not implemented for rational matrices.

2015-12-27 13:30:26 +0200 received badge  Scholar (source)
2015-12-22 17:52:28 +0200 received badge  Student (source)
2015-12-22 17:40:11 +0200 asked a question Add a row / column to a matrix

What is the most efficient way to add a row / column to an existing matrix? Are there any handy functions for this? I couldn't find any and any way I can think of seems needlessly complicated... Thanks!

2015-08-01 11:17:45 +0200 received badge  Editor (source)
2015-08-01 10:13:44 +0200 asked a question Configuring Sage project in PyCharm

What is the correct PyCharm configuration for the Sage project?

I use Python 2.7.6, source path sage/src (added to PYTHONPATH) and even though Sage compiles and runs almost all doctests, I keep getting unresolved references error in PyCharm. Do you have any ideas what is wrong with this?

Examples of unresolved references are: from integer import Integer from real_mpfi import RealIntervalField from sage.rings.real_mpfr import RR