Group Abstract Group Abstract

Message Boards Message Boards

0
|
5K Views
|
8 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Cannot fill table inside manipulate structure

Posted 3 years ago
POSTED BY: Gerald Proteau
8 Replies

Sorry, ...

Maybe you need to restart the kernel.

Try running the code with a fresh started session no other input before.

Might use ClearAll["Global`*"] to clear all variables/symbols.

Try removing SaveDefinitions -> True from Manipulate.

Robert

POSTED BY: Robert Nowak
Posted 3 years ago

Hi Gerald,

Here is one way

Last @@@ {Hi$8893 -> 8532.225243725225`, 
  Hiol$8893 -> 4936.849236413657`, Hiil$8893 -> 3595.3760073115686`, 
  Hc$8893 -> 7579.292471374861`, Hcol$8893 -> 3349.2234357010298`}
(* {8532.23, 4936.85, 3595.38, 7579.29, 3349.22} *)
POSTED BY: Rohit Namjoshi

One small step ...

Manipulate[
 TableForm@
  Table[{{span, Rw}, 
    H /. FindRoot[{(2 (H/Rw) Sinh[span Rw/(2 H)] - span - (span slacdataStrain[[i]]/100))/Ac},
{H, iTen/100 rts/2}]}, {i, 32}],
{span, 500, 1500, 100},
{Rw, 0.5, 2.5, 0.1},
SaveDefinitions -> True
]

Robert

POSTED BY: Robert Nowak
Posted 3 years ago

Moving the ttab variable above the module command did the trick. Here is an image of the code, its part of a much larger file I'm working on and I did not want to provide the entire file. The //. can be replace by /. The output is shown below the code. Thanks,

G

My code output

POSTED BY: Gerald Proteau
Posted 3 years ago
POSTED BY: Gerald Proteau

Hi, unfortunately things are mixed up a little bit.

Your assignment of H=rts/10; which is not used in your code by the way, in deed requires to use Module to protect the other H from FindRoot at least for a clean solution.

I would suggest this code:

Manipulate[
 TableForm@
  Table[{{span, Rw}, 
    Module[{H}, 
     H /. Quiet@
       FindRoot[{(2 (H/Rw) Sinh[span Rw/(2 H)] - span - (span slacdataStrain[[i]]/100))/Ac},
{H,iTen/100 rts/2}]]}, {i, 32}],
{span, 500, 1500, 100},
{Rw, 0.5, 2.5, 0.1},
SaveDefinitions -> True]

Many Mathematica functions return list or replacement rules aka substitutions.

If you need the "naked" values you usually perform the substitution by means of the /. operator.

{x, y} /. {x -> 3, y -> 5}
x /. {x -> 3, y -> 5}
Sqrt[x^2 + y^2] /. {x -> 3, y -> 5}


Out[18]= {3, 5}

Out[19]= 3

Out[20]= Sqrt[34]

I personally would avoid Last@@@{x -> 3, y -> 5} at least in this case, Values[{x -> 3, y -> 5}] or Values@{x -> 3, y -> 5} would do the same job, again I would avoid it.

Robert

POSTED BY: Robert Nowak
Posted 3 years ago

I see you have removed the module, which simplifies this task a great deal. The H/. will clean up the single output from the solver, but what If there were more than one equation being solved simultaneously. I don't understand the syntax required to remove the temporary variables and the -> from this list.

{Hi$8893 -> 8532.225243725225`, Hiol$8893 -> 4936.849236413657`, 
 Hiil$8893 -> 3595.3760073115686`, Hc$8893 -> 7579.292471374861`, 
 Hcol$8893 -> 3349.2234357010298`}
POSTED BY: Gerald Proteau
Posted 3 years ago

Thanks for the quick reply.

POSTED BY: Gerald Proteau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard