Squares

General FreeBASIC programming questions.
Locked
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Dodicat
Thanks!!
But a few iteration after the galaxy forms it begins expanding out to garbage.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Post by dodicat »

Hi Albert, been doing some fractals over in projects with jdebord.
I thought I'd stick one here, it's Tefnut Mons on Venus with it's reflection, I took the snap last week, but I see that some aliens were watching.
It was a very nice day by the way.

Code: Select all

Type complex
    As Double re,im
End Type

Operator +(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re+n2.re,n1.im+n2.im)
End Operator

Operator -(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re-n2.re,n1.im-n2.im)
End Operator

Operator *(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re*n2.re - n1.im*n2.im,n1.im*n2.re + n1.re*n2.im)
End Operator

Operator /(byval n1 As complex,byval n2 As complex) As complex
Dim As Double d = n2.re*n2.re+n2.im*n2.im
Return Type<complex>((n1.re*n2.re+n1.im*n2.im)/d,(n1.im*n2.re - n1.re*n2.im)/d)
End Operator

Operator *(byval n1 As Double,byval n2 As complex) As complex
Return Type<complex>(n1*n2.re,n1*n2.im)
End Operator

Operator =(byval n1 As complex,byval n2 As complex) As Integer
Return n1.re=n2.re And n1.im=n2.im
End Operator


Operator ^ (Byref A As Complex, Byval N As Integer) As Complex
' Computes A^N by repeated multiplications

Dim As Integer M
Dim As Complex B, Res,one=Type<complex>(1,0)
if n=0 then return one
if n=1 then return a
If N > 0 Then B = A Else B = one / A
' Legendre's algorithm for minimizing the number of multiplications
M = Abs(N)
Res = one
Do While M > 0
    If M Mod 2 = 1 Then Res = Res * B
    B = B * B
    M = M \ 2
Loop

Return Res
End Operator

#define Cabs(z)  sqr(z.re*z.re+z.im*z.im)
Function poly(coff() As complex,byval number As complex)As complex
        'evaluates the polynomial
    Dim zero As complex=Type<complex>(0,0)
    Dim deg As Integer=Ubound(coff)
    dim pol as complex = zero
    For count as integer = 1 To DEG + 1
        pol = pol + coff(count-1) * ((number) ^ (count - 1))
    Next count
    poly = pol
End Function
Function polygradient(coff() As complex,byval number As complex) As complex
    'evaluates dy/dx i.e. (gradient)
    Dim standin As complex
    Dim zero As complex=Type<complex>(0,0)
    Dim deg2 As Integer=Ubound(coff)
    dim pol as complex = zero
    For count as integer = 1 To deg2 
        If count >= 1 Then 
            standin = number ^ (count-1 )
        End If
        pol = pol + (count ) * coff(count) * standin 
    Next count
    polygradient = pol
End Function

dim shared as integer E 'iteration counter

Function Newton(coff() As complex,byval start As complex,byval iterations As Integer) As complex
    Dim As complex x1=start,x2
    E=iterations
    For z As Integer=1 To iterations
        x2=x1-poly(coff(),x1)/polygradient(coff(),x1) ''x1=x0-f(x0)/f'(xo)
        If x1=x2 Then E=z: Exit For
        x1=x2
    Next z
    Return x2
End Function



screen 19,32
dim as integer xres,yres
screeninfo xres,yres
dim as complex pol(3)
pol(0)=type<complex>(.4,.6)
pol(1)=type<complex>(.2,0)
pol(2)=type<complex>(1,-1)
pol(3)=type<complex>(0,-1)

Dim As complex root,pt
dim as integer count
dim as integer iterate=100

for x as single=0 to xres step 1
    for y as single=0 to yres step 1
        pt=type<complex>(xres/2-x,yres/2-y)
root=Newton(pol(),pt,iterate)

if e=iterate then count=count+1

pset(x,y),rgb(100*e mod 255,50*e mod 255,25*e mod 255)
next y
next x
print count
sleep
    
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Post by Richard »

@ Albert & dodicat.

Spektrus; draws the coloured spectrum of an element in different ionisation states.
http://spektrus.software.informer.com/
Download, only 1.2Mbyte.

Quantum Atomica;
http://download.cnet.com/1770-20_4-0.ht ... %3DWindows

Maybe take a look at the list here also.
http://download.cnet.com/windows/science-software/
bfuller
Posts: 362
Joined: Jun 02, 2007 12:35
Location: Sydney, Australia

Re: Squares

Post by bfuller »

That is a nice Galaxy Albert.

Is it possible to tilt it slightly so the orbits can be seen?
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Dodicat , Thats a cool fractal design !!

@BFuller , I'm not sure how to rotate the Galaxy on its z axis its a 2D GL plot.
And it falls apart after it forms , it keeps getting taller and taller.
The whole thing was an accident, that happened while trying to rotate thru the array,
I skipped some elements by stepping by several elements at a time.

Thats what I posted earlier about the 3 composites of science and technology.
1) imagination
2) systematic testing
3) accident

