Dkunb

65 Reputation

4 Badges

2 years, 341 days

MaplePrimes Activity


These are questions asked by Dkunb

I wonder if there is any way to use ArrayInterpolation with contourplot or similar effect?

N_data.xlsx 

Thank you in advance,

restart;

with(CurveFitting)

[ArrayInterpolation, BSpline, BSplineCurve, Interactive, LeastSquares, Lowess, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

(1)

with(plots);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

alpha := <seq(0..10,evalf(10/50))>:
beta := <seq(0..10,evalf(10/50))>:

excelfile:= FileTools:-JoinPath(["C:","Users","aimer","OneDrive","Desktop","Msc Thesis","Maple ref","N_data.xlsx"]);

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx"

(3)

NN:=ImportMatrix(excelfile,source=Excel):

_rtable[36893489576445216036]

(4)

#?ImportMatrix;

#NN:=ImportMatrix(matlabData, source=MATLAB);

#currentdir();

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref"

(5)

 

contourplot(ArrayInterpolation([beta,alpha],NN,[x,y]),x=0..10,y=0..10,contours=[0]);

Error, (in CurveFitting:-ArrayInterpolation) invalid input: xvalues are not specified correctly

 

#?listcontplot

 

Download test1.mw

I do not know what is the problem with Using ImportMatrix. N_data.xlsx is in the same directory.

Any comment would be appreciated.

restart;

with(CurveFitting)

[ArrayInterpolation, BSpline, BSplineCurve, Interactive, LeastSquares, Lowess, PolynomialInterpolation, RationalInterpolation, Spline, ThieleInterpolation]

(1)

with(plots);

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

alpha := <seq(0..10,evalf(10/50))>:
beta := <seq(0..10,evalf(10/50))>:

excelfile:= FileTools:-JoinPath(["C: ","Users","aimer","OneDrive","Desktop","Msc Thesis","Maple ref","N_data.xlsx"]);

"C: \Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx"

(3)

NN:=ImportMatrix(excelfile,source=Excel);

Error, (in ImportMatrix) file or directory does not exist: C: \Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref\N_data.xlsx

 

?ImportMatrix;

#NN:=ImportMatrix(matlabData, source=MATLAB);

currentdir();

"C:\Users\aimer\OneDrive\Desktop\Msc Thesis\Maple ref"

(4)

?Joinpath

 

Download test1.mw

What should I do to reduce evaluating time?

restart;

with(plots):

 

F:=kappa->kappa;

proc (kappa) options operator, arrow; kappa end proc

(1)

f:=(alpha,delta)->exp(-abs(F(kappa))^2*(1+delta^2)/2-abs(F(kappa))*alpha)/abs(F(kappa));

proc (alpha, delta) options operator, arrow; exp(-(1/2)*abs(F(kappa))^2*(1+delta^2)-abs(F(kappa))*alpha)/abs(F(kappa)) end proc

(2)

L:=(alpha,delta,Lambda)->(lambda^2*exp(-alpha^2/2)/4)*(Int(f(alpha,delta),kappa= -infinity..-Lambda)+Int(f(alpha,delta),kappa= Lambda..infinity));

proc (alpha, delta, Lambda) options operator, arrow; (1/4)*lambda^2*exp(-(1/2)*alpha^2)*(Int(f(alpha, delta), kappa = -infinity .. -Lambda)+Int(f(alpha, delta), kappa = Lambda .. infinity)) end proc

(3)

evalf(L(4,1,0.001));

0.8209373770e-3*lambda^2

(4)

g:=(beta,delta)->exp(-I*kappa*beta-abs(F(kappa))^2*(1+delta^2)/2)/abs(F(kappa));

proc (beta, delta) options operator, arrow; exp(-I*kappa*beta-(1/2)*abs(F(kappa))^2*(1+delta^2))/abs(F(kappa)) end proc

(5)

E:=(omega,gamma)->exp(I*omega*gamma)*(1-erf((gamma+I*omega)/sqrt(2)));

proc (omega, gamma) options operator, arrow; exp(I*omega*gamma)*(1-erf((gamma+I*omega)/sqrt(2))) end proc

(6)

J:=(alpha,delta,Lambda,beta,gamma)->(lambda^2*exp(-alpha^2/2)/8)*abs(Int(g(beta,delta)*(E(abs(F(kappa)),gamma)+E(abs(F(kappa)),-gamma)),kappa=-infinity..-Lambda)+Int(g(beta,delta)*(E(abs(F(kappa)),gamma)+E(abs(F(kappa)),-gamma)),kappa=Lambda..infinity));

proc (alpha, delta, Lambda, beta, gamma) options operator, arrow; (1/8)*lambda^2*exp(-(1/2)*alpha^2)*abs(Int(g(beta, delta)*(E(abs(F(kappa)), gamma)+E(abs(F(kappa)), -gamma)), kappa = -infinity .. -Lambda)+Int(g(beta, delta)*(E(abs(F(kappa)), gamma)+E(abs(F(kappa)), -gamma)), kappa = Lambda .. infinity)) end proc

(7)

#evalf(J(4,1,0.001,8,3));

N := (beta,alpha)-> (J(alpha,1,0.001,beta,3)-L(alpha,1,0.001))/\lambda^2;

proc (beta, alpha) options operator, arrow; (J(alpha, 1, 0.1e-2, beta, 3)-L(alpha, 1, 0.1e-2))/lambda^2 end proc

(8)

 

 

 

 

 

 

contourplot(evalf(N(beta,alpha)), beta=0..10,alpha=0..10,grid=[25,25]);

 

 

 

 

Download Negativity_v1.mw


 

restart;

assume(alpha>0)

assume(delta:: real)

assume(C>0)

 

f:= g->e^(-1/2*(C*g*(1-g^2))^2*(1+delta^2)-C*g*(1-g^2)*alpha)/(g*(1-g^2));

proc (g) options operator, arrow; e^(-(1/2)*C^2*g^2*(1-g^2)^2*(delta^2+1)-C*g*(1-g^2)*alpha)/(g*(1-g^2)) end proc

(1)

convert(1/(g*(1-g^2)),parfrac,g);

-(1/2)/(g+1)+1/g-(1/2)/(g-1)

(2)

f1:= g->-e^(-1/2*(C*g*(1-g^2))^2*(1+delta^2)-C*g*(1-g^2)*alpha)/(2*(g+1));

proc (g) options operator, arrow; -e^(-(1/2)*C^2*g^2*(1-g^2)^2*(delta^2+1)-C*g*(1-g^2)*alpha)/(2*g+2) end proc

(3)

f2 := g->e^(-1/2*(C*g*(1-g^2))^2*(1+delta^2)-C*g*(1-g^2)*alpha)/g;

proc (g) options operator, arrow; e^(-(1/2)*C^2*g^2*(1-g^2)^2*(delta^2+1)-C*g*(1-g^2)*alpha)/g end proc

(4)

f3:= g->-e^(-1/2*(C*g*(1-g^2))^2*(1+delta^2)-C*g*(1-g^2)*alpha)/(2*(g-1));

proc (g) options operator, arrow; -e^(-(1/2)*C^2*g^2*(1-g^2)^2*(delta^2+1)-C*g*(1-g^2)*alpha)/(2*g-2) end proc

(5)

int(f1(g),g=0..infinity);

int(-e^(-(1/2)*C^2*g^2*(-g^2+1)^2*(delta^2+1)-C*g*(-g^2+1)*alpha)/(2*g+2), g = 0 .. infinity)

(6)

 


 

Download 2022_integralIandJ.mw

I do not know why eq(6) does not evaluate. Could you help me?

I have the following warnings. Could you help me fix the problem?

restart;

deS:=diff(x(t),t)=-0.5*x(t)*y(t)

diff(x(t), t) = -.5*x(t)*y(t)

(1)

deI:=diff(y(t),t)=0.5*x(t)*y(t)-0.15*y(t)

diff(y(t), t) = .5*x(t)*y(t)-.15*y(t)

(2)

with(DEtools):

DEplot([deS,deI],[x(t),y(t)],t=0..40,x=0..1,y=0..0.6,[[x(0)=0.99,y(0)=0]])

Warning, plot may be incomplete, the following errors(s) were issued:
   incorrect number of arguments, got 51, expected 50

 

 

 

 

Download DEtools_example.mw

1 2 3 4 5 Page 5 of 5