Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.7K Views
|
7 Replies
|
7 Total Likes
View groups...
Share
Share this post:

[?] Connect data from solving equation in some loop?

Posted 9 years ago
POSTED BY: Saleh Baradaran
7 Replies
POSTED BY: Neil Singer

Dear Neil ,

First of all , i must thank you for your attention & also your help in solving problem , Thank you

I should describe you that which formulas i used in solving problem were come from using DTM (Differential Transform Method) on solving mode function equations . I want to program these formulas in looping that you help me very good to use them in my M.Sc thesis & also my ISI articles at the future.

I am very happy & nice to meet you

with the best regards Saleh

POSTED BY: Saleh Baradaran

Saleh,

I would do it all in a Dynamic Module. Using loops and inputs is not very Mathematica-like.

Here is an example:

DynamicModule[{M = 100, sols, n, beam = 1},
 sols = \[CapitalOmega] /. 
   Table[FindRoot[
     Tanh[Sqrt[\[CapitalOmega]]] - 
      Tan[Sqrt[\[CapitalOmega]]], {\[CapitalOmega], IG}], {IG, 10, 
     200, 50}];
 f[x_, n_] := 
  Sum[sols[[n]]^(2 i)/(4 i + 2)! x^(4 i + 2), {i, 0, M}] - 
   Sum[sols[[n]]^(2 i)/(4 i + 2)!, {i, 0, M}]/
     Sum[sols[[n]]^(2 i)/(4 i + 3)!, {i, 0, M}] Sum[
     sols[[n]]^(2 i)/(4 i + 3)! x^(4 i + 3), {i, 0, M}];
 Panel[Column[{Row[{"Single-Span:", 
      PopupMenu[
       Dynamic[beam], {1 -> "Free-Pinned", 2 -> "Clamped-Free"}], 
      Row[{"Mode:", SetterBar[Dynamic[n], Range[Length[sols]]]}]}],
    Dynamic[Plot[f[x, n], {x, 0, 1}, ImageSize -> Large]]}]]]

Which gives you a dynamic like this:

enter image description here

The SetterBar can be made to automatically resize based on how many modes there are in the solution. I obviously did not add any functionality to the beam type popup but you can do that. Use the dynamic variable "beam" to change your solution so the plot will change.

Regards,

Neil

POSTED BY: Neil Singer
Attachments:
POSTED BY: Saleh Baradaran
Posted 9 years ago

Perhaps

ClearAll["Global`*"];
M = 100;
sols = ? /. Table[FindRoot[Tanh[Sqrt[?]] - Tan[Sqrt[?]], {?, IG}], {IG, 10, 200, 50}];
f[x_, n_] := Sum[sols[[n]]^(2 i)/(4 i+2)! x^(4 i+2), {i,0,M}] - Sum[sols[[n]]^(2 i)/(4 i+2)!, {i,0,M}]/
     Sum[sols[[n]]^(2 i)/(4 i+3)!, {i,0,M}] Sum[sols[[n]]^(2 i)/(4 i+3)! x^(4 i+3), {i,0,M}];
n = Input["which mode do you want?"];
Plot[f[x, n], {x, 0, 1}]
POSTED BY: Bill Simpson

Thank you so much , yes your program is working , Thanks

I want to know if i want to put this program in loop or for , how can i do it? for example i want to say , ask user which beam do you want? if he say clamped free , the program choose clamped free that we define for it and do like the program above , then plot n mode for it ...

Thank you so much

POSTED BY: Saleh Baradaran

The error in your error is in red.

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