0

I have the following functional, it depends of n, m and U, so I want to automatize the calculations for all the regimes and be able to export it in a way I can copy and the past the values easily.

                            de.du directly from FVC - u > 0 and n < 1 
                In the data files we still need to consider u<0 and n>1 transformations to get w2.

                Clear[n, m, u, w, bint, beta, g, dg, bb, dbb, gama, dgama, fvc, defvc]
                {beta[0] = 2, beta[Infinity] = 1}

                {2, 1}

                beta

                bint[u_] := If[u != 0,
                  NIntegrate[BesselJ[0, x] BesselJ[1, x]/(x + x Exp[u 
                          x/2]), {x, 0, Infinity}]]
                beta[u_] := x /. FindRoot[(x/Pi) Sin[Pi/x] == 2 bint[u], {x, 1, 0, 2}]


                efvc 

                bb[n_, m_, u_] := beta[u]^alpha[n, m, u]

                alpha[n_, m_, u_] := ((n^2 - m^2)/n^(15/8))^CubeRoot[u]

                gamma[n_, m_, u_] := 2 Exp[(Sqrt[u])/(1 - (m/n)^(3/2))]

                ClearAll[efvc]
                efvc[n_, m_, u_] /; n == 0 := 0
                efvc[n_, m_, u_] /; n == m := -(2/Pi)*Sin[Pi*n]
                efvc[n_, m_, 
                  u_] := -(((2 bb[n, m, u])/Pi)) (Sin[(Pi*n)/(bb[n, m, u])]) (Cos[(Pi*m)/
                     gamma[n, m, u]])

EDIT: Here are some of the values I need:

            n           m           U
            0           0           6
            0.104716449 8.84874E-05 6
            0.206578089 0.000825568 6
            0.30157079  0.000365564 6
            0.410605405 0           6
            0.506677627 0           6
            0.61058781  0.000617136 6
            0.707025022 0           6
            0.802439886 8.29668E-05 6
            0.90571184  0.00125702  6
            0.994287239 0.004617097 6

It doesn't follow an exact interval between each point.

1 Answers1

1

Using

values={{0, 0, 6}, {0.104716, 0.0000884874, 6}, {0.206578, 0.000825568, 6}, {0.301571, 0.000365564, 6}, {0.410605, 0, 6}, {0.506678, 0, 6}, {0.610588, 0.000617136, 6}, {0.707025, 0, 6}, {0.80244, 0.0000829668, 6}, {0.905712, 0.00125702, 6}, {0.994287, 0.0046171, 6}}

You can do

Table[ efvc @@ v, {v, values} ]

You can see I've used Apply (@@).


Since you're new to Mathematica, I suggest trying out the following to see how these things work, as well as looking at the docs :

Table[ v, {v, {1,2,3} } ]
Table[ v, {v, values} ]
Table[ f[v], {v, values} ]
f @@ {1,2,3}
Table[ f@@v, {v, values} ]

(Here f is just a symbol with no definition, so it will remain unevaluated.)

jjc385
  • 3,473
  • 1
  • 17
  • 29