  Project: Testing 18.04
Views: 764
Kernel: Julia 1.0

# Julia 1.0 Kernel in CoCalc

```
```

Here is the other common building block for programming: Evaluating a block of code more than once, e.g. by either counting the iterations or until a condition is met (or no longer met). This is one of the most confusing parts of programming. So don't be shy to take your time inspecting this. Try to evaluate this little program in your head by reading the lines over and over again...

```using Printf

s = 0
for i = [1 2 5 100 -1 5]
s = s + i
@printf("i = %4d  →  s = %4d\n", i, s)
end
```
```@printf("%.2f", pi)
```
```1+1+1+23

```
```VERSION
```
```ENV["JULIA_DEPOT_PATH"]
```
```Pkg.installed()
```
```using Pkg
for (k, v) in Pkg.installed()
println(k, ":::", (if nothing == v "N/A" else v end))
end
```
```using Printf
```
```s = 0
for i = [1 2 5 100 -1 5]
s = s + i
@printf("i = %4d  →  s = %4d\n", i, s)
end
```
```[sin(3.14), sin(3.141), sin(3.142)]
```
```println("Hello", 99)
x = 10
println("Interpolation \$(5 + x)")
@printf("pi = %.7f\n", float(pi))
```
```Printf.@printf("%f %F %f %F\n", Inf, Inf, NaN, NaN)
```
```using CSV
```
```using DataFrames
```
```#using Gadfly
```
```using Nemo
```

```using Statistics

```
```Statistics.median([8 9 8 6 87 6 7 6 5.1 4 5 4 3 4 3 3 3 3 ])
```
```using LinearAlgebra
```
```m1 = [  1 2 -3
3 -1 1
1.0 1 1]

q1, r1 = LinearAlgebra.qr(m1)
```
```q1 * r1
```

```using DifferentialEquations
α=1
β=1
u₀=1/2
f(t,u) = α*u
g(t,u) = β*u
dt = 1//2^(4)
tspan = (0.0,1.0)
prob = SDEProblem(f,g,u₀,(0.0,1.0))
sol = solve(prob,EM(),dt=dt)
using Plots
plot(sol)
```
```using DifferentialEquations

f(x) = sin(2π.*x[:,1]).*cos(2π.*x[:,2])
gD(x) = sin(2π.*x[:,1]).*cos(2π.*x[:,2])/(8π*π)

dx = 1//2^(5)
mesh = notime_squaremesh([0 1 0 1],dx,:dirichlet)
prob = PoissonProblem(f,mesh,gD=gD)

sol = solve(prob)

using Plots
plot(sol)
```
```using GLM
```

```using PyPlot
x = range(0, stop = 4*pi, length=1000)
y = sin.(3*x + 1.5*cos.(2*x))
plot(x, y, color="red", linewidth=2.0, linestyle="--")
```
```using PyPlot
x = range(0; stop=2*pi, length=1000); y = sin.(3 * x + 4 * cos.(2 * x));
plot(x, y, color="red", linewidth=2.0, linestyle="--")
title("A sinusoidally modulated sinusoid")
```

```using D4M
```
```row = "a,a,a,a,a,a,a,aa,aaa,b,bb,bbb,a,aa,aaa,b,bb,bbb,"
column = "a,aa,aaa,b,bb,bbb,a,a,a,a,a,a,a,aa,aaa,b,bb,bbb,"
values = "a-a,a-aa,a-aaa,a-b,a-bb,a-bbb,a-a,aa-a,aaa-a,b-a,bb-a,bbb-a,a-a,aa-aa,aaa-aaa,b-b,bb-bb,bbb-bbb,"

A = Assoc(row,column,values)
```
```Ar = A["a,b,",:]
```
```Ac = A[:,"a,b,"]
```
```Av = A > "b,"
```

## SymPy test

```using SymPy
x = symbols("x")      # or   @vars x, Sym("x"), or  Sym(:x)
y = sin(pi*x)
y(1), y(2.2), y(123456)
```

## Unicode Plots

```using Plots
unicodeplots()
```
```# /Users/tom/.julia/v0.4/Plots/docs/example_generation.jl, line 50:
plot(sin,x-> sin(1.5x), 0, 4π, line=1, leg=false, fill=(0,:orange))
```
```
```