开发者

Formulas in PHP

To a person skilled in programming, I know this question might seem ridiculous, but please bear with me. I'm involved in a court case开发者_开发百科 and a critical point hinges on the answer to a couple of questions.

Given a mathematical formula, along with complete formula documentation as shown here: alt text http://img69.imageshack.us/img69/1937/formula.png

(Pixelated some of the descriptors)

  1. In solving the equation for P, is there ANY requirement or need to implement the formula in Microsoft Excel prior to implementing it in PHP source code?

  2. Could a competent PHP programmer just type the formula into PHP source code without the use of Microsoft Excel in the interim?

Thank you very much!


1: No, I (and many here) probably really would not get the use of excel. 2: Absolutely.

A thing you have to realize though is that programming languages seldom deal in 'equations', they aren't 'symmetric' as in maths, the right side evaluates to the left.


The formulas you have presented are remedial mathematics, any decent programmer with any programming language (including PHP) could implement those formulas without Excel or any other software aid. So the answers to your questions are:

1.) NO

2.) YES


I haven't tested this but I didn't use anything to write this. Just this message box and the image above. I did this to show how simple it would be to write the code that implements these formulas in a matter of minutes.

<?php
$C  = 1;
$I  = 2;
$N  = 3;
$T  = 4;
$TA = 5;
$Q  = 6;
$E  = 7;
$L  = 8;
$D  = 9;

$i = 1.0/12.0;
$v = 1.0/(1.0+$i);
$f = (1.0+$i)/(1.0+($i*$Q/30.0));
$a = ((1.0 - pow($v, $N))/$i)*$f;
$b = (1.0 - pow($v, $N+$T))/$i;
$ff = ($E - $Q)/30.0;
$aa = $A*$ff;
$j = $D*$TA/100.0;
$k = (($L*$T)/(600.0*($T+1.0))) * ((($T-$a+$b)/$i)+$aa);
$P = $C / ($a - $j - $k);
echo $P;
?>


There's no reason whatsoever to use Excel before implementing this in PHP. Though it might help someone who wanted to use Excel for some basic calculations to see variations on input values, one skilled in PHP could just code in the variables and formulas directly.


I guess I'll be the contrarian.

In solving the equation for P, is there ANY requirement or need to implement the formula in Microsoft Excel prior to implementing it in PHP source code?

While there's no need to implement the formulas in Microsoft Excel prior to implementing it in PHP source code, because of the number and complexity of the formulas, a developer may have used Excel to see all of the intermediate results before coding the formulas into PHP.

The original implementation might have been in Excel, and after a period of time when the users were comfortable with the results, the formulas were recoded in PHP.

Could a competent PHP programmer just type the formula into PHP source code without the use of Microsoft Excel in the interim?

Yes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