Consider I have a list l
l = {
b + Integrate[Sin[t*q], {t, 0, 1.1}]^2 == b + Integrate[Cos[t*q], {t, 0, 1.1}]
, a + Integrate[Sin[t*p], {t, 0, 1.1}]^2 == b + Integrate[Cos[t*q], {t, 0, 1.1}]
}
Now I want another function to take just take one part of the expression without evaluating it. How do I do it? Basically I want something along the lines of
ExtractUnevaluated[l, 1]
With result
b + Integrate[Sin[t*q], {t, 0, 1.1}]^2 == b + Integrate[Cos[t*q], {t, 0, 1.1}]
How do I do this? Specificically how do I define ExtractUnevalued[l_List,n_]:= ????
To be a bit clearer I want to pass the part of the list to a function defined by:
SetAttributes[DiscretizeIntegralOnSet,HoldFirst]
DiscretizeIntegralOnSet[ Integrate[A_,{t_,tmin_,tmax_}], discretpointlist_
]:=some stuff(not relevant)
DiscretizeIntegralOnSet[ A_+B_, discretpointlist_
]:=some other stuff(not relevant)
That then allows me to symbolically write a discretized integral as sum over a set.
lis not already evaluated you can useInactivateas follows:l2 =Inactivate[{b + Integrate[Sin[t*q], {t, 0, 1.1}]^2 == b + Integrate[Cos[t*q], {t, 0, 1.1}], a + Integrate[Sin[t*p], {t, 0, 1.1}]^2 == b + Integrate[Cos[t*q], {t, 0, 1.1}]}, Integrate]; l2[[2]]– kglr Jun 12 '18 at 09:01Extract[list, pos, Unevaluated]should do the trick. However, you need to make sure the list doesn't evaluate when you define it (by usingHoldinstead ofList, for example). – Sjoerd Smit Jun 12 '18 at 09:45Unevaluatedwhen extracting the elements from the held list. – Sjoerd Smit Jun 12 '18 at 10:20