[PYTHON] How to define your own target in Sage

Caution

I've checked it properly, so there may be some mistakes.

TL;DR

Sage or SageMath is one of the computational algebraic systems implemented by extending Python, and is a free version of Mathematica. It is also a development environment that integrates computational algebraic libraries released as various open source software aiming at alternatives.

Target structure and unique definition

The structure of the object handled in mathematics is more complicated than the structure of types handled in programming languages (for example, inheritance and derivation. It is complicated enough because there are various other structures, but ...), so to handle this In Sage, a unique type conversion mechanism (cercion system) is implemented.

Therefore, if you want to define a new target on your own, you can benefit from the type conversion mechanism by defining it according to the rules of this implementation. Sage is an extension of Python, so of course you can implement it as a Python language. In this case, you cannot benefit from Sage's type conversion mechanism.

Parent and Element

Simply put, all objects are basically treated as instances of classes derived from the Element class. Also, if there is some set corresponding to the concept of type such as a set, group, or field, and you want to extract (generate) an element from this set, you can associate the derived class of Parent class with the derived class of Element class. , Implement this relationship. In Sage, by writing the code according to certain rules, it is possible to implement a unique target while using the type conversion mechanism in Sage.

Category

TODO: Not investigated.

Sample code

References

Recommended Posts

How to define your own target in Sage
[Road to intermediate Python] Define in in your own class
How to create your own Transform
How to use pyenv and pyenv-virtualenv in your own way
Try HeloWorld in your own language (with How to & code)
How to dynamically define variables in Python
How to install your own (root) CA
How to specify non-check target in Flake8
Try to put LED in your own PC (slightly)
[Linux] How to put your IP in a variable
How to define Go variables
How to develop in Python
[Ansible] How to call variables when creating your own module
How to define multiple variables in a python for statement
(Note) How to pass the path of your own module
How to get an overview of your data in Pandas
How to handle session in SQLAlchemy
[Python] logging in your own module
How to use classes in Theano
How to write soberly in pandas
How to collect images in Python
How to update Spyder in Anaconda
How to use SQLite in Python
How to convert 0.5 to 1056964608 in one shot
How to reflect CSS in Django
How to kill processes in bulk
How to use Mysql in python
How to wrap C in Python
How to use ChemSpider in Python
How to use PubChem in Python
Bridge ROS to your own protocol
How to run TensorFlow 1.0 code in 2.0
How to handle Japanese in Python
How to log in to Docker + NGINX
How to call PyTorch in Julia
Make the theme of Pythonista 3 like Monokai (how to make your own theme)
How to smartly define objects that are commonly used in View
How to make your own domain site with heroku (free plan)
How to use calculated columns in CASTable
How to build my own Linux server
Add your own content view to mitmproxy
[Introduction to Python] How to use class in Python?
How to suppress display error in matplotlib
Create your own Linux commands in Python
How to do R chartr () in Python
[LLDB] Create your own command in Python
How to convert csv to tsv in CLI
Easily use your own functions in Python
Migrate your own CMS data to WordPress
How to delete expired sessions in Django
How to use Google Test in C
How to implement nested serializer in drf-flex-fields
How to work with BigQuery in Python
How to execute commands in jupyter notebook
How to do'git fetch --tags' in GitPython
How to get a stacktrace in python
How to display multiplication table in python
How to extract polygon area in Python
How to reassign index in pandas dataframe
How to check opencv version in python
To import your own module with jupyter