Skip to content

Instantly share code, notes, and snippets.

@dha-lo-jd
Last active January 1, 2016 08:59
Show Gist options
  • Save dha-lo-jd/8121836 to your computer and use it in GitHub Desktop.
Save dha-lo-jd/8121836 to your computer and use it in GitHub Desktop.
f = function(x){
if(-7 < x && x < 7){
p = Math.ceil(Math.abs(x) * 10) % 4
d = 10;
ds = 1;
if(p % 2 == 0){
if(-5 < x && x < 5){
if(p == 0){
d = 5;
}
}else{
if(p == 0){
return 0;
}
}
}else{
if(p == 1){
d = 5;
ds = -1;
}else{
ds = -1;
}
}
s = Math.acos(x/d)
y = Math.sin(s);
return y * d * ds;
}else{
p = Math.ceil(Math.abs(x) * 10) % 3
if(p == 2){
return -x;
}else if(p == 1){
return 0;
}else if(p == 0){
return x;
}
}
};
f = function(x){
p = Math.ceil(Math.abs(x) * 10) % 4
d = 10;
ds = 1;
if(-5 < x && x < 5){
if(p % 2 == 0){
if(p == 0){
d = 5;
}
}else{
if(p == 1){
d = 5;
ds = -1;
}else{
ds = -1;
}
}
}else{
if(p % 2 == 0){
ds = -1;
}
}
s = Math.acos(x/d)
y = Math.sin(s);
return y * d * ds;
};
f = function(x){
r = 10;
s = Math.acos(x/10)
y = Math.sin(s);
if(Math.ceil(x * 10) % 2 == 0){
return y * 10;
}else{
return -y * 10;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment