Giter VIP home page Giter VIP logo

cubes's Introduction

Cubic grid

Introduction

Distribution of points on the surface of a cube

Code

I need to describe the algorithms, the code, the files, the libs, and where they are located.

Pyramid of squared base - octahedron

The code in ‘octahedron.f90’ corresponds to the octahedron centered at the origin of coordinates inscribed in a cube. The vertices of the octahedron lie on the center of the faces of the circumscribing cube.

The analytic expression of the octahedron is

$$\left| x \right|+\left| y \right| + \left| z \right| = 1$$

i.e., centered at the origin of coordinates.

cube_max_xyz.f90

This an analytic function/expression for the surface of the cube:

max(abs(x),abs(x),abs(x)) = 1.0

$max\left(\left|x\right|,\; \left|y\right|,\; \left|z\right|\right) = 1$

Figure 1

figures/cube.jpg

Compilation

$> module load gcc/10.3.0

$> gfortran -Wall -O2 -o cube.x cube.f90 lib/base.f90

In direct compilation and linking, the order of source files matters.

$> gfortran -Wall -O2 -o cube.x lib/base.f90 cube.f90

Including transform.f90

$> gfortran -Wall -O2 -o cube.x lib/transform.f90 lib/base.f90 cube.f90

Run:

$> ./cube.x > output.xyz

Visualization

$> module load jmol

$> jmol output.xyz

Initial program version; only half of the cube is computed. See Fig1

Figure 1

figures/fig1.jpg

To calculate the whole cube, I separate the pyramid in two parts: the equator (base of the pyramid) and the rest of the points up to the vertex. The latter group can be transformed into the missing cap that completes the cube.

In reality, the function cube builds a bipyramid of square base, not a cube. See figures 2a and 2b.

figures/Fig2a.jpg

Figure 2b with N = 12

figures/Fig2b.jpg

Testing other functions

  • Note taken on [2022-12-01 Thu 11:57]
    Recall to use ‘C-c C-x C-l’ to visualize mathematical expressions.

Examples $\dfrac{\sqrt{2}}{2} ⋅ \left( \left|x\right| + \left|y\right| \right)$ and $\dfrac{\sqrt{2}}{2} ⋅ \left( \left|x + y\right| + \left|x - y\right| \right)$ See Figure 3.

Figure 3

figures/fig3.jpg

Test Math:

\[ \dfrac{\sqrt{2}}{2} ⋅ \left( \left|x\right| + \left|y\right| \right) \]

and

\[ \dfrac{\sqrt{2}}{2} ⋅ \left( \left|x + y\right| + \left|x - y\right| \right) \]

A cube

Is this teh surface of a cube of center $\left( x_0, y_0, z_0\right)$ and edge $d$?

\[ \left|x - x_0\right| + \left|x - y_0\right| + \left|z - z_0\right| = d \]

BTA: to be tested and studied.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.