A site devoted mostly to everything related to Information Technology under the sun - among other things.

Showing posts with label Programming Languages. Show all posts
Showing posts with label Programming Languages. Show all posts

Sunday, June 23, 2024

Gleam

A new programming language for concurrency control...

Erlang redux, likely with the same outcome, which is obscurity...

Tuesday, April 9, 2024

Plotting Quantum Potential with Python - ChatGPT 3.5

To simulate the interference pattern produced by a double-slit experiment with a double Gaussian wave function and compute the quantum potential, we can follow these steps:

  • Define the double Gaussian wave function.
  • Simulate the double-slit experiment by allowing the wave function to pass through two slits.
  • Compute the interference pattern resulting from the superposition of the waves passing through the two slits.
  • Compute the quantum potential based on the resulting wave function.
  • Plot the interference pattern and the quantum potential.
The results are:




    """

    This code defines a double Gaussian wave function, computes its quantum potential, 

    and then plots both the wave function and the quantum potential. Adjust the parameters 

    as needed to observe different behaviors.

    """

import numpy as np

import matplotlib.pyplot as plt


def compute_quantum_potential(psi, h_bar=1, m=1):

    """

    Computes the quantum potential for a given wave function.


    Arguments:

    psi : array_like

        1-D array representing the wave function.

    h_bar : float, optional

        Value of the reduced Planck constant (default is 1).

    m : float, optional

        Mass of the particle (default is 1).


    Returns:

    quantum_potential : array_like

        1-D array representing the quantum potential.

    """

    # Compute the magnitude of the wave function

    psi_magnitude = np.abs(psi)


    # Compute the second derivative of the wave function

    second_derivative = np.gradient(np.gradient(psi_magnitude))


    # Compute the quantum potential

    quantum_potential = - (h_bar**2 / (2 * m)) * (second_derivative / psi_magnitude)


    return quantum_potential


def double_gaussian_wavefunction(x, x0, sigma, A):

    """

    Computes the double Gaussian wave function.


    Arguments:

    x : array_like

        1-D array representing the position.

    x0 : float

        Position of the center of the Gaussians.

    sigma : float

        Width of the Gaussians.

    A : float

        Amplitude of the Gaussians.


    Returns:

    psi : array_like

        1-D array representing the wave function.

    """

    psi = A * (np.exp(-((x - x0 - 1) / sigma)**2) + np.exp(-((x - x0 + 1) / sigma)**2))

    return psi

# Example usage

if __name__ == "__main__":

    # Define parameters

    x = np.linspace(-5, 5, 1000)  # Position range

    x0 = 0  # Center of the Gaussians

    sigma = 0.5  # Width of the Gaussians

    A = 1  # Amplitude of the Gaussians


    # Compute the double Gaussian wave function

    psi = double_gaussian_wavefunction(x, x0, sigma, A)


    # Compute the quantum potential

    Q = compute_quantum_potential(psi)


    # Plot the wave function and the quantum potential

    plt.figure(figsize=(12, 6))


    plt.subplot(1, 2, 1)

    plt.plot(x, psi, label='Wave function')

    plt.title('Double Gaussian Wave Function')

    plt.xlabel('Position')

    plt.ylabel('Amplitude')

    plt.legend()


    plt.subplot(1, 2, 2)

    plt.plot(x, Q, label='Quantum Potential', color='red')

    plt.title('Quantum Potential')

    plt.xlabel('Position')

    plt.ylabel('Value')

    plt.legend()


    plt.tight_layout()

    plt.show()

Monday, March 7, 2022

Processing Sketchbook & Language

Please take a look at Welcome to Processing! / Processing.org - a flexible software sketchbook and an object-oriented language (with support for inheritance) for learning how to code within the context of the visual arts.

A useful book with step-by-step tutorials from elementary operations to genetic algorithms and neural nets is this: The Nature of Code

The significance of this environment is that it is for artists - it is geared towards the development of visual images. It is not a general purpose environment for solving generic dry and constipating problems.

Saturday, January 11, 2020

React vs. Angular

 https://appinventiv.com/blog/react-vs-angular/

Monday, October 14, 2019

Monday, August 5, 2019

Julia

From Nature

Julia: come for the syntax, stay for the speed

https://www.nature.com/articles/d41586-019-02310-3

Monday, January 28, 2019

Bayesian Synthesis of Probabilistic Programs for Automatic Data Modeling

This paper presents new techniques for automatically constructing probabilistic programs for data analysis, interpretation, and prediction. 

These techniques work with probabilistic domain-specific data modeling languages that capture key properties of a broad class of data generating processes, using Bayesian inference to synthesize probabilistic programs in these modeling languages given observed data.


It uses generative programming techniques to produce domain specific code - see below:

https://dl.acm.org/ft_gateway.cfm?id=3290350&ftid=2027616&dwn=1&CFID=46105614&CFTOKEN=bd554558d8f7ab57-41952796-0E75-1855-A8EFED89006D428F

Monday, February 19, 2018

Thursday, July 13, 2017

Spark

SPARK is a formally defined computer programming language based on the Ada programming language, intended for the development of high integrity software used in systems where predictable and highly reliable operation is essential.

Learn more about it @ http://www.spark-2014.org/

Rust

Rust is a systems programming language which is designed to be a "safe, concurrent, practical language".

Rust supports functional and imperative-procedural paradigms. 


Rust is syntactically similar to C++, but is designed for better memory safety while maintaining performance.


Learn more about it @  https://www.rust-lang.org/en-US/



Wednesday, July 12, 2017

Solidity

Solidity is a contract-oriented, high-level language whose syntax is similar to that of JavaScript and it is designed to target the Ethereum Virtual Machine (EVM).  Find out all about it @ https://solidity.readthedocs.io/en/develop/.

Thursday, January 12, 2017

Make with Ada: Redux

Here is Shawn Nock, an embedded systems "C" programmer, discussing his experience programming in Ada @ https://nocko.se/blog/make-with-ada-redux/.


Thursday, August 11, 2016

Monday, June 20, 2016

Teach Yourself Java

Thanks to commentator called Abderrahmen, who suggested the following Web Site for learning Java programming:

http://how-to-program-in-java.com/

About Me

My photo
I had been a senior software developer working for HP and GM. I am interested in intelligent and scientific computing. I am passionate about computers as enablers for human imagination. The contents of this site are not in any way, shape, or form endorsed, approved, or otherwise authorized by HP, its subsidiaries, or its officers and shareholders.

Blog Archive