0
$\begingroup$

I am new to mathematica so i ve trying to solve many equations with different variables using manipulate. So what i have written so far is the following.

Manipulate[
  n = 98.5/100;
  Q = 8050;
  W = 5.2;
  H = 6.1;
  L = 4.1;
  ap = 2*H*L;
  A = -Q/W*Log[1 - n];
  N = A/ap + ns;
  R = ns*L/H;
  nd = N - 1;
  u = Q/(nd*D*H);
  aa = 2*H*L*ns*nd;
  Show[{N, R, nd, u, aa}],
  {{ns, 2, Row[{"tmimata sti roi ", Text@Style["ns", Italic]}]}, 2, 8, 1, Appearance -> "Labeled"}, 
  {{D, 0.15,Row[{"Diakeno plakwn ", Text@Style["D", Italic]}]}, 0.15, 0.4,0.05, Appearance -> "Labeled"}]

After all of what i have mentioned the results i am getting are all fault. Please, any help is much appreciated.

$\endgroup$
2
$\begingroup$

This gets rid of the errors.

Not a good idea to use variables with UpperCase first letter. In particular, you used N and D which are Mathematica own symbols.

If you want to use a variable with one letter and wanted that be an UpperCase, then good idea to add 0 to it, as in N0, D0, H0.

Also you used Show when there is no graphics. Use Grid for formatting.

Manipulate[

 n = 98.5/100;
 Q0 = 8050;
 W0 = 5.2;
 H0 = 6.1;
 L0 = 4.1;
 ap = 2*H0*L0;
 A0 = -Q0/W0*Log[1 - n];
 N0 = A0/ap + ns;
 R0 = ns*L0/H0;
 nd = N0 - 1;
 u = Q0/(nd*D0*H0);
 aa = 2*H0*L0*ns*nd;

 Grid[{{N0, R0, nd, u, aa}}, Frame -> All],

 (*control variables below *)
 {{ns, 2, Row[{"tmimata sti roi ", Text@Style["ns", Italic]}]}, 2, 8, 
  1, Appearance -> "Labeled"},

 {{D0, 0.15, Row[{"Diakeno plakwn ", Text@Style["D", Italic]}]}, 0.15,
   0.4, 0.05, Appearance -> "Labeled"}

 ]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Thank you a lot Nasser. Your comments to what i have written so far seem to be very helpful. Also, a big thanks for your kind way to edit and improve my few lines of code. $\endgroup$ – k. theodosis Nov 27 '17 at 8:20

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.