Scientific Programming Question

AI Thread Summary
The discussion centers around generating a random distribution of doubles that follows a truncated power law distribution in Java. The user seeks guidance on implementing the probability distribution P(T) proportional to exp(-T/A)*T^(-B), where A and B are constants. They express a willingness to either code the solution themselves or find an existing implementation in a scientific programming library. Suggestions include creating a TruncatedPowerLaw class extending the Random class and implementing a method for nextTruncatedPowerLaw. Additionally, alternatives in other programming languages like C or C++ are mentioned, particularly the GNU Scientific Library, which offers random number generators for various distributions. The Numerical Recipes book is also recommended as a potential resource for algorithms related to this problem.
CoreyWhite
Messages
1
Reaction score
0
Hello, I'm new to these forums, so please forgive any problems with my post. In particular, I wasn't sure where to put this post.

I'm working on a scientific programming problem in Java, and I don't have a huge amount of familiarity with either scientific programming or Java, so you can imagine my dilemma. I'm trying to generate a random distribution of doubles following a truncated power law distribution. That is, I want to generate a list of times, T, for which the probability distribution P(T) is proportional to:

exp(-T/A)*T^(-B),

where A and B are constants.

Does anyone have any thoughts on how I would go about this? I'm open to programming it myself, if someone can suggest how to get started, or of course if such a distribution is already implemented in some publicly available scientific programming library that would be even better. If writing it myself, I figured I would create a TruncatedPowerLaw class extending the Random class, with a method for nextTruncatedPowerLaw, but I really have no idea where to go from there (i.e., the hard stuff). Thanks in advance!

By the way, if someone sees a way to accomplish this easily in another language, I'm not completely averse to that, although Java is preferred.
 
Technology news on Phys.org
If you don't mind programming in C or C++, you could use the GNU Scientific Library. It has random number generators for a lot of distributions.
There is a Java interface to it, but I don't know if it covers the entire library.
 
You can also try the Numerical Recipes book Chpt. 7 (It's available for free online). It might have an algorithm for your problem though you'll probably have to program the solution yourself.
 
Thread 'Star maps using Blender'
Blender just recently dropped a new version, 4.5(with 5.0 on the horizon), and within it was a new feature for which I immediately thought of a use for. The new feature was a .csv importer for Geometry nodes. Geometry nodes are a method of modelling that uses a node tree to create 3D models which offers more flexibility than straight modeling does. The .csv importer node allows you to bring in a .csv file and use the data in it to control aspects of your model. So for example, if you...
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top