Blame view

symb-ltxify--drafts.jl 1011 Bytes
c8470968   Francisco Coelho   Initial Commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using Symbolics
using Latexify

# # γ = 0.5
# no_s = [
#     0   ,
#     23  ,
#     614 ,
#     165 ,
#     169 ,
#     0   ,
#     0   ,
#     4   ,
#     25  ,
# ]

# γ = 0.8
no_s = [
    0   ,
    28  ,
    632 ,
    246 ,
    59 ,
    0   ,
    0   ,
    5   ,
    27  ,
]
pr_s = (x -> x // 1000).(no_s)

@variables θ
num_e = [
    0           , 
    0           , 
    7           , 
    3 * θ       , 
    3 * (1 - θ) , 
    0           , 
    0           , 
    3           , 
    10          ,
]
pr_e = (x -> x // 23).(num_e)

target = expand(sum( (x -> x^2).(pr_s - pr_e) ))
println(latexify(target))

# using Plots
# g(t) = (20869963/66125000) + (477/52900)*t + (18/529)*(t^2)
# t = 0:0.1:1
# plot(t, g.(t))



function solve2(a, b, c)
    delta = sqrt(Complex(b^2 - 4 * a * c))
    return ( (-b - delta)/(2*a), (-b + delta)/(2*a) )
end
    
# # g = target ~ 0

a = float(18//529)
b = -float(21903//264500)
c = float(188207311//529000000)

println("a: $a b: $b c: $c")
println("̂θ = $(-b/a)")