{ "cells": [ { "cell_type": "code", "execution_count": 38, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "def HighestEntry(Matrix):\n", " List = sorted([Matrix[0,0],Matrix[0,1],Matrix[1,0],Matrix[1,1]])\n", " return List[3]\n", "\n", "def LowestEntry(Matrix):\n", " List = sorted([Matrix[0,0],Matrix[0,1],Matrix[1,0],Matrix[1,1]])\n", " return List[0]" ] }, { "cell_type": "code", "execution_count": 46, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 46, "metadata": { }, "output_type": "execute_result" }, { "name": "stderr", "output_type": "stream", "text": [ "WARNING: Some output was deleted.\n" ] } ], "source": [ "count1 = 0\n", "count2 = 0\n", "\n", "for a in [-20..20]:\n", " A_1 = matrix(QQ,[[a+0,a+1],[a+2,a+3]])\n", " A_2 = matrix(QQ,[[a+0,a+1],[a+3,a+2]])\n", " A_3 = matrix(QQ,[[a+0,a+2],[a+1,a+3]])\n", " A_4 = matrix(QQ,[[a+0,a+2],[a+3,a+1]])\n", " A_5 = matrix(QQ,[[a+0,a+3],[a+1,a+2]])\n", " A_6 = matrix(QQ,[[a+0,a+3],[a+2,a+1]])\n", " A_7 = matrix(QQ,[[a+1,a+2],[a+3,a+0]])\n", " A_8 = matrix(QQ,[[a+1,a+2],[a+0,a+3]])\n", " A_9 = matrix(QQ,[[a+1,a+3],[a+2,a+0]])\n", " A_10 = matrix(QQ,[[a+1,a+3],[a+0,a+2]])\n", " A_11 = matrix(QQ,[[a+1,a+0],[a+2,a+3]])\n", " A_12 = matrix(QQ,[[a+1,a+0],[a+3,a+2]])\n", " A_13 = matrix(QQ,[[a+2,a+0],[a+1,a+3]])\n", " A_14 = matrix(QQ,[[a+2,a+0],[a+3,a+1]])\n", " A_15 = matrix(QQ,[[a+2,a+1],[a+0,a+3]])\n", " A_16 = matrix(QQ,[[a+2,a+1],[a+3,a+0]])\n", " A_17 = matrix(QQ,[[a+2,a+3],[a+1,a+0]])\n", " A_18 = matrix(QQ,[[a+2,a+3],[a+0,a+1]])\n", " A_19 = matrix(QQ,[[a+3,a+0],[a+2,a+1]])\n", " A_20 = matrix(QQ,[[a+3,a+0],[a+1,a+2]])\n", " A_21 = matrix(QQ,[[a+3,a+1],[a+2,a+0]])\n", " A_22 = matrix(QQ,[[a+3,a+1],[a+0,a+2]])\n", " A_23 = matrix(QQ,[[a+3,a+2],[a+1,a+0]])\n", " A_24 = matrix(QQ,[[a+3,a+2],[a+0,a+1]])\n", " A = [A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11,A_12,A_13,A_14,A_15,A_16,A_17,A_18,A_19,A_20,A_21,A_22,A_23,A_24]\n", "\n", " for b in [-20..20]:\n", " B_1 = matrix(QQ,[[b+0,b+1],[b+2,b+3]])\n", " B_2 = matrix(QQ,[[b+0,b+1],[b+3,b+2]])\n", " B_3 = matrix(QQ,[[b+0,b+2],[b+1,b+3]])\n", " B_4 = matrix(QQ,[[b+0,b+2],[b+3,b+1]])\n", " B_5 = matrix(QQ,[[b+0,b+3],[b+1,b+2]])\n", " B_6 = matrix(QQ,[[b+0,b+3],[b+2,b+1]])\n", " B_7 = matrix(QQ,[[b+1,b+2],[b+3,b+0]])\n", " B_8 = matrix(QQ,[[b+1,b+2],[b+0,b+3]])\n", " B_9 = matrix(QQ,[[b+1,b+3],[b+2,b+0]])\n", " B_10 = matrix(QQ,[[b+1,b+3],[b+0,b+2]])\n", " B_11 = matrix(QQ,[[b+1,b+0],[b+2,b+3]])\n", " B_12 = matrix(QQ,[[b+1,b+0],[b+3,b+2]])\n", " B_13 = matrix(QQ,[[b+2,b+0],[b+1,b+3]])\n", " B_14 = matrix(QQ,[[b+2,b+0],[b+3,b+1]])\n", " B_15 = matrix(QQ,[[b+2,b+1],[b+0,b+3]])\n", " B_16 = matrix(QQ,[[b+2,b+1],[b+3,b+0]])\n", " B_17 = matrix(QQ,[[b+2,b+3],[b+1,b+0]])\n", " B_18 = matrix(QQ,[[b+2,b+3],[b+0,b+1]])\n", " B_19 = matrix(QQ,[[b+3,b+0],[b+2,b+1]])\n", " B_20 = matrix(QQ,[[b+3,b+0],[b+1,b+2]])\n", " B_21 = matrix(QQ,[[b+3,b+1],[b+2,b+0]])\n", " B_22 = matrix(QQ,[[b+3,b+1],[b+0,b+2]])\n", " B_23 = matrix(QQ,[[b+3,b+2],[b+1,b+0]])\n", " B_24 = matrix(QQ,[[b+3,b+2],[b+0,b+1]])\n", " B=[B_1,B_2,B_3,B_4,B_5,B_6,B_7,B_8,B_9,B_10,B_11,B_12,B_13,B_14,B_15,B_16,B_17,B_18,B_19,B_20,B_21,B_22,B_23,B_24]\n", "\n", " for i in [0..23]:\n", " for j in [0..23]:\n", " C = A[i]*B[j]\n", " C_List = sorted([C[0,0], C[0,1], C[1,0], C[1,1]])\n", " count1 = count1 + 1\n", " if (C_List[0] +1 == C_List[1]) and (C_List[1] +1 == C_List[2]) and (C_List[2] +1 == C_List[3]):\n", " count2 = count2 + 1\n", " show(count2,'.........',A[i],B[j],'=',C)" ] }, { "cell_type": "code", "execution_count": 40, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 40, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 40, "metadata": { }, "output_type": "execute_result" }, { "data": { "text/html": [ "" ] }, "execution_count": 40, "metadata": { }, "output_type": "execute_result" } ], "source": [ "show(count1)\n", "show(count2)\n", "show(RR(count2/count1))" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ "lowestInA = LowestEntry(A[i])\n", " lowestInB = LowestEntry(B[j])\n", " highestInA = HighestEntry(A[i])\n", " highestInB = HighestEntry(B[j])\n", " if Alowest > lowestInA:\n", " count2 = count2 + 1\n", " show(count2,'.........',A[i],B[j],'=',C)\n", " Alowest = lowestInA\n", " if Blowest > lowestInB:\n", " count2 = count2 + 1\n", " show(count2,'.........',A[i],B[j],'=',C)\n", " Blowest = lowestInB\n", " if Ahighest < highestInA:\n", " count2 = count2 + 1\n", " show(count2,'.........',A[i],B[j],'=',C)\n", " Alowest = lowestInA\n", " if Bhighest < lowestInB:" ] }, { "cell_type": "code", "execution_count": 0, "metadata": { "collapsed": false }, "outputs": [ ], "source": [ ] } ], "metadata": { "kernelspec": { "display_name": "SageMath (stable)", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.15" } }, "nbformat": 4, "nbformat_minor": 0 }