Hi!
I am trying to work with a background function which I want to set to a particular value after it reaches this value dynamically. For instance, if my function is f=X, I want to assign
if(X<=0) {f=0;}
else{f=X;}
However, this does not seem to be possible in general. Notice that this will make the function continuous, but not smooth. The code often says
Error in perturb_init
=>perturb_init(L:363) :error in perturb_solve(ppr, pba, pth, ppt, index_md, index_ic, index_k, pppw[thread]);
=>perturb_solve(L:2382) :error in generic_evolver(perturb_derivs, interval_limit[index_interval], interval_limit[index_interval+1], ppw->pv->y, ppw->pv->used_in_sources, ppw->pv->pt_size, &ppaw, ppr->tol_perturb_integration, ppr->smallest_allowed_variation, perturb_timescale, ppr->perturb_integration_stepsize, ppt->tau_sampling, tau_actual_size, perturb_sources, perhaps_print_variables, ppt->error_message);
=>evolver_ndf15(L:474) :error in new_linearisation(&jac,hinvGak,neq,error_message);
=>new_linearisation(L:967) :condition (funcreturn == FAILURE) is true; Failure in sp_ludcmp. Possibly singular matrix!
Even if this function is not used in the perturbation module, one gets the previous complaint. If the discontinuity in the derivative is not big, the error goes away.
I was thinking about smoothing the transition by a regularized Heaviside function, but before I was wondering if there is another way to do it.
Thanks a lot!
Diego