This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Exact computation to solve http://math.stackexchange.com/q/688861/35416, | |
| # heavily inspired by https://groups.google.com/d/msg/sci.math/LYtIdRhk2ac/mQtEBcgCjZkJ | |
| def printPoly(name, poly): | |
| print(name + ":") | |
| print(poly.denominator()*poly) | |
| print("") | |
| # a and b are the alpha and beta from http://math.stackexchange.com/a/698656/35416. | |
| # We use approximate values to choose the right alternatives in some situations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import with_statement | |
| import gdb | |
| class EclUtil(object): | |
| def __init__(self, *args, **kwargs): | |
| super(EclUtil, self).__init__(*args, **kwargs) | |
| self.cl_object = gdb.lookup_type("cl_object").strip_typedefs() | |
| self.cl_objectp = self.cl_object.pointer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python3 | |
| # (c) Martin von Gagern 2014 | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions | |
| # are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright | |
| # notice, this list of conditions and the following disclaimer. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fstat(3, {st_mode=S_IFREG|0644, st_size=164, ...}) = 0 | |
| lseek(3, 0, SEEK_CUR) = 0 | |
| +lseek(3, 0, SEEK_CUR) = 0 | |
| fstat(3, {st_mode=S_IFREG|0644, st_size=164, ...}) = 0 | |
| -dup(3) = 4 | |
| -mmap(NULL, 164, PROT_READ, MAP_SHARED, 3, 0) = 0x... | |
| -open("so23434490out.txt", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5 | |
| -fstat(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 | |
| -ioctl(5, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x...) = -1 ENOTTY (Inappropriate ioctl for device) | |
| -fstat(5, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sage: # http://math.stackexchange.com/a/779318/35416 | |
| sage: P1.<x,y,z,w> = QQ[] | |
| sage: p = x^3+y^3+z^3+w*x*y*z | |
| sage: px, py, pz = [P1(p.polynomial(v).differentiate()) for v in [x, y, z]] | |
| sage: px | |
| y*z*w + 3*x^2 | |
| sage: pxy = px.resultant(py, x) | |
| sage: pxz = px.resultant(pz, x) | |
| sage: pxyz = pxy.resultant(pxz, y) | |
| sage: f = pxyz.factor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def rotmat(a, t=(0,0,1), l=False): | |
| # Rotate by a degrees, then shift origin to point t. | |
| # If l=True then transform lines not points. | |
| x, y, z = t | |
| q = QQ(a/360) | |
| w = QQbar.zeta(q.denominator())^(q.numerator()) | |
| c = AA(z*w.real()) | |
| s = AA(z*w.imag()) | |
| m = matrix(AA, [[c, -s, x], [s, c, y], [0, 0, z]]) | |
| if l: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // http://math.stackexchange.com/a/914871/35416 | |
| #include <algorithm> | |
| #include <cassert> | |
| #include <cstdlib> | |
| #include <fstream> | |
| #include <iomanip> | |
| #include <iostream> | |
| #include <limits> | |
| #include <sstream> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Terms for http://math.stackexchange.com/a/1057500/35416 | |
| + 16 z1^2 u2^2 ar^4 | |
| + 32 z1^2 u2 v2 ar^4 | |
| + 16 z1^2 v2^2 ar^4 | |
| + 32 z1^2 u2^2 ar^2 ai^2 | |
| + 64 z1^2 u2 v2 ar^2 ai^2 | |
| + 32 z1^2 v2^2 ar^2 ai^2 | |
| + 16 z1^2 u2^2 ai^4 | |
| + 32 z1^2 u2 v2 ai^4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require("fs"); | |
| var symbols = require("./src/symbols"); | |
| var todo = 0; | |
| var files = fs.readdirSync("static/fonts"); | |
| files.forEach(function(file) { | |
| if (file.substr(file.length - 4) !== ".ttx") | |
| return; | |
| ++todo; | |
| fs.readFile("static/fonts/" + file, "utf-8", doTTX.bind(null, file)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "use strict"; | |
| var fs = require("fs"); | |
| var src = fs.readFileSync("src/Parser.js", "utf-8"); | |
| var match; | |
| var defined = {}; | |
| var callers = {}; | |
| var curMethod = "TOP"; | |
| var re = /Parser\.prototype\.([A-Za-z0-9_]+)|this\.([A-Za-z0-9_]+)/g; |