0
$\begingroup$

I have a quantity as below, P[k_0,A_]= A Log [k0]. I want to generate data for this for A={0,10^3} and k0=10^{-11} to 10^{-2} using a Do loop but I don't know how to apply a loop on two variables simultaneously. Can anyone please guide.

$\endgroup$
6
  • $\begingroup$ Outer[P[10^#1, #2] &, Range[-11, -2], Range[0, 10^3, 100]] Adjust as required. $\endgroup$ Commented Feb 28, 2023 at 17:37
  • $\begingroup$ Welcome to the Mathematica Stack Exchange. Another variation: P[k0_, A_] := A Log[k0] and res1 = Table[ P[k0, A], {k0, PowerRange[10^-11, 10^-2, 10]}, {A, 0, 10^3, 100}] // N $\endgroup$ Commented Feb 28, 2023 at 18:00
  • $\begingroup$ Thanks a lot for your reply. Is there any way to monitor the result during calculations. Since if I apply this trick to some variable which is being integrated then it takes a lot of time, and one cannot find any error or bug occurring during calculations until the final output. On the other hand, we can print the result in loop to monitor and stop the calculations immediately if there is any bug... $\endgroup$ Commented Feb 28, 2023 at 19:45
  • $\begingroup$ Similar to 43543. $\endgroup$ Commented Feb 28, 2023 at 20:32
  • $\begingroup$ Also relevant: 171402. $\endgroup$ Commented Feb 28, 2023 at 20:39

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.