Computation Contest #4 Results and Solution

Solution

The problem of this contest was to solve the exponential integral numerically:

I implemented an example solution in java which takes your a number x as input and integrates between 1/x and x by dividing it into 10⁹ sections:

public class abcd {
    public static double f(double x) { // Whatever function you want to integrate.
        return Math.exp(x)/x;
    }
    public static void main(String[] args) {
        double xMax = Double.parseDouble(args[0]);
        double xMin = 1/xMax;
        double Δx = (xMax-xMin)/1.0e9;
        double total = 0;
        for(double x = xMin; x < xMax; x += Δx) {
            total += f(x)*Δx;
        }
        System.out.println(total);
    }
}

This prints out when used for my own reputation(57):

1.0156434538674713E23

This is pretty close to the value supplied by wolframalpha(thanks to @kaeserotor for mentioning it.), but still only a small amount of digits.

In the next contest you will apply a slightly different method for integrating this same function. It will be a lot more accurate(f you plug in numbers of the right magnitude…).
So you might want to keep your code for comparison.

↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓

List of participants with their entries:

Name | Solution found | Comment

  • | -
    @kaeserotor | 1.0156373595307505e+23 for 57 | By the way you said you are unsure what your computer can handle. Most of the time if whatever operation you do inside the loop is not too long(a few lines) you can be pretty sure that on any modern computer(having a GHz processor) it should run within a minute.
    @crokkon | 9.178120876620503e+27 for 68.6 | correct.

↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓

Winners:

Congratulations @kaeserotor and @crokkon, you won 1 SBI each!

↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓

The next contest starts in 2 days. Don't miss it!



0
0
0.000
6 comments
avatar

Nice :D I just chose the step for the rectangle way too small once, like 10^-9 or something, and my laptop did not even let me abort the loop manually for a while, dont know what happened exactly though

Posted using Partiko Android

0
0
0.000
avatar

A bonus $trendotoken tip from ONECENT!
Also consider MAPR fund and MAXUV vote bonds too.
MAP Steem FinTech: growing your STEEM without SP.

0
0
0.000
avatar
(Edited)

.

0
0
0.000
avatar

Actually it's not too hard to type if you adjust your keyboard layout a bit.
I put Δ on "alt gr"+"shift"+"d" which isn't too hard to press when typing.

0
0
0.000
avatar

Hello,

Your post has been manually curated by a @stem.curate curator.

FA8866FD-F2C3-43B3-A5A5-E0324BA4BB47.jpeg
Supporting Steemians on STEMGeeks

We are dedicated to supporting great content, like yours on the STEMGeeks tribe.

Please join us on discord.

0
0
0.000