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


Topic # 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

  Reply # 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


  Reply # 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


  Reply # 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


Reply # 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 »

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 »

Orcon announces new always-on internet service for Small Business
Posted 18-Apr-2019 10:19


Spark Sport prices for Rugby World Cup 2019 announced
Posted 16-Apr-2019 07:58


2degrees launches new unlimited mobile plan
Posted 15-Apr-2019 09:35


Redgate brings together major industry speakers for SQL in the City Summits
Posted 13-Apr-2019 12:35


Exported honey authenticated on Blockchain
Posted 10-Apr-2019 21:19


HPE and Nutanix partner to deliver hybrid cloud as a service
Posted 10-Apr-2019 21:12


Southern Cross and ASN sign contract for Southern Cross NEXT
Posted 10-Apr-2019 21:09


Data security top New Zealand consumer priority when choosing a bank
Posted 10-Apr-2019 21:07


Samsung announces first 8K screens to hit New Zealand
Posted 10-Apr-2019 21:03


New cyber-protection and insurance product for businesses launched in APAC
Posted 10-Apr-2019 20:59


Kiwis ensure streaming is never interrupted by opting for uncapped broadband plans
Posted 7-Apr-2019 09:05


DHL Express introduces new MyDHL+ online portal to make shipping easier
Posted 7-Apr-2019 08:51


RackWare hybrid cloud platform removes barriers to enterprise cloud adoption
Posted 7-Apr-2019 08:50


Top partner named at MYOB High Achievers Awards
Posted 7-Apr-2019 08:48


Great ideas start in Gisborne with hackathon event back for another round
Posted 7-Apr-2019 08:42



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.