/usr/share/doc/axiom-doc/hypertex/bcmatrix.xhtml is in axiom-hypertex-data 20120501-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | <?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:m="http://www.w3.org/1998/Math/MathML">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="us-ascii"/>
<title>Axiom Documentation</title>
<style>
html {
background-color: #ECEA81;
}
body {
margin: 0px;
padding: 0px;
}
div.command {
color:red;
}
div.center {
color:blue;
}
div.reset {
visibility:hidden;
}
div.mathml {
color:blue;
}
input.subbut {
background-color:#ECEA81;
border: 0;
color:green;
font-family: "Courier New", Courier, monospace;
}
input.noresult {
background-color:#ECEA81;
border: 0;
color:black;
font-family: "Courier New", Courier, monospace;
}
span.cmd {
color:green;
font-family: "Courier New", Courier, monospace;
}
pre {
font-family: "Courier New", Courier, monospace;
}
</style>
<script type="text/javascript">
<![CDATA[
function byformula() {
// find out how many rows and columns, must be positive and nonzero
var rcnt = parseInt(document.getElementById('rowcnt').value);
if (rcnt <= 0) {
alert("Rows must be positive and non-zero -- defaulting to 1");
rcnt = 1;
document.getElementById('rowcnt').value=1;
return(false);
}
var ccnt = parseInt(document.getElementById('colcnt').value);
if (ccnt <= 0) {
alert("Columns must be positive and non-zero -- defaulting to 1");
ccnt = 1;
document.getElementById('colcnt').value=1;
return(false);
}
// remove the question and the buttons
var quest = document.getElementById('question');
var clicks = document.getElementById('clicks');
quest.removeChild(clicks);
var tbl = document.getElementById('form2');
var tblsize = tbl.rows.length;
// make the row variable question
// row variable left cell
var row = tbl.insertRow(tblsize);
var cell = row.insertCell(0);
var tnode = document.createTextNode("Enter the row variable");
cell.appendChild(tnode);
// row variable right cell
cell = row.insertCell(1);
tnode = document.createElement('input');
tnode.type = 'text';
tnode.name = 'rowvar';
tnode.id = 'rowvar';
tnode.size=10;
tnode.value='i';
tnode.tabindex=21;
cell.appendChild(tnode);
// make the column variable question
// column variable left cell
tblsize = tblsize + 1;
row = tbl.insertRow(tblsize);
cell = row.insertCell(0);
tnode = document.createTextNode("Enter the column variable");
cell.appendChild(tnode);
// column variable right cell
cell = row.insertCell(1);
tnode = document.createElement('input');
tnode.type = 'text';
tnode.name = 'colvar';
tnode.id = 'colvar';
tnode.size=10;
tnode.tabindex=22;
tnode.value='j';
cell.appendChild(tnode);
// make the formula question
// column variable left cell
tblsize = tblsize + 1;
row = tbl.insertRow(tblsize);
cell = row.insertCell(0);
tnode = document.createTextNode("Enter the formulas for the elements");
cell.appendChild(tnode);
// formula input field
tblsize = tblsize + 1;
row = tbl.insertRow(tblsize);
cell = row.insertCell(0);
tnode = document.createElement('input');
tnode.type = 'text';
tnode.name = 'formula1';
tnode.id = 'formula1';
tnode.size=50;
tnode.value = '1/(x-i-j-1)';
tnode.tabindex=23;
cell.appendChild(tnode);
// insert the continue button
tblsize = tblsize + 1;
row = tbl.insertRow(tblsize);
cell = row.insertCell(0);
tnode = document.createElement('input');
tnode.type = 'button';
tnode.id = 'contbutton';
tnode.value = 'Continue';
tnode.setAttribute("onclick","makeRequest('formula');");
tnode.tabindex=24;
cell.appendChild(tnode);
return(false);
}
function byelement() {
// find out how many rows and columns, must be positive and nonzero
var rcnt = parseInt(document.getElementById('rowcnt').value);
if (rcnt <= 0) {
alert("Rows must be positive and non-zero -- defaulting to 1");
rcnt = 1;
document.getElementById('rowcnt').value=1;
return(false);
}
var ccnt = parseInt(document.getElementById('colcnt').value);
if (ccnt <= 0) {
alert("Columns must be positive and non-zero -- defaulting to 1");
ccnt = 1;
document.getElementById('colcnt').value=1;
return(false);
}
// remove the question and the buttons
var quest = document.getElementById('question');
var clicks = document.getElementById('clicks');
quest.removeChild(clicks);
// write "Elements"
var tbl = document.getElementById('form2');
var tblsize = tbl.rows.length;
var row = tbl.insertRow(tblsize);
var thecell = row.insertCell(0);
var tnode = document.createTextNode("Elements");
thecell.appendChild(tnode);
// create input boxes for the matrix values
tblsize = tblsize + 1;
for (var i = 0 ; i < rcnt ; i++) {
row = tbl.insertRow(tblsize);
for (var j = 0 ; j < ccnt ; j++) {
thecell = row.insertCell(j);
tnode = document.createElement('input');
tnode.type = 'text';
tnode.name = 'a'+i+'c'+j;
tnode.id = 'a'+i+'c'+j;
tnode.size=10;
tnode.tabindex=20+(i*10)+j;
thecell.appendChild(tnode);
}
tblsize = tblsize + 1;
}
// insert the continue button
row = tbl.insertRow(tblsize);
thecell = row.insertCell(0);
tnode = document.createElement('input');
tnode.type = 'button';
tnode.id = 'contbutton';
tnode.value = 'Continue';
tnode.setAttribute("onclick","makeRequest('element');");
thecell.appendChild(tnode);
return(false);
}
function commandline(arg) {
if (arg == 'element') {
var rcnt = parseInt(document.getElementById('rowcnt').value);
var ccnt = parseInt(document.getElementById('colcnt').value);
var cmdhead = 'matrix([';
var cmdtail = '])';
for (var i = 0 ; i < rcnt ; i++) {
var listbody = '[';
for (var j = 0 ; j < ccnt ; j++) {
var aij = document.getElementById('a'+i+'c'+j).value;
listbody = listbody+aij;
if (j != (ccnt - 1)) {
listbody = listbody+',';
}
}
listbody = listbody+']';
if (i != (rcnt - 1)) {
listbody = listbody+',';
}
cmdhead = cmdhead+listbody;
}
cmd = cmdhead+cmdtail;
return(cmd);
} else {
var rcnt = parseInt(document.getElementById('rowcnt').value);
var ccnt = parseInt(document.getElementById('colcnt').value);
var cmdhead = 'matrix([[';
var cmdtail = '])';
var formula = document.getElementById('formula1').value;
var rowv = document.getElementById('rowvar').value;
var colv = document.getElementById('colvar').value;
var cmd = cmdhead+formula+' for '+colv+' in 1..'+ccnt+']'+
' for '+rowv+' in 1..'+rcnt+cmdtail;
return(cmd);
}
}
]]>
// The structure returned from Axiom now is
// <div class="stepnum"></div>
// <div class="command"></div>
// <div class="algebra"></div>
// <div class="mathml"></div>
// <div class="type"></div>
// This function will format the output as a console session
<![CDATA[
function showanswer(mathString,indiv) {
var mystr = mathString.split("</div>");
// first we prepare the step number
var mystept1 = mystr[0].lastIndexOf(">");
var mystepstr = mystr[0].substr(mystept1+1);
// now we get the command
var mycmdt1 = mystr[1].lastIndexOf(">");
var mycmdstr = mystr[1].substr(mycmdt1+1);
var myprompt = '('+mystepstr+') -> '+mycmdstr;
// now we handle the mathml
var mymathstr = mystr[3].concat("</div>");
// and the type, we need to insert the string "Type: "
var mytypet1 = mystr[4].lastIndexOf(">");
var mytypet2 = mystr[4].substr(mytypet1+1).concat("</div>");
var mytypestr = '<div> Type: '.concat(mytypet2);
// bang the whole thing together
var finaldiv='<div class="command">'+myprompt+'</div>'+mymathstr+mytypestr;
// this turns the string into a dom fragment
var mathRange = document.createRange();
var mathBox=document.createElementNS('http://www.w3.org/1999/xhtml','div');
mathRange.selectNodeContents(mathBox);
var answer = mathRange.createContextualFragment(finaldiv);
mathBox.appendChild(answer);
// and we stick the result into the requested div block as a child.
var mathAns = document.getElementById(indiv);
mathAns.removeChild(mathAns.firstChild);
mathAns.appendChild(mathBox);
}
]]>
<![CDATA[
function ignoreResponse() {}
function resetvars() {
http_request = new XMLHttpRequest();
http_request.open('POST', '127.0.0.1:8085', true);
http_request.onreadystatechange = ignoreResponse;
http_request.setRequestHeader('Content-Type', 'text/plain');
http_request.send("command=)clear all");
return(false);
}
]]>
function init() {
}
function makeRequest(arg) {
http_request = new XMLHttpRequest();
var command = commandline(arg);
//alert(command);
http_request.open('POST', '127.0.0.1:8085', true);
http_request.onreadystatechange = handleResponse;
http_request.setRequestHeader('Content-Type', 'text/plain');
http_request.send("command="+command);
return(false);
}
function lispcall(arg) {
http_request = new XMLHttpRequest();
var command = commandline(arg);
//alert(command);
http_request.open('POST', '127.0.0.1:8085', true);
http_request.onreadystatechange = handleResponse;
http_request.setRequestHeader('Content-Type', 'text/plain');
http_request.send("lispcall="+command);
return(false);
}
function showcall(arg) {
http_request = new XMLHttpRequest();
var command = commandline(arg);
//alert(command);
http_request.open('POST', '127.0.0.1:8085', true);
http_request.onreadystatechange = handleResponse;
http_request.setRequestHeader('Content-Type', 'text/plain');
http_request.send("showcall="+command);
return(false);
}
function interpcall(arg) {
http_request = new XMLHttpRequest();
var command = commandline(arg);
//alert(command);
http_request.open('POST', '127.0.0.1:8085', true);
http_request.onreadystatechange = handleResponse;
http_request.setRequestHeader('Content-Type', 'text/plain');
http_request.send("interpcall="+command);
return(false);
}
function handleResponse() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
showanswer(http_request.responseText,'mathAns');
} else
{
alert('There was a problem with the request.'+ http_request.statusText);
}
}
}
</script>
</head>
<body>
<div align="center"><img align="middle" src="doctitle.png"/></div>
<hr/>
Enter the size of the matrix:
<table id="form2">
<tr>
<td size="10">Rows</td>
<td><input type="text" id="rowcnt" tabindex="10" size="10" value="2"/></td>
</tr>
<tr>
<td>Columns</td>
<td><input type="text" id="colcnt" tabindex="20" size="10" value="3"/></td>
</tr>
</table>
<div id="question">
<div id="clicks">
How would you like to enter the matrix elements?
<center>
<input type="button" value="By Formula" onclick="byformula();"/>
<input type="button" value="By Element" onclick="byelement();"/>
</center>
</div>
</div>
<div id="mathAns"><div></div></div>
</body>
</html>
|