Message Boards Message Boards

0
|
5717 Views
|
18 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Possible mistake in my Mathematica syntax for 4 springs and 3 masses

Posted 10 years ago
DSolve[{-2*x1 + x2 == x1'', -2*x2 + x1 == x2'',
  x1[0] == -1, x2[0] == 2, x1'[0] == 0, x2'[0] == 0}, {x1, x2}, t] produces a short and elegant result but when I extend the syntax to cover three masses and four springs, I get reams of complexity. I must be doing something wrong. This is the syntax: DSolve[{-2*x1 + x2 == x1'', -2*x2 + x3 + x1 ==
   x2'', -2*x3 + x2 == x3'', x1[0] == -1, x2[0] == 2,
  x3[0] == -1, x1'[0] == 0, x2'[0] == 0, x3'[0] == 0}, {x1, x2, x3},t] Have I made a mistake? Thanks for any help.
POSTED BY: Robert Jenkins
18 Replies
Posted 10 years ago
If you are trying to export a Complex number 3+4*I from Mathematica into an Excel .xls file and your Excel doesn't read that file in as containing a Complex number then that sounds like either a problem with Mathematica's Export of Complex numbers to .xls or with Excel's import of complex numbers from .xls or possibly that Excel might need a library loaded to be able to handle Complex numbers, as partly described here http://office.microsoft.com/en-us/excel-help/complex-HP005209019.aspx

I suggest you do this
In[1]:= Export["data.xls", 3 + 4*I]


Out[1] = "data.xls"
and then open data.xls with Excel and see what that single cell contains.

I think I might be seeing what you are seeing when you describe doing that, but I cannot be certain and I do not have the tools available to be able to track that down and figure out the answer for you.

Either way I urge you to create blindingly simple concrete specific examples that demonstrate exactly what your problem is. There are so many infinities of things than can be "something is wrong" that the number of possible answers to "what do I do" are at least equally infinite.

Now in this http://mathematica.stackexchange.com/questions/35547/export-complex-number-to-excel-or-txt-file Szabolcs claims that Excel doesn't support complex numbers without any addons. But maybe that link above about the Analysis Toolpack is an addon or maybe there was a misunderstanding.

Just as an experiment I would suggest you try creating the complex number 3+4*I in Excel using Excel's notation and methods, save the sheet and then Import that into Mathematica to see what happens. Maybe that might provide a clue for what direction to look.

Another completely different issue is that when I look at the result from the FullSimplify that I showed in the Export example a few messages ago I see that it is always a Real valued number. If you are expecting to Export 3 from Mathematica to Excel and get the complex number 3+0*I (using Excel's notation) when it gets there then I suspect this is going to be a completely different collection of problems to overcome.

Welcome to the world of trying to get programs to play well together. There are sometimes great advantages to doing everything within a single program, whether you choose Excel or Mathematica or name any of the thousands of other programming languages that have been created. You may have a different experience or opinion.
POSTED BY: Bill Simpson
Posted 10 years ago
Once again you've guided me in the right direction. I can now see that the problem lies in the difference between the xls and xlsx file extensions. The xlsx version of 3+4i introduced an asterisk when imported into Mathematica, but when saved in the 97-2003 version, the transfer was clean. What I am now trying to do is find a way of OPENING an xls file in the 97-2003 format. It seems to automatically convert to 2007 format (xlsx). (I have tried exporting 3+4I to a file with an xlsx extension, but it won't do it.)
POSTED BY: Robert Jenkins
Posted 10 years ago
Naughty me! I was so delighted to see the importation of the 3+4i without an asterisk that I failed to notice that the "i" is lower case. So it DIDN'T import the file as a number but as text (inside 3 lots of curly brackets). By the way, when exporting this number to Excel, it makes no difference whether an asterisk is included or not; it's there when I open the file in Excel, and when I try to do anything with it, I get a #NUM! So I'm no further forward.
POSTED BY: Robert Jenkins
Posted 10 years ago
  "If you are expecting to Export 3 from Mathematica to Excel and get the complex number 3+0*I (using Excel's notation) when it gets there then I suspect this is going to be a completely different collection of problems to overcome." Too right! I spent hours yesterday trying to find a way of getting a list of lists of two elements, and failed. Suitable penance for my earlier sloppiness, I think. However, exploring problems like these is a good way of getting to understand how programs work, and eventually I did meet with success in my main problem. Using your table to export to an xls file, I then imported that file back into Mathematica. I replaced the asterisk+capital I with lower case i, defined a table with the result, and re-exported to xls. I'm very grateful for all the tips and advice you have given me. Best wishes, Robert PS I wish this forum software were a bit easier to use.
POSTED BY: Robert Jenkins
Posted 10 years ago
Perhaps I made an error, so I just opened the data.xls file, it opened, the column of numbers seems to be
exactly the column of numbers that were in the table inside Mathematica.

If there is still a problem then please define "usable data in Excel" while imagining that the person you
are writing to has no idea what you are thinking or what you need to accomplish, has not been looking
over your shoulder for days or weeks and can only guess what you want based on the meaning of each
word in the message you post. If you need something in a precise format then please describe exactly
what that format is.

Thank you
POSTED BY: Bill Simpson
Posted 10 years ago
I want to be able to use the transferred data as complex numbers, but Excel 2007 doesn't seem to recognize them as such. The transferred numbers don't have the same format as ordinary complex numbers. For example, they have no spaces. I did a find/replace for the spaces, and that's fine. But when I try to do the same with the asterisks, the entire number disappears completely, both real and imaginary parts of it. It is not clear to me what the asterisks actually signify. The second one might just be multiplication, as usual; i.e. *i, but what about the first one? Multiplication doesn't make much sense there.
POSTED BY: Robert Jenkins
Posted 10 years ago
Perhaps this?
 In[1]:= v = FullSimplify[(Cos[6.59575411272515` t] - (0.` + 1.` I) Sin[6.59575411272515` t])
  (0.13875529245509138` Cos[4.663902460147014` t] + 0.06249999999999997` Cos[4.863703305156273` t] -
  0.6666666666666666` Cos[5.1815405503520555` t] - 0.3125` Cos[5.59575411272515` t] -
  0.22208862578842473` Cos[6.078116022520109` t] - 0.22208862578842473` Cos[7.113392202930192` t] -
  0.3125` Cos[7.59575411272515` t] - 0.6666666666666666` Cos[8.009967675098245` t] +
  0.06249999999999997` Cos[8.327804920294028` t] + 0.13875529245509138` Cos[8.527605765303287` t] +
  (0.` + 0.13875529245509138` I) Sin[4.663902460147014` t] + (0.` + 0.06249999999999997` I)
  Sin[4.863703305156273` t] - (0.` + 0.6666666666666666` I) Sin[5.1815405503520555` t] -
  (0.` + 0.3125` I) Sin[5.59575411272515` t] - (0.` + 0.22208862578842473` I)
