Skip to main content
added 2 characters in body
Source Link
user21
user21

It's not quite clear what you are looking for, how about using a function:

test[a_?NumericQ] := a + 1
NDSolve[{y''[t] == -9.81, y[0] == 5, y'[0] == 0, 
   WhenEvent[test[y[t]] == 0, y'[t] -> -0.95 y'[t]]}, y, {t, 0, 10}];
Plot[y[t] /. %, {t, 0, 10}]

It's not quite clear what you are looking, how about using a function:

test[a_?NumericQ] := a + 1
NDSolve[{y''[t] == -9.81, y[0] == 5, y'[0] == 0, 
   WhenEvent[test[y[t]] == 0, y'[t] -> -0.95 y'[t]]}, y, {t, 0, 10}];
Plot[y[t] /. %, {t, 0, 10}]

It's not quite clear what you are looking for, how about using a function:

test[a_?NumericQ] := a + 1
NDSolve[{y''[t] == -9.81, y[0] == 5, y'[0] == 0, 
   WhenEvent[test[y[t]] == 0, y'[t] -> -0.95 y'[t]]}, y, {t, 0, 10}];
Plot[y[t] /. %, {t, 0, 10}]
Source Link
user21
user21

It's not quite clear what you are looking, how about using a function:

test[a_?NumericQ] := a + 1
NDSolve[{y''[t] == -9.81, y[0] == 5, y'[0] == 0, 
   WhenEvent[test[y[t]] == 0, y'[t] -> -0.95 y'[t]]}, y, {t, 0, 10}];
Plot[y[t] /. %, {t, 0, 10}]