Hot answers tagged

5

Sequential With From Daniel Lichtblau's comment there is a new undocumented syntax for With introduced sometime after version 10.1 that allows: With[{a = 0}, {a = a + 1}, {a = a + 1}, a] 2


5

You can add a new variable in Reduce do get your multiplication, just like this In[13]:= Reduce[ ans == x y && x*y > 50 && x*y < 100 && x < 100 && x > 1 && y > 1 && y < 50, ans, {x, y}, Integers] Out[13]= ans == 51 || ans == 52 || ans == 54 || ans == 55 || ans == 56 || ans == 57 || ans ...


4

The issue was due to a simple, but unobvious syntax mistake. The intended behavior is given by FoldList[cpdz[#1, 2, #2, 0.01, 2, 720] &, 1569.3 , #] & /@ SetofLists


3

Here is a block-based modification of the first method in my answer to the earlier question: fnBlock[x1_, x2_, primes_List] := Fold[ # ~Complement~ Range[x1 + #2 - Mod[x1, #2, 1], x2, #2] &, Range[x1, x2], primes ] fnMem[x_Integer, n_Integer, block_: 1*^6] := With[{pr = Prime @ Range @ n}, Join @@ Table[ fnBlock[1 + i ...


2

EDIT Using to rules will be better: x y/.{ToRules@Reduce[x*y > 50 && x*y < 100 && x < 100 && x > 1 && y > 1 && y < 50, {x, y}, Integers]} @Michael thanks! in your situation, the result will be in the form x==2&&y==26||x==2&&y==27...... so we can use replacement rules to make it ...


2

Your code has syntax errors. It should be Strain[neuaxis_, y_] := Module[{b = 0.003, a}, a = -b/neuaxis; a*y + b] Stress[neuaxis_, y_] := Module[{temp, Es = 200*10^3, fsy = 500}, temp = Strain[neuaxis, y]*Es; If[temp > fsy, fsy, If[temp < -fsy, -fsy, temp]]] but I would write With[{b = 0.003}, Strain[neuaxis_, y_] := b (1 - y/neuaxis)] ...



Only top voted, non community-wiki answers of a minimum length are eligible