473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Fastest way to produce huge amount of irrational numbers?

I am working on the program where is necessary to calculate huge
amount of numbers in always the same sequence. In other words, these
number have to be calculated and saved into memory before the program
starts.

I was trying to use number pi, but to calculate 100 million decimal
places of number pi would take forever and no one would want to wait
that long. On the other hand I can't afford to include the whole 100
million dec. places along with the software, that would take too much
of the space and too much time to download.

Is there any other number like PI, which I could calculate faster?
No need for any specialities... just quickly generate 100 milion
numbers... only requirement is that I'll find the numbers on the same
positions no matter how often I generate them...

Just to add to it, I was already wondering about number e, where same
as in number pi, decimal digits never end, and they never repeat...
Well, e is just like Pi in this respect; if you keep going, it never
stops, and it never repeats. But is it faster to calculate e?

Did anyone ever tried to calculate it on his computer using vb.net?
Or did anyone programmed its formulae in some sort of a programming
language?

I was also thinking about using square root of 2 as another irrational
example... well

does anyone have formulaes or programs which will show how to compute
it fast in vb.net?

Thanks for your help.

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #1
9 1736
I tried to find a square root of 2m which is good irrational
example...
But vb.net will not let me specify a number of decimal places,
So this code:
Dim result As Double = Math.Sqrt(2)
TextBox1.Text = result
will give me only this: 1.4142135623731

could someone show me how to calculate it to as many dec. places as I
specify?

Thanks a lot. I need to do this in vb.net.

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #2
On 2004-01-10, Vjay77 <vj********@hotmail-dot-com.no-spam.invalid> wrote:
I am working on the program where is necessary to calculate huge
amount of numbers in always the same sequence. In other words, these
number have to be calculated and saved into memory before the program
starts.


Have you considered simply using the Random class? When provided with
the same seed, it will always produce the same sequence. I haven't
benchmarked it, but I suspect performance will be better than
calculating an irrational number.
--
David
dfoster at
hotpop dot com
Nov 20 '05 #3
really? can you give me some example code, please?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #4
Random number is a good idea...
Can someone pls provide me with an algorithim that generates an random
number.
Something for vb.net? Perhaps Mersenne Twister, does anyone have a
code for it?
Thanx

vjay

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #5
On 2004-01-10, Vjay77 <vj********@hotmail-dot-com.no-spam.invalid> wrote:
really? can you give me some example code, please?


Assuming you want single digit numbers...

Private Const RAND_SEED as Integer = &H0F0E1231 ' Or anything
Private Const MAX_VALUE As Integer = 10 ' This assumes single digits

Public Sub GenerateSequence(ByVal ar() As Integer)
Dim r as New Random(RAND_SEED)
For i as Integer = 0 to ar.Length - 1
ar(i) = r.Next(MAX_VALUE)
Next
End Sub
--
David
dfoster at
hotpop dot com
Nov 20 '05 #6
this will always calculate the same sequence? starting with the same
digit and ending with the same?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #7
On 2004-01-10, Vjay77 <vj********@hotmail-dot-com.no-spam.invalid> wrote:
this will always calculate the same sequence? starting with the same
digit and ending with the same?


Just a note, but your newsreader doesn't follow-up posts correctly, so
if you don't quote any of the message you're responding to it's just a
guess what your question refers to.

Assuming you're responding to my post about Random, the answer is yes.
If you use the same seed, the sequence will always be identical.
--
David
dfoster at
hotpop dot com
Nov 20 '05 #8
tested and it does... thanks for all your help, had to change the code
a bit, but it works now
thnx a bunch
vjay

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #9
it does:
http://www.dotnetboards.com/viewtopic.php?t=9717
vjay

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Rune Strand | last post by:
Hi, If I have a lot of integers and want do something with each digit as integer, what is the fastest way to get there? Eg. Make 12345 into an iterable object, like or "12345" (Btw: What is...
17
by: DraguVaso | last post by:
Hi, I need to find the FASTEST way to get a string in a Loop, that goes from "a" to "ZZZZZZZZZZZZZZZZZ". So it has to go like this: a b .... z
6
by: richard.pasco | last post by:
Hey all I am trying to write a script that allows users to search through a database of names. But rather than give a search string and then return all those that match, I would like it to...
10
by: joe | last post by:
hi, I have to import a huge xml file into our system. the problem is that the xml source can be larger than 2GB. I wanted to use the XmlTextReader class for this purpose but it's limited to 2GB...
7
by: Vasil Buraliev | last post by:
Hallo. I started a solution in VS.NET with template for C# windwos application. The solution has several projects: -Artifacts -BusinessRules -Client -ErrorLog -Standardization .... ... ..
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
7
by: Peter Hansen | last post by:
Is in any way possible to define a variable as a integer-value which contain about 300 numbers in a row? I have thought about an Override-function for Data-types but I dunno how - but if it is...
19
by: Andy B | last post by:
Hello, Sorry for this newbish question. Briefly, my problem: ------------------ I expect the database I'm working on to reach something in the order of 12-16 Gigabytes, and I am interested...
16
by: pereges | last post by:
ok so i have written a program in C where I am dealing with huge data(millions and lots of iterations involved) and for some reason the screen tends to freeze and I get no output every time I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.