phbmc

10 Reputation

4 Badges

12 years, 278 days

MaplePrimes Activity


These are replies submitted by phbmc

@Carl Love 

The solutions for a1 and a2 are linear functions of b.

@Carl Love Sorry Carl didn't realise anyone had replied!

Yes, a1 and a2 are variables and b is considered fixed (it is an integer)

These are all independent equations. I reduced a problem into 12 different cases. Each of these equations governs a single case. So I need to solve each of them independently.

I have more equations in a similar format with a3, a4, ... too.

i.e. each variable multipled by some polynomial in b = some other polynomial in b.

a1 p1(b) + a2 p2(b) + a3 p3(b) + ... + an pn(b) = p0(b)

 

 

@tomleslie

Even though I copied and pasted the code, the spaces in the list were omitted.

How would I generate these lists so that I can create L(m,c)?

@Carl Love

Thanks for your input. I have 2 queries. The first is do you know why I am getting errors?

And second, this is part of a bigger problem all dependant on m and c. I have other functions all defined by m and c and it would be useful if possible to keep this function in terms of m and c too. The redundant variables are acting as placeholders. After I have the output to this process I am redefning b_i as linear functions of a_i.

I.e. L(m,c)
L(6,2) = [ [ a1,a2,a,a,b2,b1 ], [a1,a2,a,a,b1,b2], [a1,b1,a,a,a2,b2], [a2,a1,a,a,b1,b2], [a2,a1,a,a,b2,b1] ]
L(7,2) = [ [ a1,a2,a,a,a,b2,b1 ], [a1,a2,a,a,a,b1,b2], [a1,b1,a,a,a,a2,b2], [a2,a1,a,a,a,b1,b2], [a2,a1,a,a,a,b2,b1] ]
L(8,2) = [ [ a1,a2,a,a,a,a,b2,b1 ], [a1,a2,a,a,a,a,b1,b2], [a1,b1,a,a,a,a,a2,b2], [a2,a1,a,a,a,a,b1,b2], [a2,a1,a,a,a,a,b2,b1] ]

If there is anything I can clarify please ask. Thanks, Ben

@Carl Love 

@tomleslie

 

Straightforward answer.

 

So the equation in 2 variables is an order 4 polynomial of the base b.

 

The coefficients are linear combinations of a1 and a2. Due to the nature of my method a1 and a2 are linear functions of b.

If we split a1 into x1 b + y1 and a2 into x2 b + y2. Then we end up with a system of linear equations that is sometimes solvable.

So rather than just getting singular solutions for a particular base. I end up with a family of solutions for each equation.

 

What I am trying to generate is the L Vector for an arbitrary number of variables n. These vectors then correspond to polynomials of order at least 2n so again we have systems of solvable equations.

 

My method should find all fixed points of the algorithm. For any b and m

 

The L Vector essentially boils down to this:

All permutations of a1 ... an and b1 ... bn (perm all 2n variables) then remove permutations where bi is to the left of ai.

 

E.g.

A1 a2 b1 b2 is fine

B1 a1 a2 b2 is bad because b1 is to the left of a1.

 

I think that can be done using the op function then finding the positions of each element in the vector and running a simple if op(b1) < op(a1) *delete row*

 

So for n is 2 there will be 24 permutations only 6 of which are valid.

@tomleslie

My 3rd year project at uni is to study the fixed points of a generalised Kaprekar routine. That is, for any string length m and any base b.

I have reduced the number of degress of freedom by half in a different way to all papers that I ahve read. (I'm trying a different route)

I have proven that all fixed points must be of a certain form. All possible forms make up the R vector, and all possible Descending - Ascending make up the L vector.

Due to the theorems I have produced this list is significantly smaller than upon first reading of the problem.

For example, in base 10 with m = 5, there are 10^5 possible inputs = 100,000.
Using my theorems I have reduced this to only 55 canditates and can tell you exactly what numbers to try.

It then turns out that those 55 candidates are governed by 24 equations in 2 variables and 2 equations in 1 variable. 24 of those equations are created by putting each element of the L vector against an element from the R vector.
So my 6x4 matrix has 24 elements, each of which is an equation that governs potnetial solutions to the fixed point problem.

Example solution:
Solving L[4] = R[2] in the equations I gave above yields the solutions a1 = 3b/5 and a2 = (4b-5)/5
since these solutions are from R[2], this yields the fixed point set​​:
{3032_5, 6174, 92b6_15 ...}

constructed by a1,b-a2-2,a2,b-a1 for any base that is a multiple of 5.

My problem is that I need to generate all these equations and subsequenetly solve them.

@tomleslie 

x__1, x__2, y__1, and y__2 are rational numbers.

For example, I know that the solution to M[4,2] is a__1 = 3b/5 + 0, a__2 = 4b/5 - 1  (I did this one by hand because it corresponds to the motivating example) 7641-1467 = 6147. Here a__1 = 6 and a__2 = 7, yielding b-2-a__2 = 1 and b-a__1 = 4

the variables a__1 and a__2 are digits in base b. They have the restrictions that:
b/2 ≤ a__1 ≤  b-1,
(b-2)/2 ≤ a__2 ≤  b-2

(I actually have way more restrictions but don't know how to use inequalities as limits on a for loop- or if thats even possible.)

@tomleslie Thanks for the help.

When I call M[i,j] it now produces the correct equation (so far so good)

For each element of the matrix I now need solve the polynomial in b. I know that the coefficients a__1 and a__2 are linear functions of b, i.e. a__1 = x__1 b + y__1 and a__2 = x__2 b + y__2 with integer x__i and y__i

Any thoughts?

To clarify the question. I have two vectors:

R := proc (b, a__1, a__2) options operator, arrow; Vector[column](4, [a__1*b^3+a__2*b^2+(b-a__2-2)*b+b-a__1, a__1*b^3+(b-a__2-2)*b^2+a__2*b+b-a__1, (b-a__1)*b^3+a__2*b^2+(b-a__2-2)*b+a__1, (b-a__1)*b^3+(b-a__2-2)*b^2+a__2*b+a__1]) end proc

L := proc (b, a__1, a__2) options operator, arrow; Vector[column](5, [a__1*b^3+a__2*b^2+(b-a__1)*b+b-a__2-2-(b-a__2-2)*b^3-(b-a__1)*b^2-a__2*b-a__1, a__1*b^3+a__2*b^2+(b-a__2-2)*b+b-2*a__1-(b-a__1)*b^3-(b-a__2-2)*b^2-a__2*b, a__1*b^3+(b-a__1)*b^2+a__2*b+b-a__2-2-(b-a__2-2)*b^3-a__2*b^2-(b-a__1)*b-a__1, a__2*b^3+a__1*b^2+(b-a__1)*b+b-2*a__2-2-(b-a__2-2)*b^3-(b-a__1)*b^2-a__1*b, a__2*b^3+a__1*b^2+(b-a__2-2)*b+b-a__1-(b-a__1)*b^3-(b-a__2-2)*b^2-a__1*b-a__2]) end proc

and I am trying to produce a matrix M that is a function of the same 3 variables b, a__1 and a__2 

The elements are created as the ith component of the L vector = jth compononet of the R vector

So the top left element here would be:
L(b,a__1,a__2)[1] = R(b,a__1,a__2)[1]

and the i,j element would be

L(b,a__1,a__2)[i] = R(b,a__1,a__2)[j]

I would then like the ability to call the equation, so:

M(b,a__1,a__2)[1,1] would return L(b,a__1,a__2)[1] = R(b,a__1,a__2)[1] (with the actual equation)

Page 1 of 1