I'm working on a 3D Aether whirlpool particle model, like winding up a ball of yarn, with different polar and equatorial spin rates.
Since asteroids don't have gravity, and astronauts and light objects don't stick to the shuttle, I figure that gravity is caused by a
3D whirlpool in an Aether, and the fineness of the Aether might be like several thousand layers to make a neutrino.
I figure that Einstien was wrong and mass alone doesn't provide gravity, and that gravity is a physical action, caused by the whirlpooling. I figure this difference between polar and equatorial spins rate of the core with the viscosity of the mantle casues axial tilts and could result in complete polar flips. ???
But that means that the non-rotating planets/moons must have a nearly liquid mantle for the core spins to not afffect the crust.
Or the spins reverse on themselves fast enough not to cause crust movement. Or they might not have any gravity???
===========================================================================================================
@Dodicat
How do you put in different formulas or values to change the fractal output displayed ?
I noticed you have two * operators defined. ? Does it use both ?
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Richard
Thanks for the links !! , the science software downloads is a good one.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

I think that gravatational red-shift is caused by compressed aether around the star/galaxy caused by the whirlpooling and inflow of space-time / Aether..
And it should happen with an uncompressed volume of the same value, so if we put a numbe on it, like our sun at a compression of 1.00, then a distance of empty space equal to a compression of 1.00 ,would produce the same red-shift. which might add up to a few light years distance or so?

The only way to prove this is to send a probe to a distant star that shows red-shift past out sun , and measure its actual spectra, and compare it to the spectra past our sun and thru normal space. That might be a 100 year away NASA experiment.
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Post by Richard »

@ Albert. Just one minor problem there. NASA will not exist in 100 years as the $US economy will have been thoroughly RED shifted into Chinese Yuan.

Red shift is measured by the shift in wavelength of recognised patterns of atomic spectral lines. The shift is assumed to be a Doppler change in frequency. When you image the spectrum of stars in a rotating galaxy, the stars on the approaching side of the galaxy are shifted toward the blue while those on the receding side are shifted towards the red. This observation is inconsistent with your soup hypothesis.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Squares

Post by dodicat »

Hi Albert.
Here's a little fractal maker.
If you alter the constants a different one should be generated.
The dimension is the degree of the polynomial, if you make it too big it'll slow things down.
The iterate is the number of tries for a root of the polynomial, quite often within regions the root is not found, so a big iterate value can also slow things down.
The other constants are for random coefficients, and mag is to adjust skew. (1 is more or less symetrical on screen)
When the thing is drawn, the number of roots not found is written up in the corner.
Also you can fiddle with the RGB colours near the code end.
I havn't used randomize for then the constants will be lost.

Code: Select all


Type complex
    As Double re,im
End Type

Operator +(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re+n2.re,n1.im+n2.im)
End Operator

Operator -(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re-n2.re,n1.im-n2.im)
End Operator

Operator *(byval n1 As complex,byval n2 As complex) As complex
Return Type<complex>(n1.re*n2.re - n1.im*n2.im,n1.im*n2.re + n1.re*n2.im)
End Operator

Operator /(byval n1 As complex,byval n2 As complex) As complex
Dim As Double d = n2.re*n2.re+n2.im*n2.im
Return Type<complex>((n1.re*n2.re+n1.im*n2.im)/d,(n1.im*n2.re - n1.re*n2.im)/d)
End Operator

Operator *(byval n1 As Double,byval n2 As complex) As complex
Return Type<complex>(n1*n2.re,n1*n2.im)
End Operator

Operator =(byval n1 As complex,byval n2 As complex) As Integer
Return n1.re=n2.re And n1.im=n2.im
End Operator


function poly(coff() as complex,byval z as complex) as complex
    dim as integer deg=ubound(coff)
    dim as complex p=coff(deg)
    for i as integer=deg-1 to 0 step -1
        p=p*z+coff(i)
    next i
    return p
end function

sub differentiate(pol() as complex,Dpol() as complex)
    redim Dpol(ubound(pol)-1)
    for count as integer=0 to ubound(Dpol)
        Dpol(count)=(count+1)*pol(count+1)
        next count
end sub

dim shared as integer E
Function Newton(f0() As complex,f1() as complex,byval start As complex,byval iterations As Integer) As complex
    Dim As complex x1=start,x2
    E=iterations
    For z As Integer=0 To iterations
        x2=x1-poly(f0(),x1)/poly(f1(),x1) ''x1=x0-(f(x0)/f1(x0))
        If x1=x2 Then E=z: Exit For
        x1=x2
    Next z
    Return x2
End Function

