Create Function to Transform a String Equation using PHP
$30-250 USD
In Progress
Posted almost 9 years ago
$30-250 USD
Paid on delivery
Using Standard PHP and probably regex or whatever you choose.
I need an equation string (that would work in PHP if evaluated) to be transformed into an equation string that would work in MYSQL/HIVE.
This transformation must be made possible with the use of a function that can be used for different equation strings. The input is the PHP string, the output is the MYSQL/HIVE string. I don't need anything else.
The main differences between the php string and the MYSQL/HIVE strings are the min/max functions and any multiplication needs to be enclosed in a CAST function for HIVE to work.
In the PHP formula, the min/max functions are like this: 'min(1e-5*variableA,5)' which should be transformed to this -> 'IF(1e-5*variableA < 5, 1e-5*variableA, 5)' OR if PHP: 'max(1e-5*variableA,5)' -> Transform to MYSQL/HIVE: 'IF(1e-5*variableA > 5, 1e-5*variableA, 5)'
The PHP min/max functions will have inner min/max functions like in the main example, those should be transformed correctly so the IF statements are inside the outside IF statements.
In the PHP formula, any multiplications have to transfomred into 'CAST( {multiplication statement} as DECIMAL (25,17))' where {multiplication statement} is something that is being multiplied using the '*' sign.
Example: PHP: '1e-5*variableA + 8.10331166869353e-5*variableA' Transformed into MYSQL/HIVE: 'CAST( 1e-5*variableA as DECIMAL (25,17)) + CAST( 8.10331166869353e-5*variableA as DECIMAL (25,17))'
Make sure to add any necessary parentheses to follow mathematical order of operations when you enclose the multiplications with CAST as DECIMAL
I have attached a txt file with an example PHP input string and what the PHP Function should output as the transformed string.
Also,
If you could easily make the output string legible like in the main example that would be great too.
Thanks
Hello!
With 98% to 99% completion rate, 800+ successfully completed projects, and a 5.00 reputation (maximum possible, 5.0) (Yes, not even 4.99 average rating, can be verified on my profile page https://www.freelancer.com/u/rajeshsonisl.html !!)... you can never go wrong choosing me :)
I look forward to your reply.
Thanks.
Kind Regards,
Rajesh Soni
Hi
I work towards providing reliable, relevant and robust IT solutions at most competitive prices to my customers. I ensure 100% customer satisfaction
so lets start
Thanks
Hi
I would like to participate in developing your project.
I think I have experience in php projects.
I have already developed several websites running on servers.
You might have read this in my profile.
Please accept my bid. Of course, I will do my best.
Thanks in advance.
I want to discuss this project with you further, let me know the best suitable time for you to schedule the meeting, Feel free to message me at any time, i used to be online 14 hrs in a day on this website so probably you will get a quick response from my end.
Hello,
I'm vijay patel and having more then 7+ year exp in PHP/Mysql programming.
I have well grip on db design and sql/mysql formula and programming.
I have done this type of tasks. Recently I completed one task like this convert distance php distance formula into mysql to increase speed in query result and site.
====
ex. calculate distance area within 1.5 mile
SELECT *,(
3959 * acos (
cos ( radians(".$userLat.") )
* cos( radians( lat ) )
* cos( radians( log ) - radians(".$userLog.") )
+ sin ( radians(".$userLat.") )
* sin( radians( lat ) )
)
) AS distance FROM traffic_users HAVING distance <= 1.5
order by is_traffic_time desc
===
Thanks for giving full clarification in project detail, I think first para is enough to understand for the exp. programmer.
by the way Thanks for it even thought I read the full detail and txt file and understood the task to apply formula in query string.
I just want to make sure that "variableA" is input value and can you give me input, output sample so its help me to checking with different value.
I'm very exited to do this job and complete it.
Tomorrow here sunday so I think I can complete it within monday morning in next one day.
Please not see ratting because of I have old account but starting to bid project and freelancing in these days.
I hope you will give me chance to show my expertise.
Thanks,