# Solving from previous results

Posted 27 days ago
448 Views
|
8 Replies
|
2 Total Likes
|
 Hello, I require in this program to use only all the value of “p” form “solution 1” in “solution 2”. Instead of copy and paste each value of “p” individually in solution 2, I am trying to write a function to automatically calculate “da” and “s” from all output “p” in the same manipulate. Thanks for your help. Attachments:
8 Replies
Sort By:
Posted 27 days ago
 Something like this? sol = Table[ Take[Solve[-10 p - 26 t == 5 && -5.3 p + 19 t == (var1 - 50), {p, t}]], {var1, 10, 30, 4}] pSol = p /. sol // Flatten Solve[# == 0.42 - 2.4 s + 1.52 c && da == 15 - 1.4 s + 0.425723972217329 c] & /@ pSol 
Posted 27 days ago
 Crossposted here.
Posted 26 days ago
 Thanks you very much. It works well. Regarding the manipulate, can I have the results individually for each values of pSol I've been trying with MatrixForm and Map but they both yield all solved. Manipulate[ MatrixForm[Solve[ # == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c] & /@ pSol, {2}], {c, 10, 50, 5}] Map[{Manipulate[ Solve[ # == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c], {c, 10, 50, 5}] & /@ pSol}]  Attachments:
Posted 26 days ago
 Do you mean something like this? Manipulate[ Column@Flatten[Solve[ # == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c] & /@ pSol, 1], {c, 10, 50, 5}] 
Posted 24 days ago
 Dear Sir Thank you very much it works fine. I trying a last calculation whereby need to divide the Sqrt[c] from 10 to 30 for their respective s obtained from each c. I tried with the dynamic and For loop are not working. I’d be grateful for your help. Thanks and Regards, Dynamic[var3 = s /. var2 // Flatten] Dynamic[tab1 = Table[i++, {i, 10, 30, 1}] // Flatten] Dynamic[Sqrt[10]/var3] For[i = 10, i <= 50, i++, Print[Sqrt[i]/var3]]  Attachments:
Posted 24 days ago
 I am not sure I understand exactly what you are asking. I don't think Dynamic is needed.Write a function to generate the solutions for given c so you can use it for many different purposes. solutions[c_] := Solve[# == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c] & /@ pSol // Flatten[#, 1] & Display as a table tableDisplay[c_] := solutions[c] // TableForm Manipulate[tableDisplay[c], {c, 10, 50, 5}] Display as a grid gridDisplay[c_] := solutions[c] // Values // Prepend[{"d", "s"}] // Grid[#, Frame -> All, Background -> {Automatic, 1 -> LightYellow}, ItemStyle -> {Automatic, 1 -> Bold}, Alignment -> {Center, Automatic, {{{2, -1}, {1, -1}} -> "."}}] & Manipulate[gridDisplay[c], {c, 10, 50, 5}] Generate a set of solutions for c between 10 and 30 as an Association solutionSet = AssociationMap[Association /@ solutions[#] &, Range[10, 30]] All the s values for c = 10 sc10 = solutionSet[10] // Map[KeyTake[#, s] &] // Merge[Identity] (* <|s -> {5.30714, 5.47239, 5.63763, 5.80287, 5.96812, 6.13336, 6.2986, 6.46384, 6.62909}|> *) Divide Sqrt[10] by each s value Sqrt[10] / Flatten@Values@sc10 (* {0.595853, 0.577861, 0.560923, 0.54495, 0.529862, 0.515587, 0.50206, \ 0.489225, 0.477031} *) If you need to do this for many different values of c then combine the steps above into a single function.
 Dear Sir, I would thank you very much again, it's working. I took the previous example to clarify. You'll notice that As we slide the s values changes, together with the c value. It would be that Sqrt[c] divide by the s value obtained as c changes. I attached the notebook also. Thank you for your kind consideration  sol = Table[ Take[Solve[ -10 p - 26 t == 5 && -5.3 p + 19 t == (var1 - 50), {p, t}]], {var1, 10, 20}]; pSol = p /. sol // Flatten; Dynamic[Manipulate[ Column@Flatten[ var2 = Solve[ # == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c] & /@ pSol, 1], {c, 10, 50, 1, Appearance -> {"Labeled", "Open"}}]] Dynamic[var3 = s /. var2 // Flatten]&[Wolfram Notebook][1] Dynamic[tab1 = Table[i++, {i, 10, 30, 1}] // Flatten] Sqrt[10]/var3, Sqrt[11]/var3, ... .... (Sqrt[30]/var3) (*divide \ Sqrt[c] from 10 to 30 for their respective s value obtained from each \ c*) 
 Dear Mr. Rohit, I've been able to formulate the calculation I require. However, on the first run of the program, I obtain solutions. After , It automatically give errors, I attached the Notebook file. Thanks for your usual kind help sol2 = Table[ Take[Solve[ -10 p - 26 t == 5 && -5.3 p + 19 t == (var1 - 50), {p, t}]], {var1, 10, 20}] pSol1 = p /. sol2 // Flatten Dynamic[Manipulate[ Column@Flatten[ var2 = Solve[ # == 0.42 - 2.4 s + 1.52 c && d == 15 - 1.4 s + 0.4258 c] & /@ pSol1, 1] && Dynamic[Column@Flatten[t = Sqrt[c]/var3]], {c, 10, 20, 1, Appearance -> {"Labeled", "Open"}}]] Dynamic[var3 = s /. var2 // Flatten]  Attachments: