sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.47k stars 487 forks source link

Frequent crash in ode_solver #10142

Closed 377eaafa-3ba7-4610-b159-3f0b77b4e855 closed 13 years ago

377eaafa-3ba7-4610-b159-3f0b77b4e855 commented 14 years ago

I have been using Sagemath (several versions, but must recently, 4.5.2; but this bug existed in previous versions as well) for my Honours thesis in quantum mechanics, and have been making heavy use of the integration routines. The ode_solver regularly crashes for specific step-sizes. I have not been able to work out a systematic pattern, but if it doesn't work once, it continues not to work no matter how many times you try. It can crash for any step size; sometimes even for integers. It does, however, usually only crash on the final step. It also seems to be independent of the numerical solver.

When it crashes, it reports something like:

ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (60, 0))


ValueError                                Traceback (most recent call last)

/home/themadhatter/Honours/modelling/ in ()

/home/themadhatter/Honours/modelling/lib/sequences.pyc in evolution(self, period, step, perturbations, carryon)      16          17     def evolution(self,period=100,step=1,perturbations=None,carryon=False): ---> 18         return self.SYSTEM.integrate_numerically(perturbation=perturbations,self_entangle=True,step=step,period=period,projector=self.PROJECTOR,time_dependence=self.TIME_DEPENDENCE,carryon=carryon)      19          20     def fidelity(self,period=100,step=1,perturbations=None,carryon=False):

/home/themadhatter/Honours/modelling/lib/hamiltonian.pyc in integrate_numerically(self, y_0, period, step, perturbations, error_rel, error_abs, self_entangle, projector, time_dependence, function, increase_dim, noise, carryon, **params)     560         else:     561             integrator = self.Integrator(self,y_0,self_entangle=self_entangle,noise=noise,increase_dim=increase_dim,perturbations=perturbations,time_dependence=time_dependence,cache='numerical',error_rel=error_rel,error_abs=error_abs) --> 562             return integrator.start(period,step)     563     #     564     # Integrate a given initial state using the Hamiltonian and compare to ideal evolution

/home/themadhatter/Honours/modelling/lib/hamiltonian.pyc in start(self, period, step)     521             522         def start(self,period=100,step=1): --> 523             self.results = self.integrate(self.y_0,period=period,step=step)     524             if self.multiple:     525                 return self.results

/home/themadhatter/Honours/modelling/lib/hamiltonian.pyc in integrate(self, y_0, period, step, t_offset)     512                 513             for y_0 in y_0s: --> 514                 T.ode_solve(y_0=y_0,t_span=[0,period],params=params,num_points=int(period/step))     515                 results.append(T.solution)     516                 pb_run+=1

/home/themadhatter/sage/local/lib/python2.6/site-packages/sage/gsl/ode.so in sage.gsl.ode.ode_solver.ode_solve (sage/gsl/!ode.c:4558)()

ValueError: error solving

I have been very careful in checking my code, and am confident that it is not a fault in my code. I have been working around it by changing the step-size adhoc... but when doing a series of runs; it is VERY annoying. ><

If you need more information, let me know. I am quite happy to give you my entire code; along with specific instructions on how to trigger the crash.

Please fix this!

Kind Regards, Matthew

CC: @jdemeyer

Component: calculus

Issue created by migration from https://trac.sagemath.org/ticket/10142

kcrisman commented 13 years ago
comment:1

Hi, This definitely needs more instructions on how to trigger the crash. Thanks!

377eaafa-3ba7-4610-b159-3f0b77b4e855 commented 13 years ago
comment:3

Sorry for the delay... I'll be just a few more days (at most). I've been very busy on another project. I know this qualifies as spam... but I want you to know I do intend to provide more information.

377eaafa-3ba7-4610-b159-3f0b77b4e855 commented 13 years ago
comment:4

Whoops!

I sat down today to do a thorough analysis of my code, and found that the error was actually in some progress bar code that I have been using, which throws an assertion error if progress is > 100; which it was by a smidgeon due to the approximations of float numbers.

My humble apologies for wasting your time... and my faith is bolstered in Sage :).

Thank you!

kcrisman commented 13 years ago
comment:6

To release manager: Just FYI that this was closed by the OP.

I guess we really need that new config for the actions!