Sin[6.078116022520109` t] - (0.` + 0.22208862578842473` I) Sin[7.113392202930192` t] -
(0.` + 0.3125` I) Sin[7.59575411272515` t] - (0.` + 0.6666666666666666` I)
Sin[8.009967675098245` t] + (0.` + 0.06249999999999997` I) Sin[8.327804920294028` t] +
(0.` + 0.13875529245509138` I) Sin[8.527605765303287` t])];
d = Table[v, {t, 0, 4 Pi, Pi/16}];
Export["data.xls", d]

Out[2]= "data.xls"
POSTED BY: Bill Simpson
Posted 10 years ago
Unfortunately this doesn't seem to produce usable data in Excel. I'm exploring various options and hopefully one of them will work.
POSTED BY: Robert Jenkins
Posted 10 years ago
I extended the series to five masses, and the result gets very complicated. I would like to export the data to Excel. It's easy to do with a spreadsheet or tabular data, but not so easy with the following. How can I do this? (Cos[6.59575411272515` t] - (0.` + 1.` I) Sin[
     6.59575411272515` t]) (0.13875529245509138` Cos[
     4.663902460147014` t] +
   0.06249999999999997` Cos[4.863703305156273` t] -
   0.6666666666666666` Cos[5.1815405503520555` t] -
   0.3125` Cos[5.59575411272515` t] -
   0.22208862578842473` Cos[6.078116022520109` t] -
   0.22208862578842473` Cos[7.113392202930192` t] -
   0.3125` Cos[7.59575411272515` t] -
   0.6666666666666666` Cos[8.009967675098245` t] +
   0.06249999999999997` Cos[8.327804920294028` t] +
   0.13875529245509138` Cos[
     8.527605765303287` t] + (0.` + 0.13875529245509138` I) Sin[
     4.663902460147014` t] + (0.` + 0.06249999999999997` I) Sin[
     4.863703305156273` t] - (0.` + 0.6666666666666666` I) Sin[
     5.1815405503520555` t] - (0.` + 0.3125` I) Sin[
     5.59575411272515` t] - (0.` + 0.22208862578842473` I) Sin[
     6.078116022520109` t] - (0.` + 0.22208862578842473` I) Sin[
     7.113392202930192` t] - (0.` + 0.3125` I) Sin[
     7.59575411272515` t] - (0.` + 0.6666666666666666` I) Sin[
     8.009967675098245` t] + (0.` + 0.06249999999999997` I) Sin[
     8.327804920294028` t] + (0.` + 0.13875529245509138` I) Sin[
     8.527605765303287` t])
POSTED BY: Robert Jenkins
Posted 10 years ago
I apologize for not being clear. There is often a severe problem of the lack of a common language between those trying to ask and those trying to answer questions here.

Now I fought and fought and fought the forum software to try to produce a simple compact code example showing you exactly what I meant.

I failed.

Here is a not repaired not-compact not-hundreds of extra blank lines deleted not-short lines joined example showing you exactly the steps I took.
  In[1]:= DSolve[{-2*x1[t] + x2[t] ==
  
     x1''[t], -2*x2[t] + x3[t] + x1[t] == x2''[t], -2*x3[t] + x2[t] ==
  
     x3''[t], x1[0] == -1, x2[0] == 2, x3[0] == -1, x1'[0] == 0,
  
    x2'[0] == 0, x3'[0] == 0}, {x1, x2, x3}, t]
  
  
 
 Out[1]= {{x1 ->
 
    Function[{t}, (E^(-I Sqrt[2 - Sqrt[2]] t -
 
         I Sqrt[2 + Sqrt[2]] t) (-2 E^(I Sqrt[2 - Sqrt[2]] t) +
 
          24 (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -
 
          16 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -
 
          8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(
 
           I Sqrt[2 - Sqrt[2]] t) + (
 
          8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 - Sqrt[2]] t))/Sqrt[
 
          2 - Sqrt[2]] -
 
          2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(
 
           I Sqrt[2 - Sqrt[2]] t) +
 
          2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(
 
           I Sqrt[2 - Sqrt[2]] t) +
 
          16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(
 
           I Sqrt[2 - Sqrt[2]] t) +
 
          8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(
 
           I Sqrt[2 - Sqrt[2]] t) -
 
          88 (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) +
 
          63 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) -
 
          8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(
 
           I Sqrt[2 + Sqrt[2]] t) + (
 
          8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 + Sqrt[2]] t))/Sqrt[
 
          2 - Sqrt[2]] -
 
          32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(
 
           I Sqrt[2 + Sqrt[2]] t) +
 
          16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(
 
           I Sqrt[2 + Sqrt[2]] t) +
 
          18 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(
 
           I Sqrt[2 + Sqrt[2]] t) +
 
          9 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(
 
           I Sqrt[2 + Sqrt[2]] t) -
 
          88 (2 + Sqrt[2]) E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +
 
          65 Sqrt[2] (2 + Sqrt[2]) E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -
 
          8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) + (
 
          8 (2 + Sqrt[2])^(3/2) E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/Sqrt[
 
          2 - Sqrt[2]] -
 
          32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +
 
          16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(
 
           2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +
 
          14 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         7 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         2 E^(I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         24 (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         16 Sqrt[2] (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) + (

         8 (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] +

         2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t)))/(32 (-2 +

          Sqrt[2]) Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] (-Sqrt[((

          2 + Sqrt[2])/(2 - Sqrt[2]))] + Sqrt[(2 (2 + Sqrt[2]))/(

         2 - Sqrt[2])]))],

  x2 -> Function[{t}, (E^(-I Sqrt[2 - Sqrt[2]] t -

        I Sqrt[2 + Sqrt[2]] t) (2 E^(I Sqrt[2 - Sqrt[2]] t) -

         2 Sqrt[2] E^(I Sqrt[2 - Sqrt[2]] t) -

         56 (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) +

         40 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) +

         16 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t) - (

         24 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 - Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] +

         6 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) -

         4 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) +

         8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) - 16 E^(I Sqrt[2 + Sqrt[2]] t) -

         16 Sqrt[2] E^(I Sqrt[2 + Sqrt[2]] t) -

         190 (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) +

         135 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) + (

         16 (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t))/(2 - Sqrt[2]) - (

         8 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t))/(

         2 - Sqrt[2]) -

         24 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 + Sqrt[2]] t) + (

         32 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) +

         24 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) -

         Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) -

         16 E^(2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -

         16 Sqrt[2] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -

         194 (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         137 Sqrt[2] (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) + (

         16 (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/(

         2 - Sqrt[2]) - (

         8 Sqrt[2] (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/(

         2 - Sqrt[2]) -

         24 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) + (

         32 (2 + Sqrt[2])^(3/2) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         24 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -

         2 E^(I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         2 Sqrt[2] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         56 (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         40 Sqrt[2] (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) - (

         24 (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         6 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         4 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t)))/(16 (-2 +

          Sqrt[2])^2 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] (-Sqrt[((

          2 + Sqrt[2])/(2 - Sqrt[2]))] + Sqrt[(2 (2 + Sqrt[2]))/(

         2 - Sqrt[2])]))],

  x3 -> Function[{t}, (E^(-I Sqrt[2 - Sqrt[2]] t -

        I Sqrt[2 + Sqrt[2]] t) (-2 E^(I Sqrt[2 - Sqrt[2]] t) +

         24 (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -

         16 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -

         8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t) + (

         8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 - Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) +

         2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) +

         16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) +

         8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t) -

         88 (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) +

         63 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) -

         8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 + Sqrt[2]] t) + (

         8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) +

         18 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) +

         9 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 + Sqrt[2]] t) -

         88 (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         65 Sqrt[2] (2 + Sqrt[2]) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -

         8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) + (

         8 (2 + Sqrt[2])^(3/2) E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] -

         32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         14 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         7 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

         2 E^(I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         24 (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         16 Sqrt[2] (2 + Sqrt[2]) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) + (

         8 (2 + Sqrt[2])^(3/2) E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t))/Sqrt[

         2 - Sqrt[2]] +

         2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

         2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

         8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

          I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t)))/(32 (-2 +

          Sqrt[2]) Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] (-Sqrt[((

          2 + Sqrt[2])/(2 - Sqrt[2]))] + Sqrt[(2 (2 + Sqrt[2]))/(

         2 - Sqrt[2])]))]}}



In[2]:= FullSimplify[(E^(-I Sqrt[2 - Sqrt[2]] t -

     I Sqrt[2 + Sqrt[2]] t) (-2 E^(I Sqrt[2 - Sqrt[2]] t) +

      24 (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -

      16 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 - Sqrt[2]] t) -

      8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

       I Sqrt[2 - Sqrt[2]] t) + (

      8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 - Sqrt[2]] t))/Sqrt[

      2 - Sqrt[2]] -

      2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(I Sqrt[2 - Sqrt[2]] t) +

      2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t) +

      16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t) +

      8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t) -

      88 (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) +

      63 Sqrt[2] (2 + Sqrt[2]) E^(I Sqrt[2 + Sqrt[2]] t) -

      8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

       I Sqrt[2 + Sqrt[2]] t) + (

      8 (2 + Sqrt[2])^(3/2) E^(I Sqrt[2 + Sqrt[2]] t))/Sqrt[

      2 - Sqrt[2]] -

      32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

       I Sqrt[2 + Sqrt[2]] t) +

      16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

       I Sqrt[2 + Sqrt[2]] t) +

      18 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 + Sqrt[2]] t) +

      9 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 + Sqrt[2]] t) -

      88 (2 + Sqrt[2]) E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

      65 Sqrt[2] (2 + Sqrt[2]) E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) -

      8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) + (

      8 (2 + Sqrt[2])^(3/2) E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t))/Sqrt[

      2 - Sqrt[2]] -

      32 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

      16 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

      14 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

      7 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       2 I Sqrt[2 - Sqrt[2]] t + I Sqrt[2 + Sqrt[2]] t) +

      2 E^(I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

      24 (2 + Sqrt[2]) E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

      16 Sqrt[2] (2 + Sqrt[2]) E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

      8 Sqrt[2/(2 - Sqrt[2])] (2 + Sqrt[2])^(3/2) E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) + (

      8 (2 + Sqrt[2])^(3/2) E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t))/Sqrt[

      2 - Sqrt[2]] +

      2 Sqrt[(2 + Sqrt[2])/(2 - Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) -

      2 Sqrt[(2 (2 + Sqrt[2]))/(2 - Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

      16 Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t) +

      8 Sqrt[2 (2 - Sqrt[2]) (2 + Sqrt[2])] E^(

       I Sqrt[2 - Sqrt[2]] t + 2 I Sqrt[2 + Sqrt[2]] t)))/(32 (-2 +

      Sqrt[2]) Sqrt[(2 - Sqrt[2]) (2 + Sqrt[2])] (-Sqrt[((

       2 + Sqrt[2])/(2 - Sqrt[2]))] + Sqrt[(2 (2 + Sqrt[2]))/(

      2 - Sqrt[2])]))]



Out[2]= 1/2 ((-1 + Sqrt[2]) Cos[

     Sqrt[2 - Sqrt[2]] t] - (1 + Sqrt[2]) Cos[Sqrt[2 + Sqrt[2]] t])
If you study that carefully you can perhaps see what I scraped out of the inside of

Out[ 1 ] = {{ x->Function[ { t } ,... ]

to paste into

In[ 2 ] := FullSimplify[ ... ] 

and perhaps then what I wrote in the previous message will make more sense.
POSTED BY: Bill Simpson
Posted 10 years ago
Thanks. That was a great explanation. I now have three single-line functions. But when I try to plot them, I'm only allowed to do this one at a time. Isn't there a way to plot all three in the same graph?
POSTED BY: Robert Jenkins
Posted 10 years ago
Please ignore my last post. I've found out how to do it. Very many thanks for all your help. RJ
POSTED BY: Robert Jenkins
Posted 10 years ago
Click the "red spikey ball" which opens an empty little rectangle and SelectCopyPaste code from your Notebook into the rectangle. Then manually clean that up. Then post. Then edit to fix the formatting changes it still introduced, usually introducing extra NewLines, and finally save again.

Alternately, manually inserting a space before and after every bracket can sometimes confuse the forum software into leaving the brackets alone.

Now If you wrestle with Mathematica until you force it to Simplify[ N [ theExpressionOfYourFunction ] ] , not just trying to tell it to Simplify the whole function, you should find your functions are all no more complicated than.
0.103553(E^(0.765367 I t)+E^(-0.765367 I t)) -0.603553(E^(1.84776 I t)-E^(-1.84776 I t))
Or by scraping the second argument to your Function[ {t}, theExpressionOfYourFunction ] and pasting that into a new cell and wrapping FullSimplify around it you may even get something as simple as
1/2((-1+Sqrt[2])Cos[Sqrt[2-Sqrt[2]]t]-(1+Sqrt[2])Cos[Sqrt[2+Sqrt[2]]t])
And if you want to have more than one little empty rectangle to post code then you may have to repeatedly fiddle with it to keep it from pasting your second block of code onto the end of the first block, even if you repeatedly undo that and try that again. And again. And again. There is something not obvious about characters outside the box that are involved with that.
POSTED BY: Bill Simpson
Posted 10 years ago
I'm very interested in what you have written but I'm afraid I'm having difficulty in understanding you. What exactly do you mean by theExpressionOfYourFunction?
POSTED BY: Robert Jenkins
Code is clearer when formatted in code boxes. See
   http://community.wolfram.com/groups/-/m/t/151347,
under
     General tips 
         - For Mathematica code
POSTED BY: Bruce Miller
I don't understand how you got any answers without putting arguments in the variables. It should look like <pre class="mcode_edit">DSolve[{-2*x1 + x2 == x1'', -2*x2 + x3 + x1 == <br>&nbsp;&nbsp; x2'', -2*x3 + x2 == x3'', x1[0] == -1, x2[0] == 2, <br>&nbsp; x3[0] == -1, x1'[0] == 0, x2'[0] == 0, x3'[0] == 0}, {x1, x2, x3},<br>&nbsp; t]</pre>Yes, the solution is complicated, but so is your problem.&nbsp; Did you try substituting the solution into the problem?
POSTED BY: Frank Kampas
Posted 10 years ago
I don't understand how all my 's disappeared. I did a block copy of the syntax in my Mathematica notebook. Anyhow, I posted the same message on another mathematics forum (with the 's intact) and got two useful replies which solved my problem. Many thanks to everyone for their help. RJ
POSTED BY: Robert Jenkins
Posted 10 years ago
All the square brackets t close brackets disappeared again! 
POSTED BY: Robert Jenkins
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