LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 02-21-2021, 09:16 AM   #1
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,755

Rep: Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953
Question A mathematics question


I was trying to think of how I would calculate how long it would take me to get to 5000 posts based on how long I've been a member here and how many posts I've already made/make on average. But I really have no idea how I would work that out, but figure there must be a way, even if it's not 100% exact.

I should say that mathematics just isn't my strong suit, so please be clear in any answers given.

In any case, I'd like to know the calculation I'd have to make to work it out, not be given a time of how long it would take me to reach 5000 posts based on my current posting rate - I want to work out the answer myself, but I need some help to know how I figure it out. I'm not looking for any debates on the "best way" to do it; I'd just like to know a way(s) to calculate the answer.

According to vBulletin my "Posts Per Day" average is 0.86, if that's important to how I figure out the answer to my question (I think I know how it's calculates that for the record).

Thanks for any help on this.
 
Old 02-21-2021, 09:34 AM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 3,619

Rep: Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618Reputation: 1618
You have 3726 posts and joined March of 2009. So if in 143 months you made 3726 posts you average 3726/143 or ~26 posts per month. To get to 5000 you need 5000 - 3726 or 1274. At your current average rate it might take about 1276 / 26 or 49 months. That would be about 4 years (and one month) so march of 2025 might be a reasonable expectation. Naturally any change in average behavior could slow or accelerate the process, and the math is imprecise because the numbers are imprecise.

I did teach secondary field Mathematics and Science for some time, and this sounds exactly like the kind of question I might have put on a quiz (were I still teaching and giving quizes). It does not require very much mathematics skill, but does require that you think about how to approach the problem in the most simple way. I hope this has helped.
 
Old 02-21-2021, 12:44 PM   #3
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 3,359

Rep: Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017
Bash can do math.

Example:
Calculate number of days, weeks, months, years, using posts per day.
Code:
start=3726
end=5000
diff=$(($end - $start))

#Per day, week, month, year
for i in {1..30}; do
    echo "Needed for 5000"
    echo "With an average "$i" posts per day."
    
    a=$(("$diff"000/"$i"))
    echo ""${a:0:-3}.${a: -3}" days to "$end"" 
    
    b=$((("$diff"000/7)/"$i"))
    echo ""${b:0:-3}.${b: -3}" weeks to "$end""
    
    c=$((("$diff"000/30)/"$i"))
    echo ""${c:0:-3}.${c: -3}" months to "$end"" 
    
    d=$((("$diff"000/365)/"$i"))
    echo ""${d:0:-3}.${d: -3}" years to "$end""

    echo -e ''$_{1..40}'\b─'
done

Last edited by teckk; 02-21-2021 at 12:48 PM.
 
Old 02-21-2021, 01:41 PM   #4
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 3,359

Rep: Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017
If the average number of posts were a decimal number per day.

Code:
start=3726
end=5000
diff=$(($end - $start))
avpost=(.1 .2 .3 .4 .5 .6 .7 .8 .9)

for i in "${avpost[@]}"; do
    echo "Needed for 5000"
    echo "With an average "$i" posts per day."
    
    n=${i:1:2}
    
    a=$(("$diff"000/"$n"))
    echo ""${a:0:-2}.${a: -2}" days for "$end"" 
    
    b=$((("$diff"000/7)/"$n"))
    echo ""${b:0:-2}.${b: -2}" weeks for "$end""
    
    c=$((("$diff"000/30)/"$n"))
    echo ""${c:0:-2}.${c: -2}" months for "$end"" 
    
    d=$((("$diff"000/365)/"$n"))
    echo ""${d:0:-2}.${d: -2}" years for "$end""
    
    echo -e ''$_{1..40}'\b─'
done
 
Old 02-21-2021, 04:38 PM   #5
fido_dogstoyevsky
Member
 
Registered: Feb 2015
Location: Victoria, Australia
Distribution: Slackware 14.2
Posts: 405
Blog Entries: 2

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
You can also approach it from your posts/day figure:

Starting from the day you signed up, at 0.86 posts/day how long did it take you to post 86 times? 860 times? 1720 times? How many days in total to post 5000 times?

You've been posting for a while at an average 0.86 posts/day and you've posted 3727 times - how many days have you been posting?

It might look different, but this is basically what wpeckham said and the caveat they gave still applies.

(another ex-maths teacher, if you hadn't guessed by the way my answer was another question)
 
Old 02-21-2021, 04:54 PM   #6
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,225
Blog Entries: 13

Rep: Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288Reputation: 4288
Quote:
Originally Posted by jsbjsb001 View Post
In any case, I'd like to know the calculation I'd have to make to work it out, not be given a time of how long it would take me to reach 5000 posts based on my current posting rate - I want to work out the answer myself, but I need some help to know how I figure it out. I'm not looking for any debates on the "best way" to do it; I'd just like to know a way(s) to calculate the answer.
  1. ( days / 5000 ) = ( number of days in forum now / total number of posts )
  2. days = ( 5000 - number of posts now ) / posts per day
 
Old 02-21-2021, 05:04 PM   #7
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,559
Blog Entries: 11

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by teckk View Post
Bash can do math.

Example:
Calculate number of days, weeks, months, years, using posts per day.
Code:
...
    a=$(("$diff"000/"$i"))
    ... others similar ...
...
I don't think you can use double quotes like that inside arithmetic expansions.

Please check it and update!
 
Old 02-21-2021, 06:37 PM   #8
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 1,826

Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
I don't think you can use double quotes like that inside arithmetic expansions.
Why? They're not required, but not forbidden either. a=$((${diff}000/i)) would do the same.

From the Bash Reference Manual:
Quote:
The expression is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter and variable expansion, command substitution, and quote removal. The result is treated as the arithmetic expression to be evaluated.

Last edited by shruggy; 02-21-2021 at 06:51 PM.
 
Old 02-21-2021, 07:59 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,559
Blog Entries: 11

Rep: Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547Reputation: 3547
Quote:
Originally Posted by shruggy View Post
Why? They're not required, but not forbidden either. a=$((${diff}000/i)) would do the same.

From the Bash Reference Manual:
Quote:
The expression is treated as if it were within double quotes, but a double quote inside the parentheses is not treated specially. All tokens in the expression undergo parameter and variable expansion, command substitution, and quote removal. The result is treated as the arithmetic expression to be evaluated.
Which I take to mean a double quote is treated like any other character, i.e. not as an enclosing quote.

Did you try to run the script as posted? I get a bash error:

Code:
"1274"000/"1" : syntax error : operand expected
Does that not happen for you?

Last edited by astrogeek; 02-21-2021 at 11:40 PM.
 
Old 02-22-2021, 03:03 AM   #10
//////
Member
 
Registered: Nov 2005
Location: Land of Linux :: Finland
Distribution: Arch x86_64 | OpenBSD 6.7 bridge | Virtualbox Guest windows 10 pro
Posts: 520

Rep: Reputation: 246Reputation: 246Reputation: 246
ive got a over 20k posts at one gaming forum, lil bit more than here
 
Old 02-22-2021, 05:24 AM   #11
enorbet
Senior Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware = Main OpSys
Posts: 3,384

Rep: Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331Reputation: 3331
Quote:
Originally Posted by jsbjsb001 View Post
I was trying to think of how I would calculate how long it would take me to get to 5000 posts based on how long I've been a member here and how many posts I've already made/make on average. But I really have no idea how I would work that out, but figure there must be a way, even if it's not 100% exact.
The problem is a simple Progression problem but you're starting out half-baked as soon as you expect anything remotely "exact" when starting with an "average", especially when the progression extends into the future and is subject to change, and even more profoundly once a feedback loop is engaged. That's a far more complex equation.
 
Old 02-22-2021, 05:40 AM   #12
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 1,826

Rep: Reputation: Disabled
Quote:
Originally Posted by astrogeek View Post
Does that not happen for you?
No
Code:
$ echo $BASH_VERSION
4.4.20(1)-release
$ bash -c 'x=5;y=2;echo $(("$x"0/"$y"))'
25
 
Old 02-22-2021, 07:13 AM   #13
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 3,359

Rep: Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017
@astrogeek

Those scripts run fine for me. I tested them before posting.
Code:
Needed for 5000
With an average .1 posts per day.
12740.00 days for 5000
1820.00 weeks for 5000
424.66 months for 5000
34.90 years for 5000
────────────────────────────────────────
Needed for 5000
With an average .2 posts per day.
6370.00 days for 5000
910.00 weeks for 5000
212.33 months for 5000
17.45 years for 5000
────────────────────────────────────────
Needed for 5000
With an average .3 posts per day.
4246.66 days for 5000
606.66 weeks for 5000
141.55 months for 5000
...
Code:
bash -version
GNU bash, version 5.0.18(1)-release (x86_64-pc-linux-gnu)
...
If you run it line by line, by copying lines into the terminal, without the "$i", you'll get that, because there is no no "$i"

Code:
start=3726
end=5000
diff=$(($end - $start))

a=$(("$diff"000/"$i"))
echo ""${a:0:-3}.${a: -3}" days to "$end""
bash: 1274000/: syntax error: operand expected (error token is "/")
Code:
start=100
end=323
diff=$(($end - $start))
i=20

a=$(("$diff"000/"$i"))
echo "${a:0:-3}.${a: -3}"
11.150
Code:
start=200
end=450
diff=$(($end - $start))
i=".3"
n=${i:1:2}

a=$(("$diff"000/"$n"))
echo "${a:0:-2}.${a: -2}"
833.33
Everyone knows that bc is faster. Just showing on a linux forum that bash can be made to do decimal math. Thanks for the input.
 
Old 02-22-2021, 07:21 AM   #14
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,755

Original Poster
Rep: Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953Reputation: 1953
wpeckham,

Thanks for that, it's really helpful. I was thinking that division had to be involved, but I just could figure out what the process(s) was though.

teckk,

I'm afraid my bash scripting skills aren't nearly as good as yours are. I do know that bash scripts can use variables and loops, like for loops and while loops, etc - although I also know that a bash script really just calls the for and while executables, and therefore the for and while loops aren't actually bash builtin commands (if my understanding is correct of course). Whereas, in something like C, they are a part of the language, not separate executables called by the compiler.

I could probably write a for loop in C for example based on what wpeckham said about the process to get to an answer to my question (even if it's imprecise as they point out). But my bash scripting capabilities would be too lacking to do the same in a bash script. I think I have some bash scripting tutorials somewhere or bookmarked, but I just never seem to find the time to learn it properly. But I'll have a look at your script later on anyhow.

fido_dogstoyevsky,

I think I'm too dumb to understand your post to a large extent. But thanks anyway.

rtmistler,

Thank you RT, I think I get what you're saying, thanks again.

astrogeek,

Funny you talk about parentheses, as I had trouble getting ffmpeg to convert a video the other day because bash couldn't understand the parentheses in the filename. I ended up just taking the easy way out and got rid of the parentheses in the filename - although as far as I know parentheses aren't illegal in a filename on an ext4 filesystem - so donno what bash's problem was there.

Quote:
Originally Posted by enorbet View Post
The problem is a simple Progression problem but you're starting out half-baked as soon as you expect anything remotely "exact" when starting with an "average", especially when the progression extends into the future and is subject to change, and even more profoundly once a feedback loop is engaged. That's a far more complex equation.
Yes, that's why I said "even if it's not 100% exact" in the OP, and wpeckham also pointed it out, in that; if I were to post more or less, it would affect the answer.

Although, not really sure what you mean by "feedback loop"? Again, you'll have to forgive my lack of mathematical understanding, as it's far from the greatest.
 
Old 02-22-2021, 07:54 AM   #15
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 3,359

Rep: Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017Reputation: 1017
@astrogeek

That is an interesting observance about portability or not though.

How about this? And what shell are you using?
Code:
start=1234
end=5003
diff=$(($end - $start))
avpost=(.1 .2 .3 .4 .5 .6 .7 .8 .9)

for i in "${avpost[@]}"; do
    n=${i:1:2}
    
    a=$((${diff}000000/$n))
    echo "${a:0:-5}.${a: -5}"
done

37690.00000
18845.00000
12563.33333
9422.50000
7538.00000
6281.66666
5384.28571
4711.25000
4187.77777
Checking my work.
Code:
python
Python 3.9.0
...
>>>avpost=([.1, .2, .3, .4, .5, .6, .7, .8, .9])
>>>for i in avpost:
...     3769/i
... 
37690.0
18845.0
12563.333333333334
9422.5
7538.0
6281.666666666667
5384.285714285715
4711.25
4187.777777777777

Last edited by teckk; 02-22-2021 at 07:55 AM.
 
  


Reply

Tags
math, mathematics, maths


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Mathematics on a UNIX workstation LXer Syndicated Linux News 0 11-03-2006 12:54 AM
Where can I get mathematics........? schneemann SUSE / openSUSE 1 01-08-2006 05:28 PM
mathematics ? Volcano Programming 6 10-06-2005 12:17 AM
bash mathematics possible? stabu Linux - Newbie 5 04-30-2004 05:45 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 05:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration