MaplePrimes Questions

please help me export data of for(do) to excel


 

restart

Digits := 8

with(plots)

with(CurveFitting)

with(plottools)

with(ExcelTools)

v := .7

Disp := 20

esp := 1000000

k := 0

E := proc (x, t) options operator, arrow; Int(exp((-esp*w^4+Disp*w^2+k)*t)*cos(w*(x+v*t))/Pi, w = 0 .. infinity, epsilon = 0.1e-6) end proc

proc (x, t) options operator, arrow; Int(exp((-esp*w^4+Disp*w^2+k)*t)*cos(w*(x+v*t))/Pi, w = 0 .. infinity, epsilon = 0.1e-6) end proc

(1)

"f(x):=15.5*(e)^((-(x-12590)^(2))/(3710000))+14.55*(e)^((-(x-16100)^(2))/(3000000)):"

NULL

u := proc (x, t) options operator, arrow; Int(E(x-xi, t)*f(xi), xi = 0 .. 0.2e5, epsilon = 0.1e-4) end proc

proc (x, t) options operator, arrow; Int(E(x-xi, t)*f(xi), xi = 0 .. 0.2e5, epsilon = 0.1e-4) end proc

(2)

NULL

NULL

uu := evalf(Int(E(0-xi, i)*f(xi), xi = 0 .. 20000, method = _NCrule, epsilon = 10^(-6)))

Int((Int(.31830988*exp((-1000000.*w^4+20.*w^2)*i)*cos(w*(-1.*xi+.7*i)), w = 0. .. Float(infinity)))*(15.5*exp(-0.26954178e-6*(xi-12590.)^2)+14.55*exp(-0.33333333e-6*(xi-16100.)^2)), xi = 0. .. 20000.)

(3)

for i from 0 by 300 to 39000 do evalf(Int(E(0-xi, 39000-i)*f(xi), xi = 0 .. 20000, method = _NCrule, epsilon = 10^(-6))) end do

-0.40453181e-3

 

0.34992127e-3

 

0.12637278e-2

 

0.16816398e-2

 

0.98280208e-3

 

-0.90049939e-3

 

-0.31323275e-2

 

-0.41557391e-2

 

-0.25326936e-2

 

0.18889271e-2

 

0.72213081e-2

 

0.99627384e-2

 

0.68245493e-2

 

-0.27701468e-2

 

-0.15052225e-1

 

-0.22679194e-1

 

-0.18343538e-1

 

0.20091767e-3

 

0.26631663e-1

 

0.47005735e-1

 

0.46070677e-1

 

0.16544944e-1

 

-0.33724783e-1

 

-0.81923601e-1

 

-0.99668403e-1

 

-0.68223938e-1

 

0.83269218e-2

 

.10029034

 

.16367514

 

.16160510

 

0.85214080e-1

 

-0.37861317e-1

 

-.15374440

 

-.20787576

 

-.17365568

 

-0.69367811e-1

 

0.46138347e-1

 

0.98175763e-1

 

0.30797102e-1

 

-.16333068

 

-.42882780

 

-.65291065

 

-.68519320

 

-.36491699

 

.45065352

 

1.8601309

 

3.8933757

 

6.4921833

 

9.4993084

 

12.664412

 

15.671497

 

18.185563

 

19.912262

 

20.654429

 

20.352632

 

19.099001

 

17.122716

 

14.750504

 

12.351527

 

10.277969

 

8.8110726

 

8.1121013

 

8.2595148

 

9.1484300

 

10.625106

 

12.470000

 

14.442900

 

16.334977

 

17.814817

 

18.760786

 

19.181587

 

18.732976

 

17.780388

 

16.318411

 

14.486252

 

12.440398

 

10.334385

 

8.3022216

 

6.4471886

 

4.8365207

 

3.5019327

 

2.4446257

 

1.6429774

 

1.0611606

 

.65712596

 

.38895586

 

.21914009

 

.11682497

 

0.58405315e-1

 

0.26982858e-1

 

0.11209327e-1

 

0.39351902e-2

 

0.94525962e-3

 

-0.74540895e-4

 

-0.29495088e-3

 

-0.25204186e-3

 

-0.16004845e-3

 

-0.86532870e-4

 

-0.41463181e-4

 

-0.17899580e-4

 

-0.69278927e-5

 

-0.23491366e-5

 

-0.66829402e-6

 

-0.13686514e-6

 

-0.76837315e-8

 

0.49022551e-8

 

-0.69948640e-9

 

0.21531116e-8

 

0.94383197e-8

 

0.13935450e-7

 

0.74857886e-8

 

-0.17655857e-7

 

-0.20268315e-7

 

0.19079956e-6

 

0.10964273e-6

 

-0.46401214e-7

 

0.65111854e-8

 

0.19030541e-9

 

-0.32052754e-6

 

-0.33434254e-7

 

0.21130779e-7

 

-0.60700260e-9

 

-0.15371908e-9

 

0.56652633e-10

 

-0.29781841e-10

 

-0.17334684e-11

 

0.20761743e-11

 

0.98264048e-9

 

0.43165138e-11

 

-0.28235638e-7

(4)

NULL

NULL

NULL


 

Download getD1.mw

Second Try:

f:= c/(c - 1) - c*(Pi^2 - 12*ln(c))*(1 + c)/(12*(c - 1)^3*n) + (((144*c^3 + 1584*c^2 + 1584*c + 144)*ln(c)^2 - 24*Pi^2*(1 + c)*(c^2 + 10*c + 1)*ln(c) + (-96*c^3 - 288*c^2 + 288*c + 96)*Zeta(3) + Pi^2*((Pi^2 + 24)*c^3 + (11*Pi^2 + 72)*c^2 + (11*Pi^2 - 72)*c + Pi^2 - 24))*c)/(288*(c - 1)^5*n^2)

This expression is already arranged with respect to n. However, the nominator of each term is not collected with respect to c. So naturally I thought

collect(f,[n,c]) or collect(f,[n,c],simplify)

would work. But now he messes up the nominator i.e. he can not factor and simplify. Note that the single variable case collect(f,n,simplify) works in not messing up, but this is not what I want, since the nominator of each n-term is not in c-collected form.

collect(f,[n],u->collect(u,[c],...))

also does not work, since he messes up again.

By c-collected form I mean the following:

The n^0 and n^{-1} term are actually fine. The factorization in the second term is ok. But for the third term

f2:=(144*c^3 + 1584*c^2 + 1584*c + 144)*ln(c)^2 - 24*Pi^2*(1 + c)*(c^2 + 10*c + 1)*ln(c) + (-96*c^3 - 288*c^2 + 288*c + 96)*Zeta(3) + Pi^2*((Pi^2 + 24)*c^3 + (11*Pi^2 + 72)*c^2 + (11*Pi^2 - 72)*c + Pi^2 - 24)

what I mean by c-collected is

collect(f2,c,simplify)

This is the nominator of the n^{-2} term.

I sort of managed by the following to procedings:

of:=[op(f)];
add(`~`[`/`](collect~(numer~(of), c, factor), ` $`, denom(of)));
add(collect~(of, c, simplify));

but the first one seems cumbersome for such a trivial thing that should be handled by collect. It also does not factor out the e.g. 12*ln(c)-Pi^2. This seems to be a general behaviour

g:=a*x*(x+1);
collect(g,x) does not factor out the a as in a*(x^2+x).

With the second method I'm more or less happy, but I didn't manage to completely collect the c terms i.e. the n^{-1} term is still c*(c+1) and not c^2+c.

Instead of getting a pop message telling me I have been cut off from the maple kernel can I please know how to recieve that error in the output of my worksheet instead?

Why does it insist I have to close and reopen the worksheet?

I was just thinking that if it were in my worksheets output I could have the current procedure in a try catch statement and write the occurance of the loss of server connection to a text file that is being checked by a script that will then send the necessary keystrokes to maple to save the worksheet close it then reopen it

Maple2020 was installed in windows 10 home. When installing maplesim 2019, it was looking for maple2019. Do I have to install maple 2019 before maplesim 2019? 

with(plots);
P1 := plot([-sin(t), t, t = 0 .. 2*Pi], coords = polar, color = red);
P2 := plot([cos(t), t, t = 0 .. 2*Pi], coords = polar, color = blue);
display(P1, P2, scaling = constrained);
 

I have two polar equation in the same graph but how do i shade the region between those two polar curve?

s1 := RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S)

s2 := -(D1*RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S)*D6-S*D6+RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))/(D2*D6*RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))
algsubs(s = RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S), s2)

I try to use s1 to represent s2, and I get the following result:

-(D1*__SELECTION(RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))*D6-S*D6+RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))/(D2*D6*RootOf(D1*D2*D6*_Z^2+(-D1*D4*D6-D2*D6*S-D4)*_Z+D4*D6*S))
what is mean of __SELECTION, If algsubs cannot work well, what should I do?

Hi, 
How can I load a .m file with the big green arrow ?

TIA

If I execute a program like:

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives6.txt";
stream := cat(pathname, "\\", filename);
Y := seq(rand(1..10)(), j = 1..10);
writeto(stream);
for i from 1 to 10 do
 printf("X[ %d ]:= %d;\n", i, Y[i]);
end do;
writeto(terminal);
printf("DONE\n");

 

Maple will print exactly what I told it to print.  But when I enter

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives44.txt";
stream := cat(pathname, "\\", filename);
writeto(stream);
for i from 1 to 10 do
 Y := rand(1..10)();
 printf("X[ %d ]:= %d;\n", i, Y);
end do;
writeto(terminal);
printf("DONE\n");

 

Maple prints:

             YAssign7, [Typesetting:-mprintslash([Y := 7], [7])]

X[ 1 ]:= 7;
           YAssign10, [Typesetting:-mprintslash([Y := 10], [10])]

X[ 2 ]:= 10;
             YAssign6, [Typesetting:-mprintslash([Y := 6], [6])]

X[ 3 ]:= 6;
             YAssign2, [Typesetting:-mprintslash([Y := 2], [2])]

X[ 4 ]:= 2;
             YAssign4, [Typesetting:-mprintslash([Y := 4], [4])]

X[ 5 ]:= 4;
             YAssign6, [Typesetting:-mprintslash([Y := 6], [6])]

X[ 6 ]:= 6;
             YAssign5, [Typesetting:-mprintslash([Y := 5], [5])]

X[ 7 ]:= 5;
             YAssign1, [Typesetting:-mprintslash([Y := 1], [1])]

X[ 8 ]:= 1;
             YAssign8, [Typesetting:-mprintslash([Y := 8], [8])]

X[ 9 ]:= 8;
             YAssign5, [Typesetting:-mprintslash([Y := 5], [5])]

X[ 10 ]:= 5;
 

This must be more than a matter of calling rand when I am writing to terminal, for if I enter:

restart;
pathname := "C:\\Users\\Gregory McColm\\Desktop\\Scratch2";
filename := "WhatGives8.txt";
stream := cat(pathname, "\\", filename);
writeto(stream);
X := rand(0..1)():
printf("Mary had a little lamb\n");
writeto(terminal);
printf("DONE\n");

 

then all Maple prints is "Mary is a little lamb".  I have tried this on Maple 2018 and Maple 2019, with the same results.

 

Any ideas or suggestions?

Hi,

I'm having trouble converting a static plot to animated plot:

Also I've been considering using functional operators instead of expressions so that there's no reuse of variable s when drawing different curves, though I'm not sure if this will be harder to differentiate since diff(expr, s) does not work on a functional operator meaning I'd have to do unapply(diff(f(s),s),s) which seems a long route and I'm not sure if it's what I'm looking for (in terms of simplification).

 

Thanks guys

