Hi,
I am trying to port following simple Matlab code into Julia to get
*mu*
M=500
m_plus=M*0.2;
m_0=M*0.1;
m_minus=M*0.7;
mu_plus=0.15+0.5*(1:m_plus)/m_plus;
mu_minus=-3*(1:m_minus)/m_minus;
mu_0=zeros(1,m_0);
*mu*=[mu_plus mu_0 mu_minus]
However, with Julia, this is never a simple task because of the too sensitive
type specification.
I have no problem upto line 6 but I had error on line 7 or zeros().
`Array{T,N}` has no method matching Array{T,N}(::Type{Float64}, ::Int64,
::Float64)
while loading In[121], in expression starting on line 1 in zeros at array.jl:170
It worked when I changed 50.0 into 50 in zeros() and I made change in code to
convert float into integer with convert() and ::
convert(Int32,m_0);
m_0= m_0::Int32
but not works
The second error was concatenation.
mu_plus=0.15+0.5*(1:m_plus)/m_plus;
mu_minus=-3*(1:m_minus)/m_minus;
mu_0=zeros(1,50);
mu=[mu_plus mu_0 mu_minus]
number of rows must match while loading In[133], in expression starting on line
4
in hcat at abstractarray.jl:571
This may be the reason of different date type as well.
The type of mu_plus and mu_minus are FloatRange{Float64} (constructor with 1
method),
while that of mu_0 is Array{Float64,2}
Could you let be know the basics that I still need to practice?
Many thanks.