# -*- coding: utf-8 -*-
# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .jl
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Julia 0.5.0
#     language: julia
#     name: julia-0.5
# ---

mgrid(0f0:dphi:(pi+dphi*1.5f0), 0f0:dtheta:(2f0*pi+dtheta*1.5f0));

# +
using MultivariateOrthogonalPolynomials

S = MultivariateOrthogonalPolynomials.ProductTriangle(1,1,1)


# +
function mgrid(dim1, dim2)
    X = [i for i in dim1, j in dim2]
    Y = [j for i in dim1, j in dim2]
    return X,Y
end
X, Y = mgrid(linspace(-1f0,1f0,100),linspace(-1f0,1f0,100))
Z = exp.(-X.^2-Y.^2)


window = glscreen()
_view(visualize((X,Y,Z), :surface))
@async renderloop(window)

# +
using GLVisualize, GLAbstraction, Colors, Reactive, GeometryTypes, ApproxFun


f = Fun((x,y)->exp(-x^2-y^2)*cos(y))


pts = points(f)

x = Float32.(first.(pts))
y = Float32.(last.(pts))
z = Float32.(values(f))


window = glscreen()
_view(visualize((x,y,z), :surface))
@async renderloop(window)

# +
using GLVisualize, GLAbstraction, Colors, Reactive, GeometryTypes

window = glscreen()
timesignal = loop(linspace(0f0,1f0,360))

# generate some pretty data
function xy_data(x,y,i, N)
    x = ((x/N)-0.5f0)*i
    y = ((y/N)-0.5f0)*i
    r = sqrt(x*x + y*y)
    Float32(sin(r)/r)
end

surf(i, N) = Float32[xy_data(x, y, i, N) for x=1:N, y=1:N]

t = map(t->(t*30f0)+20f0, timesignal)

bb = Signal(AABB{Float32}(Vec3f0(0), Vec3f0(1)))

_view(visualize((Float32.(1:400),Float32.(1:400),surf(1,400)), :surface, boundingbox=bb))

@async renderloop(window)
# -

Float32.(1:400)

# +
using GLVisualize, GLAbstraction, Colors, Reactive, GeometryTypes

window = glscreen()
timesignal = loop(linspace(0f0,1f0,360))

# generate some pretty data
function xy_data(x,y,i, N)
    x = ((x/N)-0.5f0)*i
    y = ((y/N)-0.5f0)*i
    r = sqrt(x*x + y*y)
    Float32(sin(r)/r)
end

surf(i, N) = Float32[xy_data(x, y, i, N) for x=1:N, y=1:N]

t = map(t->(t*30f0)+20f0, timesignal)

bb = Signal(AABB{Float32}(Vec3f0(0), Vec3f0(1)))

_view(visualize(const_lift(surf, t, 400), :surface, boundingbox=bb))

renderloop(window)
# -

using ApproxFun, MultivariateOrthogonalPolynomials, Reactive, GLAbstraction, GLVisualize

# +
function xy_data(x,y,i, N)
    x = ((x/N)-0.5f0)*i
    y = ((y/N)-0.5f0)*i
    r = sqrt(x*x + y*y)
    Float32(sin(r)/r)
end

surf(i, N) = Float32[xy_data(x, y, i, N) for x=1:N, y=1:N]

window = glscreen()
view(visualize(surf(1,10),:surface))
@async renderloop(window)
# -

timesignal = loop(linspace(0f0,1f0,360))
t = map(t->(t*30f0)+20f0, timesignal)


f = Fun((x,y)->exp(-x^2-y^2)*cos(y))



# +
S = TriangleWeight(1,1,1,JacobiTriangle(1,1,1))
Δ = Laplacian(S)
Dx = Derivative(S,[1,0])
Dy = Derivative(S,[0,1])

h=0.001
ε=0.01


A=I-h*(ε*Δ+Dx)

QR=qrfact(A)

u0=10Fun(S,randn(10));
# -

u = Signal(u0);
map(u->surface(u),u)

push!(u,10u0)

plotly()



StarcoderdataJupyterScriptsDedupFiltered