diff --git a/README.md b/README.md index 2bb36b8..89711cd 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,49 @@ # GTRPy -GTRPy is a python package that allows you to calculate the well-known tensors in general relativity, without *writing a single line of code*. Furthermore, you can apply many operations to 6 different type of fields, *in both 4D and 3D*. +GTRPy is a python package that allows you to calculate the well-known tensors in General Theory of Relativity, without *writing a single line of code*. Furthermore, you can apply many operations to 6 different type of fields, *in both 4D and 3D*. > It's tested for GNU/Linux, however it should also work in MacOS. If you ever encounter with a problem, feel free to create an issue. -## Installation +## Installation (via pip) You can easily install GTRPy via python3 -m pip install gtrpy -### Requirements - -The **base** requirements can be downloaded by running +later on you can install the requirements by running python3 -m pip install numpy Pillow pysimplegui sympy -However, you also need `tkinter` and `LaTeX` to properly run the GTRPy. In Fedora, these can be easily installed by running +## Installation (via git) + +If you want, you can also directly clone the repository via + + git clone https://github.com/seVenVo1d/GTRPy.git + +and install the requirements by running + + python3 -m pip install -r requirements.txt + +## Requirements (Extra) + +Additionally, you will also need `tkinter` and `LaTeX` to properly run the GTRPy. In Fedora, these can be easily installed by running sudo dnf install python3-tkinter sudo dnf install texlive-scheme-full -> Note that *texlive-scheme-full* is about 2-4GB and it may take some time to download. - You can look for your distributions package manager and search for an equivalent installation method. ## User Guide -To start *GTRPy*, simply run +To start GTRPy, simply run python3 -m gtrpy.run -This will create `logs` directory, which will contain the outputs of the performed operations. +from the terminal (it does not matter what directory you are in). + +This will create `logs` directory under your current directory, which will contain the outputs of the performed operations. -Please take a look at the `docs/user_guide.md` for a summary of the GTRPy. To see more detailed examples, you can look at the `demos` directory. +> Please take a look at the `docs/user_guide.md` for a summary of the GTRPy. To see more detailed examples, you can look at the `demos` directory. ## Current Features diff --git a/demos/demo_1.md b/demos/demo_1.md index 10d3cf8..a007f3e 100644 --- a/demos/demo_1.md +++ b/demos/demo_1.md @@ -2,4 +2,50 @@ In this demo, we will explore the usage of the LaTeX in the GTRPy. By following this tutorial you'll learn how to perform basic mathematical operations and define variables. -> In progress... +## Mathematical Operations and Greek Letters + +In GRTPy, the metric tensor and field components can be written by using LaTeX rules. For instance, if you want to write; +$$ +\alpha^2(r_s)^3(sin^2(\theta)) +$$ +you can directly write it as + + alpha^2*r_s^3*sin(theta)^2 + +and the `sympy` will interpret it as it is. In exponential expressions, you can both use `^` and `**`. You can also write `log` as usual, such as `log(10)` etc. For instance, if you want to write; +$$ +\log(10)r_s^2\psi^{\eta} +$$ +you can directly write it as + + log(10)^2*r_s^2*psi^(eta) + +As you can see most of the greek alphabet will be converted to its corresponding LaTeX form. Here is the list of them and corresponding results in GTRPy. + +$$ +{\rm alpha} - \alpha \\ +{\rm delta} - \delta \\ +{\rm epsilon} - \epsilon \\ +{\rm theta} -\theta \\ +{\rm iota} - \iota \\ +{\rm kappa} - \kappa \\ +{\rm lamda} - \lambda \\ +{\rm mu} - \mu \\ +{\rm nu} - \nu \\ +{\rm xi} - \xi \\ +{\rm omicron} - \omicron \\ +{\rm pi} - \pi \\ +{\rm rho} - \rho \\ +{\rm sigma} - \sigma \\ +{\rm tau} - \tau \\ +{\rm upsilon} - \upsilon \\ +{\rm phi} - \phi \\ +{\rm chi} - \chi \\ +{\rm psi} - \psi \\ +{\rm omega} - \omega \\ + +$$ + +> Note 1: For some reason, `beta` and `gamma` letters do not work in GTRPy. If your calculations involve those letters, please convert them to another letter. +> +> Note 2: You do not need to put `\` in front of the greek letters, as it's done in the LaTeX. diff --git a/docs/user_guide.md b/docs/user_guide.md index f1d8902..06120b1 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -4,6 +4,8 @@ You can run the program by simply typing python3 -m gtrpy.run +from the terminal + ![greetings](https://user-images.githubusercontent.com/45866787/213306039-51dd652a-d99e-41b5-9ca9-6fe6a4f7aa35.png) Later on choose a suitable dimension from the GUI. If you choose four dimensions, you'll see a page in this form @@ -38,7 +40,7 @@ and in 3D: ## Tensors, Tensor Types, Index Lowering and Raising -Let us study the Schwarzschild Coordinates as an example. +Let us study the **Schwarzschild Coordinate System** as an example. ![sch](https://user-images.githubusercontent.com/45866787/213306169-1fa3f7fd-20ee-408f-b840-9ad27f26a495.png) diff --git a/gtrpy/run.py b/gtrpy/run.py index 106ff75..331f792 100644 --- a/gtrpy/run.py +++ b/gtrpy/run.py @@ -5,22 +5,19 @@ from gtrpy.screen.screen3D.mainpage import gtrpy_3d from gtrpy.screen.screen4D.mainpage import gtrpy_4d - # ========== Creating logs directory ========== current_directory = os.getcwd() final_directory = os.path.join(current_directory, r'logs') if not os.path.exists(final_directory): os.makedirs(final_directory) - # ========== PySimpleGUI Color Theme ========== # Color theme option, provided by the PySimpleGUI. You can look at themes from: # https://www.pysimplegui.org/en/latest/#themes-automatic-coloring-of-your-windows sg.ChangeLookAndFeel('SandyBeach') - -# ========== DIMENSIONS ========== +# ========== Welcome Page ========== layout_dimension = [ [sg.Text('Welcome to GTRPy', font=('Georgia', 14))], [sg.Text('Please choose the number of dimensions:', font=('Tahoma', 11)), diff --git a/gtrpy/screen/grtensorsGUI.py b/gtrpy/screen/grtensorsGUI.py index 7e1d55c..7b11c88 100644 --- a/gtrpy/screen/grtensorsGUI.py +++ b/gtrpy/screen/grtensorsGUI.py @@ -1,13 +1,12 @@ import PySimpleGUI as sg + from sympy import preview from gtrpy.equations.grtensorsEP import * from gtrpy.tools.image_resizer_grtensor import * - # ========== IMPORTANT VARIABLES ========== - # Turning {'u','d'} tensor type notation into (p, q) type_dict = { '(0,2)': 'dd', '(1,1)': 'ud', '(2,0)': 'uu', diff --git a/gtrpy/screen/screen3D/mainpage.py b/gtrpy/screen/screen3D/mainpage.py index f78ab72..ed55847 100644 --- a/gtrpy/screen/screen3D/mainpage.py +++ b/gtrpy/screen/screen3D/mainpage.py @@ -9,7 +9,6 @@ from gtrpy.screen.screen3D.vectorfieldGUI import * from gtrpy.screen.screen3D.tensorfieldGUI import * - # ========== INPUT VARIABLES ========== # GRTensor objects @@ -32,7 +31,6 @@ # Image Path resPATH = importlib.machinery.PathFinder().find_module("gtrpy").get_filename()[:-11] + 'res' - # ========== GTRPy - MAIN PAGE ========== def gtrpy_3d(coordinate_type='Spherical Coordinates'): diff --git a/gtrpy/screen/screen3D/vectorfieldGUI.py b/gtrpy/screen/screen3D/vectorfieldGUI.py index 746fdc4..7523063 100644 --- a/gtrpy/screen/screen3D/vectorfieldGUI.py +++ b/gtrpy/screen/screen3D/vectorfieldGUI.py @@ -1,5 +1,6 @@ import importlib import PySimpleGUI as sg + from sympy import preview, sympify from gtrpy.equations.vectorfieldEP import * diff --git a/gtrpy/screen/screen4D/mainpage.py b/gtrpy/screen/screen4D/mainpage.py index 37ea35c..13da5d0 100644 --- a/gtrpy/screen/screen4D/mainpage.py +++ b/gtrpy/screen/screen4D/mainpage.py @@ -9,7 +9,6 @@ from gtrpy.screen.screen4D.vectorfieldGUI import * from gtrpy.screen.screen4D.tensorfieldGUI import * - # ========== INPUT VARIABLES ========== # GRTensor objects @@ -40,7 +39,6 @@ # Image Path resPATH = importlib.machinery.PathFinder().find_module("gtrpy").get_filename()[:-11] + 'res' - # ========== GTRPy - MAIN PAGE ========== def gtrpy_4d(coordinate_type='Spherical Coordinates'): diff --git a/pyproject.toml b/pyproject.toml index 410d65c..f3d63bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,11 +4,11 @@ build-backend = "hatchling.build" [project] name = "gtrpy" -version = "1.3" +version = "1.4" authors = [ - { name="Arman Çam", email="cam.arman7@gmail.com" }, + {name="Arman Çam"}, ] -description = "GTRPy is a python package that allows you to calculate the well-known tensors in general theory of relativity." +description = "GTRPy is a python package that allows you to calculate the well-known tensors in General Theory of Relativity." readme = "README.md" requires-python = ">=3.7" classifiers = [