Jump to content

Search the Community

Showing results for tags 'pi'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I had to make an efficiency comparison of ways to calculate Pi for a class (based on # of iterations). One is statistical and the other is algebraic. I figured I would post them here. Monte Carlo Method of calculating Pi (statistical) ;Monte Carlo method to calculate Pi $incircle = 0 $count = InputBox("Monte Carlo", "Please enter how many samples to calculate") For $i = 0 To $count $hypo = pythagoran(((Random(0, 1) * 2) - 1), ((Random(0, 1) * 2) - 1)) If $hypo <= 1 Then $incircle += 1 Next MsgBox(0, "Pi Equals", "Pi: " & ((4 * $incircle) / $count) & @CRLF & "Samples: " & $count) Func pythagoran($a, $b) Return Sqrt(($a ^ 2) + ($b ^ 2)) EndFunc ;==>pythagoran Nilakantha Method of calculating Pi (algebraic) ;Nilakantha method to calc pi $pi = 3 $count = InputBox("Nilakantha", "Enter number of iterations") For $i = 1 to $count $denom = (2 * $i) + 2 if mod($i, 2) = 1 Then $pi += (4 / (($denom)*($denom - 1)*($denom -2))) elseif mod($i, 2) = 0 Then $pi -= (4 / (($denom)*($denom - 1)*($denom -2))) EndIf Next MsgBox(0, 0, $pi)
×
×
  • Create New...