{"id":21625038,"url":"https://github.com/reyrove/fortran","last_synced_at":"2025-03-18T19:54:22.951Z","repository":{"id":264368189,"uuid":"893167213","full_name":"reyrove/fortran","owner":"reyrove","description":"Welcome! This repo offers simple Fortran 95 examples for key algorithms and numerical methods. Learn with Plato IDE and FTN95. For more, check out my YouTube tutorials!","archived":false,"fork":false,"pushed_at":"2024-11-23T18:56:48.000Z","size":1375,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T22:32:49.506Z","etag":null,"topics":["compiler","fortran","fortran-language","fortran-tutorial","fortran77","fortran90","fortran95","freyja","mathematics","numerical-computation","plato","programming","reyrove","youtube"],"latest_commit_sha":null,"homepage":"https://www.youtube.com/watch?v=cyThxBP_I1I\u0026list=PLzPYCB_3Ed9f_8IZq943sm71hR5bJWLgq\u0026pp=iAQB","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reyrove.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-23T17:56:47.000Z","updated_at":"2025-01-10T11:53:40.000Z","dependencies_parsed_at":"2024-11-23T19:32:21.099Z","dependency_job_id":null,"html_url":"https://github.com/reyrove/fortran","commit_stats":null,"previous_names":["reyrove/fortran"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyrove%2Ffortran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyrove%2Ffortran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyrove%2Ffortran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reyrove%2Ffortran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reyrove","download_url":"https://codeload.github.com/reyrove/fortran/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244297647,"owners_count":20430343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","fortran","fortran-language","fortran-tutorial","fortran77","fortran90","fortran95","freyja","mathematics","numerical-computation","plato","programming","reyrove","youtube"],"created_at":"2024-11-25T01:07:36.050Z","updated_at":"2025-03-18T19:54:22.907Z","avatar_url":"https://github.com/reyrove.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic Fortran 95 Examples with Plato IDE\n\nThis repository contains a collection of basic **Fortran 95** (FTN95) programming examples designed to work with the **Plato IDE**. These examples cover fundamental numerical and algorithmic methods, including CPU time measurement, Gaussian elimination, factorial calculation, and more. These programs are excellent for understanding key concepts in computational programming and Fortran syntax.\n\n## Table of Contents\n\n1. CPU Time Measurement\n2. Gaussian Elimination and Factorization\n3. Gaussian Elimination with Scaled Partial Pivoting\n4. Geometric Series Sum of Powers of 2\n5. Interactive Factorial Calculator Program\n6. Thomas Algorithm for Tridiagonal Systems of Equations\n\n## 1. CPU Time Measurement\n\nThis example demonstrates how to measure the CPU time taken by a Fortran program using the `CPU_TIME` intrinsic function. It measures the time taken to execute a particular block of code and outputs the result in seconds.\n\n### Example:\n```fortran\nprogram cpu_time_example\n    real :: start, finish\n    call cpu_time(start)\n    ! Code to test here\n    call cpu_time(finish)\n    print *, \"Time = \", finish - start, \" seconds.\"\nend program cpu_time_example\n```\n\nThis simple example is useful for performance testing and optimization of Fortran programs.\n\n---\n\n## 2. Gaussian Elimination and Factorization\n\nThis example demonstrates solving a system of linear equations using **Gaussian Elimination** without pivoting. The system is represented by a matrix \\(A\\) and a vector \\(b\\), and the goal is to find the solution vector \\(x\\).\n\n### Example:\n```fortran\nprogram gauss_elimination\n    implicit none\n    integer, parameter:: n = 3\n    real :: a(n, n), b(n), x(n)\n    integer :: i, j, k\n    ! Matrix and vector setup\n    ! Perform Gaussian elimination\n    ! Back substitution to find the solution\nend program gauss_elimination\n```\n\nThis example is foundational for understanding the method of solving linear equations using direct methods.\n\n---\n\n## 3. Gaussian Elimination with Scaled Partial Pivoting\n\nThis example enhances Gaussian elimination by adding **scaled partial pivoting**, which helps improve numerical stability. It swaps rows based on the largest scaled element in the current column.\n\n### Example:\n```fortran\nprogram gauss_pivot\n    implicit none\n    integer, parameter:: n = 3\n    real :: a(n, n), b(n), x(n)\n    integer :: i, j, k\n    ! Matrix setup and pivoting logic\nend program gauss_pivot\n```\n\nThis method reduces the risk of round-off errors, especially for ill-conditioned systems.\n\n---\n\n## 4. Geometric Series Sum of Powers of 2\n\nThis example calculates the sum of the first \\( n \\) powers of 2 using a **geometric series**. It's a simple but effective way to demonstrate the application of mathematical series in Fortran.\n\n### Example:\n```fortran\nprogram geometric_series\n    implicit none\n    integer :: i, n\n    real :: sum\n    n = 10\n    sum = 0.0\n    do i = 1, n\n        sum = sum + 2**i\n    end do\n    print *, \"Sum of geometric series:\", sum\nend program geometric_series\n```\n\nThis program calculates the sum \\( S = 2^1 + 2^2 + ... + 2^n \\).\n\n---\n\n## 5. Interactive Factorial Calculator Program\n\nThis example prompts the user to input a number and computes its factorial using a simple **iterative loop**. It demonstrates user input handling and function calls in Fortran.\n\n### Example:\n```fortran\nprogram factorial_calculator\n    implicit none\n    integer :: n\n    print *, \"Enter a number:\"\n    read *, n\n    print *, \"Factorial is: \", factorial(n)\ncontains\n    function factorial(n)\n        integer :: n\n        integer :: factorial\n        integer :: i\n        factorial = 1\n        do i = 1, n\n            factorial = factorial * i\n        end do\n    end function factorial\nend program factorial_calculator\n```\n\nThis is a basic example for learning how to write and use functions and handle user input.\n\n---\n\n## 6. Thomas Algorithm for Tridiagonal Systems of Equations\n\nThis example demonstrates the **Thomas algorithm**, an efficient method for solving a system of linear equations where the matrix is tridiagonal. The program solves \\(Ax = b\\) with a tridiagonal matrix \\(A\\) and vector \\(b\\).\n\n### Example:\n```fortran\nprogram thomas_algorithm\n    implicit none\n    integer :: i\n    real :: a(n), b(n), c(n), d(n), x(n)\n    ! Setup matrix and vector\n    ! Thomas algorithm for solving tridiagonal system\nend program thomas_algorithm\n```\n\nThis algorithm is highly efficient for specific types of systems, making it a key technique for numerical linear algebra.\n\n---\n\n## How to Use Plato IDE with FTN95\n\nTo run the above examples in **Plato IDE**, follow these steps:\n\n1. **Install Plato IDE**: Download and install the Plato IDE for Fortran from [here](https://www.silverfrost.com/32/ftn95/ftn95_personal_edition.aspx).\n   \n2. **Create a New Project**:\n   - Open Plato IDE.\n   - Go to **File \u003e New Project** and select **Fortran Project**.\n   - Create a new Fortran file for your example code.\n\n3. **Compile and Run**:\n   - Write or paste the example code into the Plato editor.\n   - Save the file with a `.f95` extension.\n   - Click on **Build and Run** to compile and execute the program.\n\n4. **Output**: The output will appear in the **console** within Plato, where you can view results like CPU time, solution vectors, or error messages.\n\n---\n\n## License and Usage\n\nThese code examples are **free to use**. Please credit the source if you decide to use them in your own projects, particularly when modifying or redistributing the content.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyrove%2Ffortran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freyrove%2Ffortran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freyrove%2Ffortran/lists"}