(*befor finding the root for a lower stiffness use NSlove to find , \
then put that value back on the Rootfind and find the beta for \
varying stiffness *)
k = 10^12;(*1*10^b;*)
a = 1/(4*b^3*(1 + Cosh[b]*Cos[b]));
a1 = (Cos[b*x] - Cosh[b*x]);
a2 = (Sin[b*x] - Sinh[b*x]);
phi1 = (Cos[b] + Cosh[b])*(Sin[b*(1 - i)] + Sinh[b*(1 - i)]);
phi2 = (Sin[b] + Sinh[b])*(Cos[b*(1 - i)] + Cosh[b*(1 - i)]);
phi3 = (Sin[b] - Sinh[b])*(Sin[b*(1 - i)] + Sinh[b*(1 - i)]);
phi4 = (Cos[b] + Cosh[b])*(Cos[b*(1 - i)] + Cosh[b*(1 - i)]);
eq = a*((phi1 - phi2)*(a1 /. x -> i) + (phi3 + phi4)*(a2 /. x -> i));
eq1 = 1 + (k*eq);
t1 = Table[eq1, {i, 0.01, 0.5, 0.01}];

m = 5;
f[x_] := t1[[m]] /. b -> x;
p = Plot[{f[x], 0.}, {x, 0.1, 30}, PlotPoints -> 350];
intersections = Graphics`Mesh`FindIntersections[p] // Chop
Export["myFile.xls", intersections[[All, 1]]]
intersections = Graphics`Mesh`FindIntersections[p] // Chop
Labeled[Show[p, Frame -> True, Axes -> False, 
  Epilog -> {PointSize[.025], Red, Point[intersections]}], 
 Style[#, 20] &@Column[N[intersections, 10], Frame -> All], Right]

Right now I am facing a problem where I want to export the output of mathematica to excel, but each time in different column of the excel file. But all i am getting is overwritten in the same column. how to overcome this

  • 4
    $\begingroup$ Most programs would find this difficult. Writing to successive rows is relatively easy (well for CSV or TSV it is; XLSX is a nasty format to work with in general). But if your data isn't massive (which it isn't if you're planning on having it in XLSX / opening it in Excel) you should be able to just build the entire thing in memory and export once. $\endgroup$ – b3m2a1 Jan 11 '18 at 8:11
  • $\begingroup$ For each value of my 'm', the roots are going to change, I want to export those for every value of m $\endgroup$ – Vijay Kumar S Jan 11 '18 at 8:31
  • 3
    $\begingroup$ So build a list of the roots and export that list each time you change it. If you're worried about quitting and restoring just reimport the list at the beginning of a session. $\endgroup$ – b3m2a1 Jan 11 '18 at 8:32
  • 1
    $\begingroup$ I would absolutely aggree with b3m2a1 that XLS is just the wrong choice for the task at hand. I also would recommend to use some other format during computation and if desired only store the final result in XLS. If you use CSV during computation you can just open that with Excel anyway. Is there any good reason why you want XLS for the intermediate storage? $\endgroup$ – Albert Retey Jan 11 '18 at 9:38
  • $\begingroup$ Alternatively, you can build up the computation in a CSV file (using PutAppend, Write or WriteString) and then finish by converting that CSV to XLSX. $\endgroup$ – Sjoerd Smit Jan 11 '18 at 11:01

Your Answer

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

Browse other questions tagged or ask your own question.