Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:58:06+00:00 2026-05-28T13:58:06+00:00

I have a mathematical formula to apply: I wrote a non recursive code (sadly

  • 0

I have a mathematical formula to apply: I wrote a non recursive code (sadly due to my lack of advanced coding skills), but a math.stackexchange user suggested me a recursive way to do the same:

https://math.stackexchange.com/questions/92942/applying-a-math-formula-in-a-more-elegant-way-maybe-a-recursive-call-would-do-t

Unfortuantely I have no experience both in recursive calls coding and in matrices implementation in PHP.

Would you please give me an help on translating what he wrote in PHP?

I know SO policy is: do your homework & researches before posting, I did what I could but this really seems out of my capabilities.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:58:07+00:00Added an answer on May 28, 2026 at 1:58 pm

    two things:
    1. there are better tools for matrix calculations than php (MATLAB for example)
    2. your code looks fine, and you can generalize it (make it work for any n >=3 winners) by modifying your code from:

    ...
    foreach ($stack as $s) {
      array_push($result,array($s,0,0,0));                       
    }
    ...
    

    to:

       //$n = number of winners
       ...
        foreach ($stack as $s) {
          $tmp_arr = init_array($s,$n);   
          array_push($result,$tmp_arr);                      
        }
        ...
    

    needless to explain what init_array() does 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an array of some values that i use in a mathematical formula,
I have a mathematical formula in my program that takes in two values, both
I have my own mathematical Vector class that I use in my code. I
I have a Binary tree for a mathematical expression(infix), i want to convert directly
I have a javascript function that accepts a number and performs a mathematical operation
Both are mathematical values, however the float does have more precision. Is that the
Let's say I have a text file of basic mathematical functions. I want to
If you have Mathematica code in foo.m, Mathematica can be invoked with -noprompt and
I have created a plugin for tinyMCE to insert in the editor mathematical formulas
i want to show some data in percent. i have a mathematics formula like:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.