This file contains 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
TO = TermOrder('wdeglex',(100, 10, 10, 1, 1, 1, 1, 1, 1)) | |
PR1.<t, xx, yy, ax, ay, bx, by, cx, cy> = PolynomialRing(QQ, order=TO) | |
var('mu tau') | |
A = vector(PR1, [ax, ay, 1]) | |
B = vector(PR1, [bx, by, 1]) | |
C = vector(PR1, [cx, cy, 1]) | |
D = vector(PR1, [1, t, 0]) | |
E1 = A.cross_product(B).column() * C.cross_product(D).row() | |
E2 = A.cross_product(C).column() * B.cross_product(D).row() | |
F1 = E1 + E1.transpose() |
This file contains 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
/* | |
* Proof of concept for | |
* http://stackoverflow.com/a/17967201/1468366 | |
* http://math.stackexchange.com/a/456233/35416 | |
* | |
* Note: This code was written ONLY to get this single example image. | |
* It makes a number of implicit assumptions, and therefore won't be | |
* fit for general applications without some modifications. | |
* Furthermore, speedy coding was considered more important than | |
* performance at run time. |
This file contains 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: def angle_bisectors(g, h, p = None): | |
... if p is None: | |
... p = g.cross_product(h) | |
... a = (g[0]*h[1] + g[1]*h[0]) | |
... b = 2*(g[0]*h[0] - g[1]*h[1]) | |
... c = -a | |
... d = sqrt(b^2 - 4*a*c) | |
... r = [b + d, b - d] | |
... r = [vector(SR, [i, 2*a, 0]) for i in r] | |
... r = [i.cross_product(p) for i in r] |
This file contains 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
<?php | |
// This map would show Germany: | |
$south = deg2rad(50.6); | |
$north = deg2rad(50.8); | |
$west = deg2rad(7); | |
$east = deg2rad(7.25); | |
// This also controls the aspect ratio of the projection | |
$width = 100; |
This file contains 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
<?php | |
// This map would show Germany: | |
$south = deg2rad(47.2); | |
$north = deg2rad(55.2); | |
$west = deg2rad(5.8); | |
$east = deg2rad(15.2); | |
// This also controls the aspect ratio of the projection | |
$width = 1000; |
This file contains 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
failrun: fixrun | |
@echo "" | |
./a | |
FINDLIBPTHREAD=ldd c.so | awk '/libpthread.so/{print $$3}' | head -n1 | |
fixrun: suceedrun | |
@echo "" | |
LD_PRELOAD='$(shell $(FINDLIBPTHREAD))' ./a |
This file contains 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
[[-268976423, -1041068828], | |
[287927556, -823085024], | |
[582279163, -505571674], | |
[819462839, -173345367], | |
[1052940007, 159999717], | |
[905221059, 588231118], | |
[594051833, 782699842], | |
[405217384, 822595358], | |
[94700867, 805634136], | |
[-175966121, 643525529], |
This file contains 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
import sys | |
import subprocess | |
import io | |
class PacketReader(object): | |
packetTagNames = { | |
0: 'Reserved - a packet tag MUST NOT have this value', | |
1: 'Public-Key Encrypted Session Key Packet', | |
2: 'Signature Packet', |
This file contains 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
# See http://math.stackexchange.com/q/684834/35416 for details | |
var('a b x y r d') | |
var('R1', latex_name='R') | |
var('R2', latex_name="R'") | |
# The following two antiderivatives were found by Wolfram Alpha | |
upperArc(x) = -(b*arctan((b*x)/(sqrt(b^2-r^2)*sqrt(r^2-x^2))))/sqrt(b^2-r^2)+(b*arctan(x/sqrt(b^2-r^2)))/sqrt(b^2-r^2)+arctan(x/sqrt(r^2-x^2)) | |
lowerArc(x) = (-sqrt(b^2-r^2)*arctan(x/sqrt(r^2-x^2))+b*arctan((b*x)/(sqrt(b^2-r^2)*sqrt(r^2-x^2)))+b*arctan(x/sqrt(b^2-r^2)))/sqrt(b^2-r^2) | |
y1 = cosh(R1) | |
r1 = sinh(R1) | |
y2 = (cosh(d)+sinh(d))*cosh(R2) |
This file contains 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
# This is an attempt to obtain numeric results for | |
# http://math.stackexchange.com/q/688861/35416 | |
# but the computation is smbolic since I'll want a derivative later on | |
a = var('a', latex_name='\\alpha', domain='positive') | |
b = var('b', latex_name='\\beta', domain='positive') | |
a0 = RDF(0.14778) | |
b0 = RDF(0.77656) | |
SRmu.<mu> = SR[] | |
farpoint1 = vector([1, b, 0]) |
OlderNewer