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
#- | |
#include `NAME_' # time | |
Off stats; | |
CF num; | |
S ep,n1,...,n14; | |
L F1 = | |
+(n1)^3*(n4)^2*(n5)^11*(n6)^14*(n7)^6*(n8)^15*(n9)^12*(- | |
35184372088832)*(-1+n5)*(1+n9)*(5-11*n9+n9^2-13*n8+2*n8*n9+2*n8^2 | |
-9*n7+3*n7*n9+3*n7*n8+2*n7^2+n6-14*n5+2*n5*n9+5*n5*n8+3*n5*n7+n5* | |
n6+2*n5^2-14*n4+5*n4*n9+7*n4*n8+6*n4*n7-2*n4*n6+5*n4*n5+6*n4^2+n3 |
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
(* | |
* Tested in v5.1, v5.2, v6.0.3, v7.0.1, v8.0.4 and v9.0.1. | |
* It is said that Wolfram changed the way how Series works between v5.0 and | |
* v5.1, but I don't have any working binaries of <= v5.0 for now. | |
*) | |
ExplicitFunc[x_] := 1/x^3 Log[1-x]; | |
Series[ExplicitFunc[x], {x, 0, 3}] // Print; | |
Series[Log[1-x] ExplicitFunc[x], {x, 0, 3}] // Print; |
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
(* https://news.ycombinator.com/item?id=7144616 *) | |
SplitDigits[x_, n_, m_] := Module[{a}, | |
a = RealDigits[FractionalPart[N[x, n + 1]]]; | |
a = Join[ConstantArray[0, -a[[2]]], a[[1]]]; | |
a = Drop[a, -1]; | |
a = ToString /@ a; | |
a = Partition[a, m]; | |
a = (StringJoin @@ # &) /@ a; | |
a = ToExpression /@ 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
(* The following pattern matching freezes Mathematica v9.0.1 Linux x86-64. *) | |
MatchQ[{1}, {m_Integer..., ml_Integer /; ml != 0}] | |
(* The following is OK. *) | |
MatchQ[{1}, {_Integer..., ml_Integer /; ml != 0}] |
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
BeginPackage["MyPackage`"]; | |
Unprotect["MyPackage`*"]; | |
ClearAll["MyPackage`*", "MyPackage`Private`*"]; | |
(******************************************************************************) | |
MyAdd::usage = "MyAdd[a,b] returns a+b."; | |
Begin["`Private`"]; |
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
GlobalFlag[name_String] := Module[{s}, | |
s = "Global`" <> name; | |
If[NameQ[s], | |
TrueQ[Symbol[s]] | |
, | |
False | |
] | |
]; | |
GlobalValue[name_String, default_:0] := Module[{s}, |
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
(* | |
* Fast factoring out irrelevant factors. | |
* | |
* In a test environment, the first one takes about 50 seconds, while | |
* the second one takes < 0.01 seconds. | |
*) | |
Clear[NewIntegrate1]; | |
Clear[NewIntegrate2]; | |
NewIntegrate1[c_ f_., x_] := c NewIntegrate1[f, x] /; |
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
#!/bin/sh | |
set -e | |
#sudo apt-get clean | |
kbytes=`df -P -k | grep /dev/sda1 | sed 's/ */ /g' | cut -d ' ' -f 4` | |
size=`expr $kbytes - 10` | |
file=tmp_zero$$ | |
dd if=/dev/zero of=$file bs=1k count=$size | |
rm $file |
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
* Procedures converting f(n) to the corresponding Fibonacci number: | |
* F(1) = 1, F(2) = 1, F(n+2) = F(n) + F(n+1). | |
S fibN,fibX1,fibX2; | |
CF fibF; | |
* A straightforward implementation using the downward recursion. | |
* It generates many terms exponentially and becomes very slow for large n. | |
* | |
#procedure Fibonacci1(f) |
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
#!/usr/bin/python | |
from xml.etree.ElementTree import * | |
from optparse import OptionParser | |
def get_xypoints(node): | |
xpoints = [] | |
ypoints = [] | |
for e in node.findall(".//void[@class='java.awt.Point'][@method='getField']"): | |
e_name = e.find("string") |
OlderNewer