0
$\begingroup$

Variable x is supposed to be constant, but the program calculates for each variable x, 100 numbers of x. I want all my x variables to have the same definition, but the program constantly changes each x variable's definition.

https://1drv.ms/u/s!AqOJ6xqR2PKjglEgVfbcNx8XyKX5?e=SdAOHZ

$\endgroup$
  • $\begingroup$ Your definition x=Table[...] creates a list called x. Please clarify what you want to calculate! $\endgroup$ – Ulrich Neumann Aug 13 at 13:18
2
$\begingroup$

I'm not sure I've understood your NB, but probably this is what you want:

ddQ2[x_] = \!\(\*SubsuperscriptBox[\(\[Integral]\), \(x\), \(1\)]\(z \((1 - 
z)\)*\((0.288554*\*SuperscriptBox[\((1 - \*FractionBox[\(x\), \(z\)])\), \(0.435 - 
1\)]/\*SqrtBox[FractionBox[\(x\), \(z\)]])\) \[DifferentialD]z\)\)

Then make ListPlot:

ListPlot[ddQ2[#] & /@ Table[j/100, {j, 1, 100}],PlotRange->All]

enter image description here

$\endgroup$
  • $\begingroup$ Equivalent in InputForm. ddQ2[x_] = Integrate[ z*(1 - z)*(0.288554*((1 - x/z)^(0.435 - 1)/Sqrt[x/z])), {z, x, 1}] $\endgroup$ – Rohit Namjoshi Aug 13 at 17:24
0
$\begingroup$
x = Table[j/100, {j, 1, 100}];

Since x is a List, Map the integration onto the List. Since you are using inexact numbers, NIntegrate is as good as Integrate and is much faster.

{#, Integrate[z*(1 - z)*(0.288554*((1 - #/z)^(0.435 - 1)/
                Sqrt[#/z])), {z, #, 1}]} &[1/2] // AbsoluteTiming

(* {0.524199, {1/2, 0.0838901}} *)

{#, NIntegrate[z*(1 - z)*(0.288554*((1 - #/z)^(0.435 - 1)/
                Sqrt[#/z])), {z, #, 1}]} &[1/2] // AbsoluteTiming

(* {0.007069, {1/2, 0.0838901}} *)

 ddQ2 = {#, NIntegrate[z*(1 - z)*(0.288554*((1 - #/z)^(0.435 - 1)/
                 Sqrt[#/z])), {z, #, 1}]} & /@ x;

ListPlot[ddQ2, AxesLabel -> {"x", "ddQ2"}]

enter image description here

$\endgroup$

Your Answer

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

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