Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Maximise function in PHP

1. ## Maximise function in PHP

Hi

In my script i am trying to maximise a function, is it possible to do this with php? can you differentiate a function using php is what i am essentially asking?

Thanks

• umm..

this maybe?

PHP Code:
``` function Integer(\$integer) { return \$integer;}print Integer(5) - Integer(3);//prints 2  ```

• how would i use that?

• I think funnymoney has confused elementary subtraction with calculus.

Short answer: yes, you can do differentiation and loads more in PHP. There's not a built-in function, AFAIK. Here's a page that may help you get started building your own.

• Thanks, i've worked it out thouigh, becuase it is just a quadratic i can just imput the a b and c values directly into a difernetiated version of the equation.

• ok so thought this was solved but just realised this solution won't work, as i am forming the equation from two simultaneous equations:
u=S*(1+((x/P)-1)*-E)
m=(u*(x-C))-F

S, P, E, C and F are provided by the user hence i can use the following equation

m=S*(1+((x/P)-1)*-E)(x-C)-F

I want to find the maximum value for M given all the variables in the equation above are given apart from x

this with those values should simplify to a quadratic which you could find a derivative for and optimize.

Does anyone know how to do this with php?

• i forgot how to handle those kind of math issues. was long time ago. i have a book near here i can look into, but i really don't want to remove the dust from the covering.

if you can remind me how to find maximum in a function. i remeber it had something to do with derivations... dunno how you call it. later i learned about integrals, also dunno how you say it right, but i'm pretty sure they were used to calculate surface under some curve or function something thingy...

maybe you can even write it on paper and then post it here to "program" the function

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•