Skip to main content
added 7 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica(v12.2) & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

aa = modelLN2[1., 1., 1., 1., 1., 1., 1.]; // AbsoluteTiming (* 3.81s *) Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] (* 0.14s *) 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

aa = modelLN2[1., 1., 1., 1., 1., 1., 1.]; // AbsoluteTiming (* 3.81s *) Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] (* 0.14s *) 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica(v12.2) & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

aa = modelLN2[1., 1., 1., 1., 1., 1., 1.]; // AbsoluteTiming (* 3.81s *) Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] (* 0.14s *) 
added 100 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

aa = modelLN2[1., 1., 1., 1., 1., 1., 1.]; // AbsoluteTiming (* 3.81s *) Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] (* 0.14s *) 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

aa = modelLN2[1., 1., 1., 1., 1., 1., 1.]; // AbsoluteTiming (* 3.81s *) Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] (* 0.14s *) 
added 56 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] 

Just an addition to @HenrikSchumacher`s nice answer.

Without compilation (incl. fast C-compiler) Mathematica & Gaussian quadrature evaluates ~25times faster than QP's result aa . Not so bad I think.

Needs["NumericalDifferentialEquationAnalysis`"]; xi = Subdivide[0. , 4.0, 10 ]; xwGauss =Flatten[Map[GaussianQuadratureWeights[9(*5*), #[[1]], #[[2]]] & ,Partition[xi, 2, 1]], 1] ; int = Module[{AN = 1., tN = 1., tr = 1., ALN = 1. , xmf = 1., w = 1., y0 = 1. }, Table[AN*Exp[-(i*0.128 - 0.128)/tN] + Exp[-(i*0.128 - 0.128)/tr]* Total@Map[(ALN*Exp[-(1/w^2)*(Log[#[[1]]/xmf])^2]* Exp[-#[[1]]*(i*0.128 - 0.128)]) #[[2]] &, xwGauss], {i, 1.0, 5000.0, 1.0}] ] 
added 2 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66
Loading
added 33 characters in body
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66
Loading
Source Link
Ulrich Neumann
  • 61.8k
  • 2
  • 30
  • 66
Loading