agentpath.mw

 Hello everyone!

 I want to find all solutions of  following equations :

I used Maple 2019: 

solutions:=solve([abs(1+1/3*lambda+1/18*lambda^2-1/324*lambda^3+1/1944*lambda^4)-1=0],[lambda]);
evalf(solutions)

The output is:

So we have two solutions. But when I use Matlab 2018, 
four solutions are returned.

syms lambda
eqn =abs(1+1/3*lambda+1/18*lambda^2-1/324*lambda^3+1/1944*lambda^4)-1==0;
solx1=solve(eqn, lambda) 
%%
solx1 =
 root (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 1)
 root (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 2)
 roots (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 3)
 roots (z1 ^ 4-6 * z1 ^ 3 + 108 * z1 ^ 2 + 648 * z1, z1, 4)


 

solx3=solve(eqn, lambda,   'MaxDegree', 4)
double(solx3)
%%The solution is:
 -4.2681 + 0.0000i
 0.0000 + 0.0000i
 5.1340 -11.2012i
5.1340
+ 11.2012i

It is easy to check that  first two in Maple and Matlab are  same.

Who is right? Does Maple miss complex solutions?

 

 

 

 

 

 

 

 

Dear,

I need to attach CPU time to my iterations/Computations, please how do I obtain that in Maple. I tried 

a:=time () 

Iterations code

cputime:=time() -a; 

 

But the issue is that once I rerun the code, It produces different cpu time, kindly help me out here. 

 

Thank you.

First make sure that  and  are unassigned variables and then enter the Maple command

 

 

This tells Maple that  is a postive real number.  (You will see more on using "assume" later.)

 

Next, calculate the improper definite integral of

 

(8sin(x)+11cos(x))e^(−52cx)

 

for  from 0 to ∞ and assign this to the variable .  (Notice that Maple displays  as  to indicate it that an assumption has been made about .)

 

Finally calculate the limit of  times  as  tends to infinity and enter the limit in the box below.  (Enter your answer exactly using Maple syntax, not as a decimal.)

 

Can someone please help me in this? I cant really understand this.

 

1 discuss and show graphically the effects of decrease in wage on labor supply. if A, leisure is normal good. B, if leisure is inferior good.

How do I animate the cylinder width, or some variation of it as we trace it's path in the z-axes

with(plots);
with(plottools);
display([seq(cylinder([2, 2, 2], 3, i/10, capped = false), i = 1 .. 60)], insequence);

 

Hi,

I'm trying to create an agent vehicle which drives along a path of a uniform width, and finds the distance to the edge of the path directly ahead of it. Like this:

The aim is to somewhat simulate how far the agent can see down the road.

Since the thickness of a plot curve is unrelated to the units of the axis, and has no means of interacting with objects this would be no use.

I also considered shadebetween function, however this only can shade between the y values of 2 functions, so for a vertical curve it cannot produce any width to the path.

I then realised using parametric equations of form (x(t), y(t)) would likely make most sense and wrote some code which roughly gets the boundarys at a fixed distance from the centre path equation, by adding the x-y components of the reciprocal of the gradient:

For certain simple path equations such as this one, it roughly works other than the areas between which the boundary curves overlap themselves (I would need to find these points of intersection and break the curves up to remove these squigly inner bits). Any advice on this would be much appreciated cause this seems like it will be tricky, if not computationally heavy.

 

More annoyingly, due to the nature of the trig functions involved, for more complex graphs which include a vertical turning point, the left and right boundaries seem to swap over:

and

Clearly this is not the behaviour I had in mind.. and I'm not sure what I can do to fix it, I think maybe using piecewise trig may be a potential solution to avoid the jumping from + to -, though I'm not sure where I would put these breakpoints (I've tried just using abs(arctan(...)) with no luck).

 

If anyone could help wih this that would be really appreciated, or even suggest a better approach to this problem!

Thanks

 

[code] agentpath.mw

First 577 578 579 580 581 582 583 Last Page 579 of 2425