473,765 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1758
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********@hot mail-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********@hot mail-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 GenerateSequenc e(ByVal ar() As Integer)
Dim r as New Random(RAND_SEE D)
For i as Integer = 0 to ar.Length - 1
ar(i) = r.Next(MAX_VALU E)
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********@hot mail-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
32650
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 the English term for this process; itemize? tokenize? digitize? sequence?) Some examples:
17
2328
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
3038
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 search each time the user types a new letter in the text box. That's badly explained - this example might help! The user types "r" and I displays all the names with r in them. The
10
1578
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 (which makes sense to me, why would people make so big xml files?). The xml file basically contains a big list of products, which I want to read one by one. The xml itself is referring to a dtd. Now I have 2 problems. First, of course that the...
7
2082
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
3805
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 one day): \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors During Execution: 7 \\FFDS24\ASP.NET Apps v1.1.4322(_LM_W3SVC_1_Root_ATV2004)\Compilations
7
1601
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 possible that a Data-type which can hold an unlimited numbers of numbers :D exists I would be happy or if it is possible to Override the Dim-function... Hilsen fra Peter
19
2758
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 in understanding as much as I can about how I can make this go as fast as possible on a linux system. I haven't run such a large database before. The nature of the database is such that
16
2043
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 execute it. However, I have tried to reduce the amount of data and the program runs fine. What could possibly be done to resolve this ?
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.