Comments (4)
This is me playing around with a loop verision.
I like the line better as chainrules don't work in unending loops
const bridge_len = 50
function loop(jiggle=0)
shaky_rotate(θ) = rotate(θ + jiggle*(rand()-0.5))
### 1
shaky_rotate(0)
sethue(Luxor.julia_red)
translate(0,-150);
link()
m1 = getmatrix()
### 2
sethue(Luxor.julia_green)
translate(-50, 130);
shaky_rotate(2π/3);
link()
m2 = getmatrix()
setmatrix(m1)
sethue(Luxor.julia_red)
overlap(-1.3π)
setmatrix(m2)
### 3
translate(-50, 130);
shaky_rotate(2π/3);
sethue(Luxor.julia_purple)
link()
setmatrix(m2)
setcolor(Luxor.julia_green)
overlap(0.7π)
setmatrix(m1)
sethue(Luxor.julia_red)
nega_overlap(π)
end
function nega_overlap(ang_end)
sector(Point(0, 0), 50, 90, ang_end, -0., :fill)
sethue("black")
arc(Point(0, 0), 50, ang_end, 0, :stoke)
move(Point(90, 0))
carc(Point(0, 0), 90, 0, ang_end, :stoke)
strokepath()
#arc(Point(0, bridge_len), 50, ang_end, 0, :stoke)
end
@svg begin
rotate(π/2)
loop()
end
from chainrules.jl.
These are great! It’s very satisfying to see what a really maths-capable user can do with this stuff. 😂
To get a transparent background for an icon you’ll have to replace the @svg...end
construct with:
Drawing()
origin()
...
finish()
preview()
from chainrules.jl.
A version with a border on the links
const bridge_len = 50
function chain(jiggle=0)
shaky_rotate(θ) = rotate(θ + jiggle*(rand()-0.5))
### 1
shaky_rotate(0)
sethue(Luxor.julia_red)
translate(0,-150);
link()
m1 = getmatrix()
### 2
sethue(Luxor.julia_green)
translate(-50, 130);
shaky_rotate(π/3);
link()
m2 = getmatrix()
setmatrix(m1)
sethue(Luxor.julia_red)
overlap(-1.3π)
setmatrix(m2)
### 3
shaky_rotate(-π/3);
translate(-120,80);
sethue(Luxor.julia_purple)
link()
setmatrix(m2)
setcolor(Luxor.julia_green)
overlap(-1.5π)
end
function link()
sector(50, 90, π, 0, :fill)
sector(Point(0, bridge_len), 50, 90, 0, -π, :fill)
rect(50,-3,40, bridge_len+6, :fill)
rect(-50-40,-3,40, bridge_len+6, :fill)
sethue("black")
move(Point(-50, bridge_len))
arc(Point(0,0), 50, π, 0, :stoke)
arc(Point(0, bridge_len), 50, 0, -π, :stroke)
move(Point(-90, bridge_len))
arc(Point(0,0), 90, π, 0, :stoke)
arc(Point(0, bridge_len), 90, 0, -π, :stroke)
strokepath()
end
function overlap(ang_end)
sector(Point(0, bridge_len), 50, 90, -0., ang_end, :fill)
sethue("black")
arc(Point(0, bridge_len), 50, 0, ang_end, :stoke)
move(Point(90, bridge_len))
arc(Point(0, bridge_len), 90, 0, ang_end, :stoke)
strokepath()
#arc(Point(0, bridge_len), 50, ang_end, 0, :stoke)
end
from chainrules.jl.
These are great! It’s very satisfying to see what a really maths-capable user can do with this stuff. 😂
No math here.
But thanks
from chainrules.jl.
Related Issues (20)
- Rules for `kron` HOT 1
- `*(::AbstractVector, ::AbstractMatrix)` pullback triggers scalar indexing on the GPU HOT 1
- ERROR: LoadError: Some tests did not pass: 7126 passed, 7 failed, 4 errored, 0 broken. in expression starting at /home/ian/.julia/packages/ChainRules/Ipuva/test/runtests.jl:19 ERROR: Package ChainRules errored during testing
- Error differentiating composed cross product with Zygote HOT 2
- `@fastmath maximum` broken on 1.10
- Add rules for `LinRange`
- Rule for `typed_vcat`? HOT 1
- Array `getindex` rule unable to handle Zero types and `NotImplemented` HOT 7
- Returning `Broadcasted` cotangents for `Broadcasted` arguments? HOT 7
- `unbroadcast` fails for `Matrix{Tangent}` due to `zero(::Tangent)`
- Missing rules for Tridiagonal HOT 1
- Wrong results for forward-mode `exp!` half of the time HOT 5
- Errors for gradient and hessian of logabsdet of sparse matrix HOT 3
- Missing rrules for `spdiagm`
- Rules for `eachslice` with multiple `dims`
- Reconsider giving `zero` as the derivative of one HOT 2
- arraymath muladd frule has too loose types
- Missing frules for `copy` HOT 1
- Sparse vector to real power throws a pullback error
- `rrule` for `mean(f, x)` is not vectorized? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chainrules.jl.