Generally I do a computation then I have to manually take that number and make it equal to another variable which I define which I can then use to do subsequent computations. Something like this:

Solve[(*Question 2*)

raise /. {Subscript[M, t](*Changes*)-> (maxforce) (125/1000),

Subscript[d, m] -> 18.75/1000, f -> 0.15, Subscript[f, c] -> 0.15,

L -> 2.5/1000, Subscript[\[Alpha], n] -> 14.5 Degree,

Subscript[d, c] -> 16/1000} , {W}]

So this piece of script will give me a value for W. I have to set maxforce before I do the computation as that is usually given in the question.

Basically what I am looking for is a way to automatically take the output of the script above and store it in a variable called "clampforce" for example without having me to manually run the script, copy the output and then define it in the variable. If I just say clampforce=(the entire script above) then what happens is that it stores not just the number in the clampforce variable but w->(the number) and that messes up other calculations. I just want to store the number from the solve command in another variable automatically.

I really appreciate any help. Thanks a lot guys!

  • 3
    $\begingroup$ clampforce = W/.Solve[...] maybe? $\endgroup$ – MassDefect Oct 8 '20 at 16:25
  • 1
    $\begingroup$ Indeed, seems to be a job for the Set command... ;) $\endgroup$ – Henrik Schumacher Oct 8 '20 at 16:31
  • $\begingroup$ Thanks a lot guys this helped. Using MassDefect's example did work but does this only work with "Solve" commands? $\endgroup$ – UppedSolution77 Oct 8 '20 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.