• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

need help with a math problem

kingpaul

First Post
I have this matrix that I'm trying to reduce to a formula, if possible. Its not a school project, its for a pet project. X and y are the variables, and the numbers in the table itself are the results. Can someone help me out? Thanks in advance.

Code:
	x
y	1	2	3	4	5	6	7	8	9	10
0	0	0	0	0	0	0	0	0	0	0
1	1	1	1	1	1	1	1	1	1	1
2	1	4	4	4	4	4	4	4	4	4
3	1	4	9	9	9	9	9	9	9	9
4	1	4	9	16	16	16	16	16	16	16
5	3	6	11	18	27	27	27	27	27	27
6	3	8	13	20	29	40	40	40	40	40
7	3	8	15	22	31	42	55	55	55	55
8	3	8	15	24	33	44	57	72	72	72
9	5	10	17	26	37	48	61	76	95	95
10	5	12	19	28	39	52	65	80	99	120
11	5	12	21	30	41	54	69	84	103	124
12	5	12	21	32	43	56	71	88	107	128
13	7	14	23	34	47	60	75	92	113	134
14	7	16	25	36	49	64	79	96	117	140
15	7	16	27	38	51	66	83	100	121	144
 

log in or register to remove this ad



die_kluge said:
Not sure how to read that. Use a few of them in a sentence.

When X is ? and Y is ? the answer is ?
A fair question

When X is 10 and Y is 15, the answer is 144
When X is 6 and Y is 10, the answer is 52
When X is 3 and Y is 12, the answer is 21

That help?
 

For Y<5, Z=Max(X²,Y²)
Probably the rest of it can be simplified considerably with a MAX operation, but reducing this matrix to a different representation is a waste of time, if you're talking about computer code.
 
Last edited by a moderator:

tarchon said:
For Y<5, Z=Max(X²,Y²)
Thank you.
tarchon said:
Probably the rest of it can be simplified considerably with a MAX operation, but reducing this matrix to a different representation is a waste of time, if you're talking about computer code.
Why do you say it would be a waste of time?
 
Last edited:


I think a similar progression works, but it involves something like:

min(x^2, y^2) +2, +4, +6, +8, +10, +12
Then it skips to +18, +24, +28, +34 or something like that. It's kind of strange.

For example, when X is 10:

y=1->4 =MIN(10^2, A3^2)
y=5 =MIN(10^2, A8^2)+2
y=6 =MIN(10^2, A8^2)+4
y=7 =MIN(10^2, A8^2)+6
y=8 =MIN(10^2, A8^2)+8
y=9 =MIN(10^2, A8^2)+14
y=10 =MIN(10^2, A8^2)+20
y=11 =MIN(10^2, A8^2)+24
y=12 =MIN(10^2, A8^2)+28
y=13 =MIN(10^2, A8^2)+34
y=14 =MIN(10^2, A8^2)+40
y=15 =MIN(10^2, A8^2)+44

But this progression (24, 28, 34, 40, etc) is not the same for all values.
For example, when x is 9, the progression is 2,4,6,8,12,18,22,26,32,36,40.
 

kingpaul said:
Why do you say it would be a waste of time?
To save having to use a 150 byte array? Pretty much any formula you come up with will take more memory and probably longer to execute than a lookup table of that size will. Maybe if you coded something in assembler it could be marginally more efficient but hardly worth the effort unless it's for some awfully tight embedded application.

Yeah, it is Min, not Max.
 

tarchon said:
To save having to use a 150 byte array? Pretty much any formula you come up with will take more memory and probably longer to execute than a lookup table of that size will.
Does it help if I a) make a slight correction to the table (guess I did some adding wrong) and b) show what exactly I'm trying to calculate, since the table expands in both directions.

Code:
Base	Psion level - bonus power points/level									
stat	1-2	3-4	5-6	7-8	9-10	11-12	13-14	15-16	17-18	19-20
10-11	0	0	0	0	0	0	0	0	0	0
12-13	1	0	0	0	0	0	0	0	0	0
14-15	1	3	0	0	0	0	0	0	0	0
16-17	1	3	5	0	0	0	0	0	0	0
18-19	1	3	5	7	0	0	0	0	0	0
20-21	3	3	5	7	9	0	0	0	0	0
22-23	3	5	5	7	9	11	0	0	0	0
24-25	3	5	7	7	9	11	13	0	0	0
26-27	3	5	7	9	9	11	13	15	0	0
28-29	5	5	7	9	11	11	13	15	17	0
30-31	5	7	7	9	11	13	13	15	17	19
32-33	5	7	9	9	11	13	15	15	17	19
34-35	5	7	9	11	11	13	15	17	17	19
36-37	7	7	9	11	13	13	15	17	19	19
38-39	7	9	9	11	13	15	15	17	19	21
40-41	7	9	11	11	13	15	17	17	19	21

Code:
Base	Psion level - total bonus power points									
stat	1-2	3-4	5-6	7-8	9-10	11-12	13-14	15-16	17-18	19-20
10-11	0	0	0	0	0	0	0	0	0	0
12-13	1	1	1	1	1	1	1	1	1	1
14-15	1	4	4	4	4	4	4	4	4	4
16-17	1	4	9	9	9	9	9	9	9	9
18-19	1	4	9	16	16	16	16	16	16	16
20-21	3	6	11	18	27	27	27	27	27	27
22-23	3	8	13	20	29	40	40	40	40	40
24-25	3	8	15	22	31	42	55	55	55	55
26-27	3	8	15	24	33	44	57	72	72	72
28-29	5	10	17	26	37	48	61	76	93	93
30-31	5	12	19	28	39	52	65	80	97	116
32-33	5	12	21	30	41	54	69	84	101	120
34-35	5	12	21	32	43	56	71	88	105	124
36-37	7	14	23	34	47	60	75	92	111	130
38-39	7	16	25	36	49	64	79	96	115	136
40-41	7	16	27	38	51	66	83	100	119	140
 
Last edited:

Into the Woods

Remove ads

Top