Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.




3 posts

Wannabe Geek


# 173652 31-May-2015 13:55
Send private message

Hi, I need your help please.

I don't know computer programming or mathematics.
All I want is a simple PHP code for the following natural logarithm.

ln((N+1)/X)

and then a code to convert the natural logarithm to a percentile, as below.

 

(1 - exp (-L) ) * 100

I would have thought this would have been quite simple, but my web developers can't seem to get right.
I need your help urgently, I am desperate to get my website up and running and these calculations are critical.

Any help you can provide would be greatly appreciated.

Thanks in advance for all your help.

Glen

Create new topic
483 posts

Ultimate Geek
+1 received by user: 286

Trusted

  # 1315110 31-May-2015 14:20
Send private message

I'll bite.. firstly I am not a PHP programmer!

So the first part ln should convered by log

http://php.net/manual/en/function.log.php

The second part, the exp should covered by exp.

http://php.net/manual/en/function.exp.php

Are they interpreting your specification differently?

Have you given them sample results including the intermediate value L to validate against?

Are the developers using floating point values throughout the calculation?



3 posts

Wannabe Geek


  # 1315115 31-May-2015 14:33
Send private message


Hi
Thanks heaps for your reply. As I said in OP I know nothing at all on this subject, that's why I'm paying web developers but they don't seem to be getting it right.

ln ((N+1)/X)

N= Number of players
X = players finishing position.

 

(1 - exp (-L) ) * 100

L = Average of all Log scores

 


I have no idea if the developers are using floating point values throughout the calculation. I'm sorry for being so vague but this is about the extent of my knowledge on the topic.

I've paid these guys heaps and I'd expect they it should be relatively simple for them to write this code (everything else they have done is brilliant, except for getting this equation to work).

Thanks
Glen

 
 
 
 


23 posts

Geek
+1 received by user: 1


  # 1315192 31-May-2015 17:48
Send private message

I can help with PHP but not sure about the maths...

As obviously written as I can:

<?php
$n = 100;
$x = 15;
$result = log(($n+1)/$x);
echo "Log: {$result}";
echo "<br>";
$l = 1.5; // ??
$result = (1 - exp(-$l)) * 100;
echo "Result: {$result}";

Outputs:
Log: 1.907070315739
Result: 77.686983985157

Is that what you are looking for?
You should be able to see how that works, let me know if the equations are not correct.
These functions return floating point values, you may want to check out the accuracy of them depending on your application. E.g.: http://php.net/manual/en/language.types.float.php



3 posts

Wannabe Geek


# 1315199 31-May-2015 18:12
Send private message

Hi Critter
That's awesome!!! cool
They're the outputs I'm wanting, I'll pass on the code to my developer.
Thanks heaps!!


Create new topic



Twitter and LinkedIn »



Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

Xero announces new smarter tools, push into the North American market
Posted 19-Jun-2019 17:20


New report by Unisys shows New Zealanders want action by social platform companies and police to monitor social media sites
Posted 19-Jun-2019 17:09


ASB adds Google Pay option to contactless payments
Posted 19-Jun-2019 17:05


New Zealand PC Market declines on the back of high channel inventory, IDC reports
Posted 18-Jun-2019 17:35


Air New Zealand uses drones to inspect aircraft
Posted 17-Jun-2019 15:39


TCL Electronics launches its first-ever 8K TV
Posted 17-Jun-2019 15:18


E-scooter share scheme launches in Wellington
Posted 17-Jun-2019 12:34


Anyone can broadcast with Kordia Pop Up TV
Posted 13-Jun-2019 10:51


Volvo and Uber present production vehicle ready for self-driving
Posted 13-Jun-2019 10:47


100,000 customers connected to fibre broadband network through Enable
Posted 13-Jun-2019 10:35


5G uptake even faster than expected
Posted 12-Jun-2019 10:01


Xbox showcases 60 anticipated games
Posted 10-Jun-2019 20:24


Trend Micro Turns Public Hotspots into Secure Networks with WiFi Protection for Mobile Devices
Posted 5-Jun-2019 13:24


Bold UK spinoff for beauty software company Flossie
Posted 2-Jun-2019 14:10


Amazon Introduces Echo Show 5
Posted 1-Jun-2019 15:32



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.