screen 19,32
dim as integer xres,yres
screeninfo xres,yres
'___________________________________________
const as integer dimension=4
const as integer r1=1
const as integer r2=4
const as integer r3=10
const as integer r4=2
const as single mag=.75
const as integer iterate=100
'__________________________________________
dim as complex pol(dimension)
'''randomize
for z as integer=0 to dimension
    pol(z)=type<complex>(rnd*r1-rnd*r2,rnd*r3-rnd*r4)'make polynomial
next z

redim as complex grad()

differentiate(pol(),grad())

Dim As complex root,pt
dim as integer count

for x as single=0 to xres step 1
    for y as single=0 to yres step 1
        pt=type<complex>(xres/2-x/mag,yres/2-y/mag)
        
root=Newton(pol(),grad(),pt,iterate) 'iterate for roots
'e is number of iterations to root
if e=iterate then count=count+1

pset(x,y),rgb(100*e mod 255,50*e mod 255,25*e mod 255)
next y
next x
print count
sleep
       
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Richard

The space-time / Aether whirlpool travels in a particluar set of directions,
so:
If light travels with the flow, red-shift probably won't happen or might be reversed.
If light travels against the flow, red-shift will be greater.

I'm thinking that red-shift is due to photon x,y particle errosion.
And therefore an increase (blue-shift) of frequency is not possible.
Also errosion would happen in normal empty space with a distance equal to the compressed value of space-time around the gravity body.

So if a gravity body has a spin of 186,000 miles per hour (like our galaxy) and empty space has an aether constant of .00001
then you could figure the volume of space-time in the vicinity of the gravity body, and calculate the distance of empty space a pohton needs to go thru to cause the same red-shift.
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Post by Richard »

@ Albert.
Just how big is / are your whirlpool(s). Could one be as big as a galaxy?
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Richard

Apparently the whirlpools are based of amount of space-time / Aether and the speed of the currents.
It seems that most common ones are minute ones that form particles.

A Galaxy seemingly requires like tens or hundreds of light years of material to spin at over a 100,000 miles an hour to create stars.

A particle seemingly only requires light milli,micro,nano seconds of material to spin at <1 rotation a second. As the quarks seem to have partial spins of thirds of seconds.

The stars,planets,moons,particles form; sort of like pulling the carpet out from under an object, where it rolls into a ball during the pulling.

But my theory means that all particles have to be neutral, that if they have a magnetic moment or charge then they are a groups of particles acting in some way that produces the property.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Richard
I think in order for teleportation to be able to work , particles would have to be just frequency.

http://www.ask.com/wiki/Quantum_teleportation

Yet another monkey wrench (YAMW) in my "3D Whirlpool Theory".

If particles are frequency then they could be recreated anywhere, anytime,
making animate and inanimate objects of desire immortal.

So you could record 100,000 peoples frequency patterns and load it into a memory stick and send it off to another planet,
and recreate the 100,000 peoples frequency patterns there.
But would memories be reproductable are they imbedded in frequency patterns?

Theres theory that the scanning of the object/s would destroy the original objects.
But if they are just frequency patterns they could be recreated even besides themsleves.
But atoms in the area of recreation might interfere with the recreated patterns,
meaning that they would have to be recreated in a vacum, so only inanimate objects could be teleported.??
But the pattern creating machinery might be able to cancel the atoms occurring in the recreation area by frequency manipulation.??
Richard
Posts: 3096
Joined: Jan 15, 2007 20:44
Location: Australia

Re: Squares

Post by Richard »

Albert wrote:Theres theory that the scanning of the object/s would destroy the original objects.
Teleportation is the “science fictional” movement of an article with mass from one location to another without the need for acceleration and deceleration of the mass. This requires that the entire object be encoded as photons, right down to the bonding of atoms in the molecules. The object must be reassembled correctly in the arrival space. Since there is no stain left in the teleporter room after departure, all the matter must be converted purely to photons, not just taken apart, measured and copied.

An alternative implementation of teleportation would be to control the position and size of both ends of a wormhole in space. Unfortunately (for the Department of Defence), macro sized controllable wormholes are still science fiction.

When science fiction influences young brains and those brains go on to study physics, then those brains are always looking for ways to “realise” their accumulation of fiction. The fiction and the dream must precede the PhD topic. That is one reason why research is now aimed at quantum linked pairs of photons. The immediate use however turns out to be in secure communications, not teleportation.
There is no need to integrate science fictional concepts into your hypothetical aetherial whirlpools. You are just attempting to realise your fiction, which is expected as part of the human condition.

In FreeBASIC you would just change the x, y & z values of the location vector3D in that Objects Type, which would relocate that object in space. Then you do not have to disassemble, scan and destroy the original object, nor create any mythical wormhole.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Squares

Post by albert »

@Richard
If my "3D Whirlpool Theory" is correct, then:
particles could be created in a vacum by some equipment, that could cause a,
whirlpool in whatever substance thats called by the name Space-Time-Continueum or Aether.

Maybe magnetism could cause the whirlpool ?? So you would need some,
"magnetic feild turbulence generator" that could create the particle whirlpools?

If it was ever developed then gold,gems,ordinary objects would become useless.
You could just input the blueprints and molecular makeup and out comes a perfeclty cut gem or cellphone or TV or machine.

I imagine that natural currents in space might be caused by heat differences. -300 vs. -100
But how could that result in 100,000+ mile an hour winds the actual differences must be incredible to get light years of space moving at that velocity.
If a manned ship hit a movement just starting it could displace the ship by a 1/2 light year in a few moments.
Locked