page_screen_output (false); # so you see a message when a debugger can # be attached format long # see differences of state variables better ## the state will be assigned to this by fdot() global state_ref_global; state_ref_global = []; ## a forced copy of the state will be assigned to this by fdot() global state_copy_global; state_copy_global = []; global count; count = 0; [state, info, msg] = lsode (@ fdot, [1; 1], linspace (0, 10, 101)); ## check global variables if (any (state_ref_global != state_copy_global)) printf ("bug triggered after completion of lsode for global variable\n"); else printf ("bug not triggered after completion of lsode for global variable\n"); endif ## by calling fdot() with no arguments, get values of persistent ## variables, having the state or a forced copy of the state assigned to ## them, respectively [state_ref_persistent, state_copy_persistent] = fdot (); ## check persistent variables if (any (state_ref_persistent != state_copy_persistent)) printf ("bug triggered after completion of lsode for persistent variable\n"); else printf ("bug not triggered after completion of lsode for persistent variable\n"); endif