I am a total Mathematica beginner. I just want to use it to do some calculations, and the reason it is so interesting and attractive to me as an engineering student is that it allows me to write maths symbolically as you would see in a textbook. My mind cannot comprehend mathematics if it is written in code form.
So this is what my code looks like.
(*Power Screws*)
raise =
Subscript[M, t] ==
(W*Subscript[d, m])/2 *
((f*π*Subscript[d, m] +
L*Cos[Subscript[α, n]])/(π*Subscript[d, m]*Cos[Subscript[α, n]] - f*L)) +
(W*Subscript[f, c]*Subscript[d, c])/2
lower =
Subscript[M, t] ==
(W*Subscript[d, m])/2 *
((f*π*Subscript[d, m] -
L*Cos[Subscript[α, n]])/(π*Subscript[d, m]*Cos[Subscript[α, n]] + f*L)) +
(W*Subscript[f, c]*Subscript[d, c])/2
stress = σ == (-4 p W)/(π h*(Subscript[d, 0]^2 - Subscript[d, r]^2))
eff = η == (W L)/(2 π Subscript[M, t])
power = w == (2 π (6/n*60) Subscript[M, t])/60
(*Question 2*)
raise /.
{Subscript[M, t](*Changes*)-> (101.5) (125/1000),
Subscript[d, m] -> 18.75/1000, f -> 0.15, Subscript[f, c] -> 0.15,
L -> 2.5/1000, Subscript[α, n] -> 14.5 Degree, Subscript[d, c] -> 12/1000}
(*Question 3*)
eff /.
{W(*Changes*)-> 4592.508217189424, L -> 2.5/1000, Subscript[M, t] -> 6.62183}
(*Question 4*)
stress /.
{W(*Changes*)-> 4592.51, σ(*Changes*)-> 12.1*10^6,
Subscript[d, 0] -> 20/1000, Subscript[d, r] -> 17.5/1000, p -> 2.5/1000}
(*Question 6*)
raise /.
{Subscript[d, m] -> 22.5/1000, f -> 0.08,
Subscript[f, c] -> 0.05, L -> 5/1000, Subscript[α, n] -> 0 Degree,
Subscript[d, c] -> 40/1000, W(*Changes*)-> 6000}
(*Question 7*)
lower /.
{Subscript[d, m] -> 22.5/1000, f -> 0.08,
Subscript[f, c] -> 0.05, L -> 5/1000, Subscript[α, n] -> 0 Degree,
Subscript[d, c] -> 40/1000, W(*Changes*)-> 6000,
Subscript[M, t](*Changes*)-> 23}
(*Question 8*)
eff /.
{W(*Changes*)-> 4592.508217189424, L -> 5/1000, Subscript[M, t] -> 6.62183}
(*Question 9*)
eff /.
{W(*Changes*)-> 4592.508217189424, L -> 5/1000, Subscript[M, t] -> 6.62183}
(*Question 10*)
raise /.
{Subscript[d, m] -> 22.5/1000, f -> 0.08*4/3,
Subscript[f, c] -> 0.05*4/3, L -> 5/1000,
Subscript[α, n] -> 0 Degree, Subscript[d, c] -> 40/1000,
W(*Changes*)-> 6000}
(*Question 11*)
raise /.
{Subscript[d, m] -> 37/1000, f -> 0.1,
Subscript[f, c] -> 0.15, L -> 6/1000, Subscript[α, n] -> 14.5 Degree,
Subscript[d, c] -> 60/1000, W(*Changes*)-> 12500} e here
Basically, when I evaluate the expression for Question 2, I need the answer from that question to do question 3. The way that I am doing it now is I just manually take the answer for W and paste it into the respective variable for question 3. Is there a way that I can generalize it where in question 3 for the variable that is the answer from the previous one is named as something which the program knows it must take the value from the previous calculation? The numbers which are there now are just examples.
Something ideal would be to store numbers in variables which are then placed in the replace functions. And then the outputs of those replace functions could be automatically stored in other variables which I can then put in other replace functions? Or something similar if you get me.
I know my words are all over the place, sorry. I would appreciate any help. If you not understanding me, please ask a question and I will try to clarify myself.
:=
. Take your answer for question 2 and doq2 := (your code)
. Then use q2 anywhere you want the answer for that question instead of copy paste. This explains it well. If this doesn't help let me know. $\endgroup$