1D Schrödinger Equation in Dinfio - Muhammad Faruq Nuruddinsyah
1D Schrödinger Equation in Dinfio

Here is the implementation of 1D Schrödinger equation in Dinfio Language.

Source Code:
' 1D Schroedinger Equation

import math
 
var cacah = 100, h = 1 / cacah
var k = array(cacah), psi = array(cacah), V = array(cacah)
 
start
    V[1] = 1; V[cacah] = 1
 
    for n, 1, 4
        E = (n ^ 2 * math_pi ^ 2) / 2
 
        psi[1] = 0; psi[2] = 0.01
        k[1] = 2 * (E - V[1])
 
        for i, 2, cacah
            k[i] = 2 * (E - V[i])
            psi[i + 1] = 2 * psi[i] - k[i] * h ^ 2 * psi[i] - psi[i - 1]
        endfor
 
        for i, 1, cacah
            writeln(((i - cacah / 2) * h) & "\t" & psi[i])
        endfor
    endfor
stop

Lihat semua daftar ACS - Download: schroedinger.fio - Tanggal: 20 Juli 2020 - Kategori: Dinfio