2
$\begingroup$

I would like to produce a table

Table1=Table[{j,j^2},{j,0.0001,Pi,Deltaj}]

where Deltaj is 0.0001 for j < 5*10^-3 and 0.01 otherwise. How to do this?

$\endgroup$

2 Answers 2

3
$\begingroup$

Define the $j$-dependent step size:

Δ[j_] = Piecewise[{{0.0001, j < 5*10^-3}, {0.01, j >= 5*10^-3}}];

Make a list of $j$-values to use:

With[{start = 0.0001, end = π},
  jvalues = NestWhileList[# + Δ[#] &, start, # <= end &, 1, ∞, -1]]

{0.0001, 0.0002, 0.0003, 0.0004, 0.0005, 0.0006, 0.0007, 0.0008, 0.0009, 0.001, 0.0011, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.0017, 0.0018, 0.0019, 0.002, 0.0021, 0.0022, 0.0023, 0.0024, 0.0025, 0.0026, 0.0027, 0.0028, 0.0029, 0.003, 0.0031, 0.0032, 0.0033, 0.0034, 0.0035, 0.0036, 0.0037, 0.0038, 0.0039, 0.004, 0.0041, 0.0042, 0.0043, 0.0044, 0.0045, 0.0046, 0.0047, 0.0048, 0.0049, 0.005, 0.015, 0.025, 0.035, 0.045, 0.055, 0.065, ..., 3.115, 3.125, 3.135}

Evaluate the table over these $j$-values:

Table[{j, j^2}, {j, jvalues}]

{{0.0001, 1.*10^-8}, {0.0002, 4.*10^-8}, {0.0003, 9.*10^-8}, {0.0004, 1.6*10^-7}, {0.0005, 2.5*10^-7}, {0.0006, 3.6*10^-7}, {0.0007, 4.9*10^-7}, {0.0008, 6.4*10^-7}, {0.0009, 8.1*10^-7}, {0.001, 1.*10^-6}, {0.0011, 1.21*10^-6}, {0.0012, 1.44*10^-6}, {0.0013, 1.69*10^-6}, {0.0014, 1.96*10^-6}, {0.0015, 2.25*10^-6}, {0.0016, 2.56*10^-6}, {0.0017, 2.89*10^-6}, {0.0018, 3.24*10^-6}, {0.0019, 3.61*10^-6}, {0.002, 4.*10^-6}, {0.0021, 4.41*10^-6}, {0.0022, 4.84*10^-6}, {0.0023, 5.29*10^-6}, {0.0024, 5.76*10^-6}, {0.0025, 6.25*10^-6}, {0.0026, 6.76*10^-6}, {0.0027, 7.29*10^-6}, {0.0028, 7.84*10^-6}, {0.0029, 8.41*10^-6}, {0.003, 9.*10^-6}, {0.0031, 9.61*10^-6}, {0.0032, 0.00001024}, {0.0033, 0.00001089}, {0.0034, 0.00001156}, {0.0035, 0.00001225}, {0.0036, 0.00001296}, {0.0037, 0.00001369}, {0.0038, 0.00001444}, {0.0039, 0.00001521}, {0.004, 0.000016}, {0.0041, 0.00001681}, {0.0042, 0.00001764}, {0.0043, 0.00001849}, {0.0044, 0.00001936}, {0.0045, 0.00002025}, {0.0046, 0.00002116}, {0.0047, 0.00002209}, {0.0048, 0.00002304}, {0.0049, 0.00002401}, {0.005, 0.000025}, {0.015, 0.000225}, {0.025, 0.000625}, {0.035, 0.001225}, {0.045, 0.002025}, {0.055, 0.003025}, {0.065, 0.004225}, ..., {3.115, 9.70322}, {3.125, 9.76562}, {3.135, 9.82822}}

$\endgroup$
4
$\begingroup$
 Union[
 Table[{j, j^2}, {j, 0, .005, .0001}],
 Table[{j, j^2}, {j, 0.005, .05, .001}]
 ]

or

timelist = Table[Exp[j], {j, 1, 10}];
Table[{timelist[[i]], timelist[[i]]^2}, {i, Length[timelist]}
 ]
$\endgroup$
1
  • $\begingroup$ Thank you. However, I am looking for something like Deltaj[j] which takes different values for different js. $\endgroup$ Jun 11, 2019 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.