Message Boards Message Boards

0
|
2578 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Help repeatedly solving an algebraic equation with different parameter sets

Posted 11 years ago
I have an equation with two variables . I need to solve this about 25 times with different variables but I get a message that it timed out after 3 or 4 solutions. I signed up for Mathematica but can't understand how to operate it (I'm mathematically a novice). The equation is: o^4 - (o-2W)^4 = s^4 where I know S and  W and want to find o. Any direction will be much appreciated.

The equation is for the second moment of inertia. I am making a bamboo fly rod and want to know how much more bamboo I will have to add when I hollow the sections. I know the dimension of the solid cane (s) and the wall thickness (w) and want to find the value of (o, the dimension necessary to keep the moment of intertia the same as in the solid section).
POSTED BY: Barry Mayer
4 Replies
Posted 11 years ago
Barry:

If you can describe exactly how you want to provide the 25 different pairs of values then I'd be happy to try to modify the code to make this easier to do.

If you could provide your 25 different pairs in the form of

data={{4,12},{5.1,3.6},etc,etc,etc};

where the first number in each pair is S and the second is W then I could modify the code to use data as input.
POSTED BY: Bill Simpson
Posted 11 years ago
Hi Barry,
You're a brave man. Mathematica is quite a bit to take on for the solution to one problem. (But once learned it's a Swiss army knife for math!)
I did not try to look into the physics of the problem, and some of the results look a bit odd. But, here is Mathematica code that solves your equation and provides functions for evaluating the result. It looks bare because I deleted output rather than trying to paste it in in segments. But if you execute it in a notebook it should become clear -- I tired to provide enough comments to make it readable.
Best,
David
 (* the equation *)
 eq = o^4 - (o - 2 w)^4 == s^4
 
 (* solve the equation symbolically. Mathematica gives a list \
 containing 3 solutions.*)
 sol = Solve[eq, o]
 
 (* This substitutes real values for s and w and evaluates. Onlty the \
 first solution gives a ral number; the other 2 are complex. *)
sol /. s -> 0.419 /. w -> .064

(* This defines a function oo[s,w] as given by the first solution. *)


oo[s_, w_] = o /. sol[[1]]

(* Calling the function with a numbers for s and w returns the \
corresponding value of o. *)
oo[.419, .064]

(* Here is a list of values for s and w, written as a list of lists. *)


values = {
   {.419, .064},
   {.418, .063},
   {.130, .029},
   {.098, .024}
   };

(* This version of oo takes a list as an argment. *)

oo[{s_, w_}] = o /. sol[[1]]

(* We can map the function onto the list to get a set of resulting \
values for o. *)
oo /@ values

(* We can also make plots. *)

(* Here is a 3D surface over a range of s and w. *)
Plot3D[oo[s, w], {s, .098, .419}, {w, .024, .064},
AxesLabel -> {"S", "W", "O"}]

Plot[oo[0.419, w], {w, .001, .1}, PlotRange -> {0, All},
PlotLabel -> "S = 0.419", AxesLabel -> {"W", "O"}]
POSTED BY: David Keith
Posted 11 years ago
Perhaps this will help.

Reduce is a powerful tool to find solutions, but Mathematica often assumes some or all your variables might be complex numbers unless you tell it otherwise.  Assuming you are not going to be building a complex fishing pole we then tell Reduce to only consider certain cases.
 In[1]:= Reduce[o^4 - (o - 2 W)^4 == s^4 && {o, s, W} \[Element] Reals && o > 0 && s > 0 && W > 0, {o}]
 
 Out[1]= W > 0 && s > 0 && o == Root[-s^4 - 16 W^4 + 32 W^3 #1 - 24 W^2 #1^2 + 8 W #1^3 &, 1]
 
 In[2]:= solution = ToRadicals[Root[-s^4 - 16 W^4 + 32 W^3 #1 - 24 W^2 #1^2 + 8 W #1^3 &, 1]]
 
 Out[2]= W - (2 (2/3)^(1/3)W^3)/(9 s^4 W^2 + Sqrt[3] Sqrt[27 s^8 W^4 + 256 W^12])^(1/3) + (9 s^4 W^2 + Sqrt[3] Sqrt[27 s^8 W^4 + 256 W^12])^(1/3)/(2 2^(1/3) 3^(2/3) W)
 
 In[3]:= solution /. {s -> 6, W -> 1} // N
Out[3]= 6.39022

In[4]:= solution /. {s -> 5, W -> 2} // N
Out[4]= 5.00201

In[5]:= solution /. {s -> 8, W -> 1/2} // N
Out[5]= 10.5711

Even then as you can see from the output of Reduce is a root of a fourth power polynomial in s and W.
Fortunately ToRadicals can give us all the complicated messy details about what that root actually is.

Then we can substitute in various values for s and W and ask for a decimal approximation and get your results.

Try substituting your own values for s and W in steps 3,4,5,... and see if you get all the solutions you need.

If you need more help then post what you tried and we can see if we can help further.
Note: Those In[] and Out[] are provided by Mathematica, I only included those so you could see the steps I was taking.
POSTED BY: Bill Simpson
Posted 11 years ago
Bill,
Thank you for taking the time to help with this. I don't understand what program and where and how I am to insert the numbers for s and w. If it is in Mathematica, I am at a total loss in how to operate the program. I tried copying all of your post and also line by line into a new notebook and got a "Failed" answer for all. Obviously I haven't a clue about operating inside Mathematica. When I am confronted with a solution box with my equation in it in Wolfram Alpha I can input the numbers but very shortly I get the "out of time" statement and have to quit.
Some examples of the pairs of numbers I have to find solutions for are:
            S                         W
      .419                        .064
     .418                         .063
     .130                         .029
     .098                         .024
If there is any further guidance you can provide for this challenged mathematical mind, it will be much appreciated.
Barry
POSTED BY: Barry Mayer
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract