Jump to content

Recommended Posts

I'm not sure how to title this post. But this is what i want to do.

 

I need to take two variable numbers say 75 and 30000.

 

Then I need to step out the difference over a variable amount of cells. in

this case say 20 cells.

 

the output should look something like this.

 

75

80

93

123

178

320

...

...

...

30000

 

I'm not even really sure where to start other than the incoming variables.

 

thanks in advance.

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/82819-expanding-numbers/
Share on other sites

there is no pattern .. at least in my example.

 

all i want to do is input the following

 

$start = 75;

$end  = 30000;

$steps = 20;

 

I want the code to get from 75 to 30000 in 20 steps.

 

whatever the numbers may be.

 

 

The more I work on this, I think I will have to also input a rate or some sort of min / max for each cell increase.

 

for example

 

$minrate =  3;

$maxrate = 500;

 

this would state that when stepping out the numbers the current number cannot be less than 3 percent of the next number and no more than 500 percent of the preceeding number.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/82819-expanding-numbers/#findComment-421188
Share on other sites

What you've stated is a range of solutions .. it's much easier to work with something precise.

 

For example:

 

1.  Spread the gaps so that each is exactly 1.7 times the previous gap, allowing for fractional numbers

2.  Round each fraction to the nearest number.

 

Then you'll get something which is within your tolerance range (well I haven't checked this, I just picked 1.7 at random), but is exactly specified, and therefore easy to program.

 

Does that kind of thing sound suitable?  If so, we can look at deriving a formula that takes start, end, number of steps, and the multiplier (1.7 in the example) and produces the steps.

Link to comment
https://forums.phpfreaks.com/topic/82819-expanding-numbers/#findComment-422177
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.