LB Booster
« propebility and chance »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:45am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: propebility and chance  (Read 268 times)
bluatigro
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 111
xx propebility and chance
« Thread started on: Mar 19th, 2016, 1:20pm »


try at properbility and chance functions

this can have errors

Code:
for a = 1 to 10
  for b = 1 to a
    print over( a , b ) ; " " ;
  next b
  print
next a
print "chance on a hart or face card ."
print p.str$( p.l( 13/52 , 12/52 ) )
print "chance of picking 4 boys out of groop of 5 boys and 4 girls ."
pickboys = 4
boys = 5
girls = 4
groops = over( boys , boys + girls )
boygroops = over( pickboys , boys )
print p.str$( boygroops / groops )
print "chance of picking ful house ."
groops = over( 5 , 52 )
print p.str$( 4 / groops )
print "chance of 10 dices no 6 ."
print p.str$( p.not( ( 5 / 6 ) ^ 10 ) )
end
function p.not( a )
  p.not = 1 - a
end function
function p.and( a , b )
''p( a and b )
  p.and = a * b
end function
function p.add( a , b )
''p( a or b )
''mutali excusif events
  p.add = a + b
end function
function p.or( a , b )
''p( a or b )
''not mutali excusif events
  p.or = a + b - p.and( a , b )
end function
function p.l( a , b )
''p( a | b )
  p.l = p.and( a , b ) / b
end function
function p.str$( a )
  p.str$ = str$( a * 100 ) + " %"
end function
function f( x )
'' x!
  uit = 1
  if x > 1 and x < 60 then
    uit = x * f( x - 1 )
  end if
  f = uit
end function
function over( a , b )
  over = f( a ) / ( f( a - b ) )
end function
function over2( a , b )
  over2 = f( a ) / ( f( b ) * f( a - b ) )
end function
 
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls