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.


glenkzg

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
roobarb
653 posts

Ultimate Geek

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?



glenkzg

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

Critter
23 posts

Geek


  #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



glenkzg

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





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









Geekzone Live »

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



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.