I wouldn't call this a bug, it's a standard Julia thing for a reason. You 
get an InexactError() because you start with an Int and you do an operation 
which turns the Int into a Float so the program gets mad at the type 
instability. You can just change everything to floats, but then you're 
getting rid of the user choice. For example, if you change everything to 
floats, you can't solve it all using rationals of BigInts or whatever crazy 
numbers the user wants. However, if you let the number operations do as 
they normally do, the user can get an answer in the same way that they 
provide it. And it's not like this is a weird thing inside some 
mathematical packages, this is normal Julia behavior.

But this kind of thing will cause issues for first-timers in Julia. It 
should be front and center in the Noteworthy Differences from Other 
Languages that if you really want a float, start with a float.

On Sunday, June 19, 2016 at 10:06:42 PM UTC+1, Gabriel Gellner wrote:
>
> You are passing in the initial condition `start` as an integer, but ode23 
> needs this to be a float. Change it to `const start = 3.0` and you are 
> golden. This does feel like a bug you should file an issue at the github 
> page.
>
> On Sunday, June 19, 2016 at 11:49:55 AM UTC-7, Joungmin Lee wrote:
>>
>> Hi,
>>
>> I am making simple examples of the ODE package in Julia, but I cannot 
>> make a code without error for 1st order ODE.
>>
>> Here is my code:
>>
>> using ODE;
>>>
>>> function f(t, y)
>>>     x = y
>>> ​
>>>     dx_dt = (2-x)/5
>>>     
>>>     dx_dt
>>> end
>>>
>>> const start = 3;
>>> time = 0:0.1:30;
>>>
>>> t, y = ode23(f, start, time);
>>>
>>
>> It finally gives:
>> LoadError: InexactError()
>> while loading In[14], in expression starting on line 1
>>
>> in copy! at abstractarray.jl:310
>> in setindex! at array.jl:313
>> in oderk_adapt at C:\Users\user\.julia\v0.4\ODE\src\runge_kutta.jl:279
>> in oderk_adapt at C:\Users\user\.julia\v0.4\ODE\src\runge_kutta.jl:220
>> in ode23 at C:\Users\user\.julia\v0.4\ODE\src\runge_kutta.jl:210 
>>
>> The example of 2nd order ODE at the GitHub works fine.
>>
>> How should I edit the code?
>>
>

Reply via email to