## Prog Help plz

### Prog Help plz

Hello again peoples!

Its been a long while since I have had a chance to sit down with tutorials and such. Starting a new jobm studying, and moving at the same time sucks. I wanted to throw up a quick post to see if you can help an extremely outta practice nooB. I finally got an idea for a program, something I can use for a game. I need some code help in which way to get started and such. The premise is this:

I need a program that will "predict" a set of numbers that are part of a chart....if thats possible. The program will get fed numbers for the rows across, ranging from 24-30. The collum going down will just be a generic number (i.e. 1-14). The second chart will work the same way only be smaller. Any of this making sense? See Below:

1)24,24,26,28,27,(predict the next number)

2)27,30,30,29,24,(predict the next number)

3)29,29,29,29,25,(predict the next number)

4)30,24,25,26,27,(predict the next number)

5)27,28,28,24,26,(predict the next number)

Thnx again for all suggestions and help!

Its been a long while since I have had a chance to sit down with tutorials and such. Starting a new jobm studying, and moving at the same time sucks. I wanted to throw up a quick post to see if you can help an extremely outta practice nooB. I finally got an idea for a program, something I can use for a game. I need some code help in which way to get started and such. The premise is this:

I need a program that will "predict" a set of numbers that are part of a chart....if thats possible. The program will get fed numbers for the rows across, ranging from 24-30. The collum going down will just be a generic number (i.e. 1-14). The second chart will work the same way only be smaller. Any of this making sense? See Below:

1)24,24,26,28,27,(predict the next number)

2)27,30,30,29,24,(predict the next number)

3)29,29,29,29,25,(predict the next number)

4)30,24,25,26,27,(predict the next number)

5)27,28,28,24,26,(predict the next number)

Thnx again for all suggestions and help!

- Raspberrypicker
- Veteran
**Posts:**55**Joined:**Thu Aug 02, 2007 4:54 pm**Location:**Florida

Hi disk.

I think I got what you need...but I'm not sure. But this is a little sample program I made. You can run it on qb, i checked it to make sure it works.

In this program, it sets up an array, so you can fill in values for your chart.

I'm not sure about the algorithms you set up, and I don't know the pattern...but if you know the pattern, just substitute the equations in place of my equations. (it helps to know a bit about algebra, it can greatly help you set up algorithms.)

I think I got what you need...but I'm not sure. But this is a little sample program I made. You can run it on qb, i checked it to make sure it works.

Code: Select all

```
CLS 'clears screen
n=2 'set your variable
DIM chart(5) 'alerts qbasic that you have an array in your program
chart(1)=(n+1) 'this is your array
chart(2)=(n+3)
chart(3)=(n-3)
chart(4)=(2*n)
chart(5)=(n^2)
FOR count = 1 TO 5 'loop to print your array
PRINT chart(count)
NEXT
```

I'm not sure about the algorithms you set up, and I don't know the pattern...but if you know the pattern, just substitute the equations in place of my equations. (it helps to know a bit about algebra, it can greatly help you set up algorithms.)

Fruit Pickin'

Those are polynomial vertieces.

Let's see:

f(x)=ax?+bx+c

Use the power rule and you get:

where the highest number = -b/(2a), if it's just a parabola.

So, if f(x)=A*X^N +B*X^(N-1) +...+Y*X^2+Z*X+C

then all of the high/low points are:

A*N*X^(N-1)+B*(N-1)*X^(N-2)+...+2*Y*X+Z=0

In theory, the computer

*could*solve it, but it would be a monster. Not to mention debugging.

It's soemthing along the lines of f(x+1)-f(x)=f'(x), but with rounding (I think, but it might be some higher order polynomial, in which case it's

just plug and chug)

So ax?+bx+c=f(x+1)-f(x)

...

Now I'm stuck .

You need to find f(x), and then find the data after the last.

I saw a way to do it with matricies. Graphing calculators can also do it in a cinch.

Also, I must admit I'm not quite sure how Mentat realized that those are polynomial.

Also, I must admit I'm not quite sure how Mentat realized that those are polynomial.

Do the wave.

Here's are rough sketch of a graph:

1) _/\

2) /^\

3) ---\

4) \_/

5) /^\_/

My text art is horrible but the data basicaly goes up and down.

For any grievances posted above, I blame whoever is in charge . . .

### Re: Prog Help plz

Well, you say you are out of practice programming. Maybe so, but this is not a programming problem. It is a mathematics/statistics problem. And my guess is that it has no solution.Disk1of64 wrote: 1)24,24,26,28,27,(predict the next number)

2)27,30,30,29,24,(predict the next number)

3)29,29,29,29,25,(predict the next number)

4)30,24,25,26,27,(predict the next number)

5)27,28,28,24,26,(predict the next number)

You must know the formula that produced those numbers. As a human staring at those sequences, I have no clue. They could well be random numbers.

Take 4) for instance

30, 24,25,26,27

If I HAD to guess, I would say 28. But the series might be

30, 24,25,26,27,31,25,26,27,28,32,26,....

or

30, 24,25,26,27,26,25,24,30,24,25......

So before anyone can write a program, one has to know how to solve the problem without a computer.

Writing programs is easy. Solving problems is tough. Write a program to predict the stock market tomorrow. Easy if you first tell me how to predict the stock market tomorrow.

Mac

Any finite set of data can be modeled by an infinite set of functions.

Humans pick the functions by what we know and what seems more efficient. Computers don't have base 'intuition' and so try to do it the way humans do it: picking what's been programmed.

For example:

1,2,3,4,5,_

You'd say six. But there are an infinite amount of answers. But six is a good number.

Think of it this way: using the simplest polynomial, you could have numbers going through all points certain angles. Add more terms, change the cofficients, and lines go through same points, but at different angles. Since there are an infinite amount of slopes/angles, there are an infinite amount of possibilities.

But it isn't impossible.

Humans pick the functions by what we know and what seems more efficient. Computers don't have base 'intuition' and so try to do it the way humans do it: picking what's been programmed.

For example:

1,2,3,4,5,_

You'd say six. But there are an infinite amount of answers. But six is a good number.

Think of it this way: using the simplest polynomial, you could have numbers going through all points certain angles. Add more terms, change the cofficients, and lines go through same points, but at different angles. Since there are an infinite amount of slopes/angles, there are an infinite amount of possibilities.

But it isn't impossible.

For any grievances posted above, I blame whoever is in charge . . .

Couldn?t one use some form of neural network to make predictions? Are there any written for Qb?

________

Hysterectomy forums

________

Hysterectomy forums

Last edited by nyfiken on Tue Feb 15, 2011 10:32 pm, edited 1 time in total.

- Raspberrypicker
- Veteran
**Posts:**55**Joined:**Thu Aug 02, 2007 4:54 pm**Location:**Florida