Tag Info

New answers tagged

4

I'd do something like this: myfunction[V_, a_, b_, c_] := Block[{v1}, If[TrueQ[a < b] && TrueQ[b > c], Abort[], (* else *) myFunction[v1_, a, b, c] = a*v1^2 + b*v1 + c; myFunction[V, a, b, c] ]]; It is similar to my answer here. Basically, you memoize on some of the arguments.


2

Edit: revision - for this to work properly you need to evaluate the expression inside the function: myfun[a_,b_,c_]/; a < b && b > c:= myfun[a,b,c]=Function[{V}, Evaluate[ function code ] ] usage is then for example: Plot[myfun[a,b,c][V],{V,0,1}] if you need the Abort you can simply do myfun[a_,b_,c_]:=Abort[] which will ...


1

f[n_] := First@ Nest[{Integrate[#[[1]] /. L :> L - a - z, {z, 0, L - #[[2]] a}], #[[2]] + 1} &, {1/2 (a - L)^2, 2}, n - 2] Test: (f(2) to f(10)): Table[f[j], {j, 2, 10}] yields {1/2 (a - L)^2, -(1/6) (2 a - L)^3, 1/24 (-3 a + L)^4, -(1/120) (4 a - L)^5, 1/720 (-5 a + L)^6, -((6 a - L)^7/5040), (-7 a + L)^8/40320, -((8 a - ...


6

Q[n_, L_] := Q[n, L] = Integrate[Q[n - 1, L] /. L :> L - a - z, {z, 0, L - (n - 1) a}] Q[2, L_] = 1/2 (a - L)^2 Q[4, L] (* 1/24 (-3 a + L)^4 *)



Top 50 recent answers are included