Skip to main content
1 of 7
BowPark
  • 315
  • 2
  • 8

Plotting on a table of points

I am using Wolfram Mathematica 11. Given these quantities:

Ja = BesselJ[0, X]; Jap = -BesselJ[1, X];
v = 3; Y = Sqrt[v^2 - X^2];
Ka = BesselK[0, Y]; Kap = -BesselK[1, Y];
side1 = Jap / (X*Ja); side2 = -Kap / (Y*Ka);

I would like to obtain the same as:

Plot[{side1,side2}, {X, 0, 10}]

but on a .txt file, simply containing a table of values in this notation:

 0.0000000000e+00 -inf -inf
 3.0060120240e-02 -2.3042094212e+00 -2.1217639107e+01
 6.0120240481e-02 -1.8613440179e+00 -1.0654661322e+01

First column should list the X values; second column should list the corresponding side1 values; third column the corresponding side2 values.

How is it possible, with and without adaptive sampling?


This is my naive attempt to adapt code from this answer, at least for the plot of the first function side1:

data = Cases[Plot[side1@X, {X, 0, 10}], Line[data_] :> data, -4, 
    1][[1]];
Export["file.txt", data, "Table"]

but it generates an error:

Part: Part 1 of {} does not exist
BowPark
  • 315
  • 2
  • 8