Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
iphone x used
AssassiN1
Updated:
Sunday at 10:30 PM
කිතුල් තලප
Manoj Suranga Bandara
Updated:
Saturday at 7:04 PM
Ad icon
ව්යාපාර, Tuition පන්ති සහ Personal Portfolios සඳහා Web Setup එකක් රු. 9,099/- කට (වාර්ෂික renewal ර
thathsilura
Updated:
Thursday at 6:17 PM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Aug 19, 2026
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Aug 18, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Mat lab
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="shanakaplus" data-source="post: 8557280" data-attributes="member: 45685"><p>---------------------------------------------------</p><p>% Monte Carlo computation of pi.</p><p></p><p>r = 5; % repearing time</p><p>count = 0;</p><p>n= 100;</p><p></p><p>for l =1:r,</p><p>for i=1:n,</p><p>x = rand ; y = rand ; % Generate random points</p><p></p><p>if (x-.5)^2 + (y-0.5)^2 <= .25, % general solution for any circle</p><p>count = count + 1;</p><p></p><p>end;</p><p>end;</p><p>pi_value = 4*(count/1000); % pi value</p><p>err = pi - pi_value,</p><p>x = [0:.100:100000];</p><p>plot(x,err,'rx');</p><p>n*10;</p><p>end;</p><p></p><p></p><p>%fprintf('\Error: %f' ,err);</p><p>fprintf('\nExtimated pi value : %f\n\n' ,pi_value)</p><p></p><p>------------------------------------------------</p><p></p><p>mcn mata oke n ta 100, 1000,10000,100000 oya agayan ena kota e eka eka situation eke pi value calculate wena one.</p><p></p><p>ita pase err eka hoyala plot this err against the value of n. mata mee cording eka modifi krala denawada?</p><p>Forward Message</p></blockquote><p></p>
[QUOTE="shanakaplus, post: 8557280, member: 45685"] --------------------------------------------------- % Monte Carlo computation of pi. r = 5; % repearing time count = 0; n= 100; for l =1:r, for i=1:n, x = rand ; y = rand ; % Generate random points if (x-.5)^2 + (y-0.5)^2 <= .25, % general solution for any circle count = count + 1; end; end; pi_value = 4*(count/1000); % pi value err = pi - pi_value, x = [0:.100:100000]; plot(x,err,'rx'); n*10; end; %fprintf('\Error: %f' ,err); fprintf('\nExtimated pi value : %f\n\n' ,pi_value) ------------------------------------------------ mcn mata oke n ta 100, 1000,10000,100000 oya agayan ena kota e eka eka situation eke pi value calculate wena one. ita pase err eka hoyala plot this err against the value of n. mata mee cording eka modifi krala denawada? Forward Message [/QUOTE]
Insert quotes…
Verification
Hata thunen beduwama keeyada? (60 bedeema thuna)
Post reply
Top
Bottom