solve_ivp problem (scipy 1.0.0)
AB
brozi at toya.net.pl
Tue Feb 20 10:37:56 EST 2018
Hello
I don't know why but my answer got lost somehow, so I'm sending it once
more, hopefully with better luck.
W dniu 2018-02-19 o 11:02, Thomas Jollans pisze:
> On 2018-02-18 14:39, A.Brozi wrote:
>> Hello
>>
>> In new "scipy" (1.0.0) I've found procedure "solve_ivp", which makes it
>> possible to use "events" in order to terminate the ode solution when
>> some condition is satisfied.
>> The precise moment of termination (the value of independent variable) is
>> to be found in "t_events", but I cannot find the dependent variable(s)
>> value(s) at the termination moment.
>> Am I missing something? Or it's simply not possible (hopefully 'not yet')?
>>
>> Regards
>> Andrzej Brozi
>
> Isn't the solution passed back as ‘y’?
Yes, it is. But the vector "y" contains only values corresponding to the
time moments given in "t_eval". It doesn't contain the value
corresponding to the time of event function passing zero.
In this situation a trajectory of a projectile hitting ground will
terminate at a point above ground.
I've succeeded to find one walk-around for this problem: if the "t_eval"
vector is not supplied, then the last element of the solution "y" will
be the desired value.
Using this method it may be necessary to supply some reasonably small
value of "max_step" (otherwise the solution may contain too few points).
Unfortunately I don't see a simple way to guarantee the solution not to
contain too many points (without "t_eval" it will contain all the points
computed).
Regards
Andrzej Brozi
More information about the Python-list
mailing list