quantum computing sim

General FreeBASIC programming questions.
paul doe
Posts: 179
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: quantum computing sim

Postby paul doe » Nov 08, 2017 3:07

deltarho[1859] wrote:An explanation is required.

Indeed =D

Makes you wonder how reality even manages to remain bounded, if at all =D
Really, a pleasure sharing thoughts with you. I rarely have the chance of talking about these kind of things with someone this side of my computer screen. Hope the OP doesn't mind, as it seems both of us are apparently bound to rant wherever we go ;D
deltarho[1859]
Posts: 733
Joined: Jan 02, 2017 0:34
Location: UK

Re: quantum computing sim

Postby deltarho[1859] » Nov 08, 2017 7:20

paul doe wrote:Makes you wonder how reality even manages to remain bounded, if at all =D

I think because the random process is deterministic. If we toss an unbiased coin an infinite number of times the total number of heads divided by the total number of tails will be exactly one. So, we can determine the result. What we cannot do is determine the result of an individual toss. Quantum mechanics depends upon that. Quantum mechanics is much more accurate compared with empirical data than is relativistic mechanics. Even more accurate is Quantum Electrodynamics (QED) and that is even more obscure than quantum mechanics. We have a different story with chaos, which is non-deterministic. The quantum world may seem chaotic but it is the opposite.

Another factor keeping reality bounded is the speed of light. If an object came into the universe travelling faster than the speed of light it would never slow down to the speed of light - it would take an infinite amount of energy to do that. So, the speed of light is not a limit - it is a boundary.

Added: I have just ordered a book for my Kindle, 'Predictably Irrational: The Hidden Forces that Shape Our Decisions.'

Sounds right up my street. <laugh>
bluatigro
Posts: 464
Joined: Apr 25, 2012 10:35
Location: netherlands

Re: quantum computing sim

Postby bluatigro » Nov 08, 2017 8:58

update :
some error's that you al noticed removed

Code: Select all

'' bluatigro 8 nov 2017
'' quantum computer sim
'' based on :
'' https://quantumexperience.ng.bluemix.net/qx/experience

randomize timer

const as double pi = atn( 1 ) * 4

sub rotate( byref k as double , byref l as double , r as double )
  dim as double s = sin( r ) , c = cos( r ) , hk , hl
  hk = k * c - l * s
  hl = k * s + l * c
  k = hk
  l = hl
end sub

type Qbit
public :
  dim as double x , y , z
  declare constructor()
  declare sub do_x()
  declare sub do_y()
  declare sub do_z()
  declare sub do_h()
  declare sub do_s()
  declare sub do_s1()
  declare sub do_t()
  declare sub do_t1()
  declare function get_state() as double
end type
constructor Qbit() '' |0>
  x = 0
  y = 0
  z = 1
end constructor
sub Qbit.do_x() '' X gate
  rotate y , z , pi
end sub
sub Qbit.do_y() '' Y gate
  rotate x , z , pi
end sub
sub Qbit.do_z() '' Z gate
  rotate x , y , pi
end sub
sub Qbit.do_h() '' |+>
  z = iif( rnd < .5 , 1 , -1 )
end sub
sub Qbit.do_s() '' S gate
  rotate x , y , pi / 2
end sub
sub Qbit.do_s1() '' S1 gate
  rotate x , y , -pi / 2
end sub
sub Qbit.do_t() '' T gate
  rotate x , y , pi / 4
end sub
sub Qbit.do_t1() '' T1 gate
  rotate x , y , -pi / 4
end sub
function Qbit.get_state() as double
  return iif( z < 0 , 1.0 , 0.0 )
end function
const as integer numberOfQbits = 4
dim shared as Qbit q( numberOfQbits )
sub cnot( byref control as Qbit , byref target as Qbit )
  if control.get_state() then
    target.z = 1 - target.get_state()
  end if
end sub


Return to “General”

Who is online

Users browsing this forum: No registered users and 6 guests