acer

32405 Reputation

29 Badges

19 years, 351 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Your followup comment ignored my point about the term Lambda(p-1) which is a function call and not a multiplication.

Perhaps you intend something like this, using Lambda*(1-p) instead. Here, the explicit solutions can be considerably reduced in length by simplifying.

restart;
Sol:=[solve({sigma*E-(mu+alpha+g)*II = 0,
             g*E+Lambda*N*p-(mu+alpha)*R = 0,
             Beta__1*S*E+Beta__2*S*II/(II*M+1)-(mu+sigma)*E = 0,
             Lambda*(1-p)*N-mu*S-Beta__1*S*E-Beta__2*S*II/(II*M+1) = 0},
            {E, II, R, S}, explicit)]:
Sol := simplify(Sol):

#map(print,Sol):

That works fine for me. The rsolve call worked, but I'll keep your other two procedures as well.

I'm not sure whether you are trying to find a point of intersection, so I'll throw that in too.

restart;

kernelopts(version);

`Maple 2018.2, X86 64 WINDOWS, Nov 16 2018, Build ID 1362973`

F := rsolve({16*s(n+1) = 2+12*s(n)-2*s(n-1), s(1) = 1, s(2) = 5/8}, s(n));

(2/3)*(1/4)^n+(1/2)^n+1/3

f := unapply(F, n);

proc (n) options operator, arrow; (2/3)*(1/4)^n+(1/2)^n+1/3 end proc

s := proc(n)
 option remember;
 if n <= 2 then 1;
 else 1/16+(1/4)*s(n-1)+(1/16)*sqrt(1+24*s(n-1));
 end if;
end proc:

suite := proc(n)
  options operator, arrow;
  1/3+(1/6)*(3*2^(n-1)+1)/4^(n-1);
end proc:

for i from 2 to 6 do
  i-1, s(i), suite(i-1), f(i-1);
end do;

1, 1, 1, 1

2, 5/8, 5/8, 5/8

3, 15/32, 15/32, 15/32

4, 51/128, 51/128, 51/128

5, 187/512, 187/512, 187/512

F := proc(x) options operator, arrow; 1/16+(1/4)*x+(1/16)*sqrt(1+24*x) end proc;

proc (x) options operator, arrow; 1/16+(1/4)*x+(1/16)*sqrt(1+24*x) end proc

solve(F(x) = x, x);

1/3

Courbe := plot(F(x), x = 0 .. 10, color = blue):

escalier := plot([seq([i, f(i)], i = 1 .. 10)], color = black):

pt:=fsolve(F(x)=f(x));
P:=plots:-pointplot([[pt,f(pt)]],symbol=solidcircle,color=red):

1.436383612

plots:-display([Courbe, escalier, P], size=[500,500*f(10.0)]);

 

Download JAMET_suite.mw

You need to either load the package first (only once needed, per restart), or call it with its full name.

That is,

   with(Optimization):
   Maximize(2*x^2 + 2*y^2 + y, {2*x + y <= 6, y^2 - x <= 2});


or,

  Optimization:-Maximize(2*x^2 + 2*y^2 + y, {2*x + y <= 6, y^2 - x <= 2});


[edited] Many Help pages for exported commands of other packages contain the following kind of boilerplate usage message. The Help page for Optimization:-Maximize doesn't seem to have it. I'll submit a bug report.

  This function is part of the LinearAlgebra package, and
  so it can be used in the form LUDecomposition(..) only after
  executing the command with(LinearAlgebra). However, it can
  always be accessed through the long form of the command by
  using LinearAlgebra[LUDecomposition](..).

Stop using the syntax for creating operators/procedures in order to assign expressions.

If you are not trying to create a procedure (of one parameter, say x), then simply use an expression.

f := a+b;

             f := a + b

a:=5;

               a := 5

b:=2;

               b := 2

f;

                 7

Moreover, stop trying to use any syntax like,
   M_Inwendig2(y) := ...
or,
   M_Inwendig2(94) := ...
in 1D Notation. That assigns into remember tables, and it is not what you need.

You probably learned the (very poor) syntax for creating procedures in 2D Input, like so,
    M_Inwendig2(y) := ...
That will not work at all like you need in 1D Maple Notation input. Use unapply instead of the above, to create an operator from a prior expression. Eg,
    M_Inwendig2 := unapply(..., y);
That kind of mistake happens in many places.

If you had correctly set up M_Inwendig1 as an operator, for example, then you would not need to do all this just t get a float result:
   M_Inwendig1(105):=subs([y=0.105],M_Inwendig1(y));evalf(%);
Instead, you'd just have to call,
   M_Inwendig1(105);
That kind of mistake happens in a many places.

The entire document could be much simpler if you were to use expressions throughout (and 2-argument eval in a few places, for substitution). But you have chosen to use operators everywhere, even when not necessary. That makes it more confusing that it had to be (and leads to all these mistakes with remember tables and so on).

I will try to fix up parts of your worksheet, but there are many, many problems it's in quite a muddle. Here is part of it; it will likely need more correction and with so many changes it is hard to not overlook things: Wis_BS2_Taak2_2019-2020_20200323-1_ac_try1.mw

 

You have assigned an expression to T, not a procedure. The distinction is fundamental. You should't call the expression form with an argument here.

Also, if you want differentiation of expressions with so-called prime notation to denote differentiation by d then you need to inform Maple of that desire (I used Typesetting:-Settings for that, in the first example below.)

So, here are several ways, the first collections with T as an expression and the latter with T as a procedure (operator). You can use diff or D (as appropriate), or prime notation, in each scenario.

restart

 

This first example will use an expression for T.

 

T := 8*Pi*d*(1/(Pi*d^2))+Pi*((1/2)*d)^2

8/d+(1/4)*Pi*d^2

diff(T, d)

-8/d^2+(1/2)*Pi*d

Typesetting:-Settings(prime = d)

diff(T(x), x)

-8/d^2+(1/2)*Pi*d

restart

 

The next example will use a procedure (operator) instead of an expression.

 

T := proc (d) options operator, arrow; 8*Pi*d/(Pi*d^2)+(1/4)*Pi*d^2 end proc

proc (d) options operator, arrow; 8/d+(1/4)*Pi*d^2 end proc

(D(T))(d)

-8/d^2+(1/2)*Pi*d

D(T)

proc (d) options operator, arrow; -8/d^2+(1/2)*Pi*d end proc

(D(T))(d)

-8/d^2+(1/2)*Pi*d

restart

 

The system will also interpret as a procedure (operator) the kind of the 2D Input assignment to T that is done below.

I am not a fan of that syntax for creating operators, but it is equivalent to the previous example's assignment to T.

 

"T(d):=(Pi*d*8)/(Pi*d^(2))+Pi*(d/(2))^(2)"

proc (d) options operator, arrow, function_assign; 8/d+(1/4)*Pi*d^2 end proc

(D(T))(d)

-8/d^2+(1/2)*Pi*d

D(T)

proc (d) options operator, arrow, function_assign; -8/d^2+(1/2)*Pi*d end proc

(D(T))(d)

-8/d^2+(1/2)*Pi*d

NULL

Download primenotation.mw

(I used Maple 2019.2 for this, to match the Question's heading.)

It is unclear what you are trying to ask, about "mathtype".

Is this something like what you are trying to accomplish in Maple 2016?

help_limit_ac.mw

You haven't been very specific about what aspect you don't think is good. Is it that it the over-symbol is in italics? Is it the offset distance from the central character? Is it the relative size?

You could try these (there are a few other choices, but you'd need to be more clear about what you want for me to try...)

Also, it's not clear to me whether you want a check mark or something else.

`#mover(mi("&pi;"),mi("&Hat;"))`; 
`#mover(mi("&pi;"),mo("&Hat;"))`;
`#mover(mi("&pi;"),mn("&Hat;"))`;
`#mover(mi("&pi;"),mi("&or;"))`;
`#mover(mi("&pi;"),mo("&or;"))`;

Here is one way, which you can easily adjust.

Wis_BS2_Taak2_2019-2020_20200319-2_ac.mw

For your Linux you might try the following (I was on ubuntu 18.04).

This is a before and after comparison. I am guessing that this will affect the inmem=false use of Compiler:-Compile, where that would use gcc on a generated C source file. I am less sure about the default LLVM for inmem=true.

I'm supposing that you already have a test case for which you expect to be able to detect the difference.

restart;

kernelopts(version);

`Maple 2019.2, X86 64 LINUX, Oct 30 2019, Build ID 1430966`

Compiler:-_DumpConfig();


Platform: unix
System: X86_64_LINUX
GCC Version: 7.5.0
MAPLE_TEMPDIR: <<NULL>>
Temp: /tmp
Compile Command: gcc -c -fPIC -I. -DMCLIENT_DLL_EXPIMP= -DX86_64_LINUX=1 -I/usr/local/maple/maple2019.2/extern/include -O2   -w  DUMMY.c -o DUMMY.o
Link Command: gcc -shared -L. -L/usr/local/maple/maple2019.2/bin.X86_64_LINUX  DUMMY.o -o DUMMY.so -lhf -lmaple -lmrt -lm
Post-Link Command: NULL
CCOUTPUT_FLAG: -o
OBJSUFFIX: .o
LDLIBS: -lhf -lmaple -lmrt -lm
EXTRACFLAGS:
EXTRALDFLAGS:
CPPFLAGS: -I. -DMCLIENT_DLL_EXPIMP= -DX86_64_LINUX=1 -I/usr/local/maple/maple2019.2/extern/include
LDFLAGS: -L. -L/usr/local/maple/maple2019.2/bin.X86_64_LINUX
LD: gcc
LDSHFLAGS: -shared
CCOPT: -O2
COMPILE_ONLY_FLAG: -c
TMPDIR: /tmp
LDOUTPUT_FLAG: -o
CC: gcc
EXESUFFIX:
DLLSUFFIX: .so
CCDEBUG:  
DLLPREFIX: lib
CCSHFLAGS: -fPIC
CFLAGS: -w

__oldkopts:=kernelopts(':-opaquemodules'=false):
#Compiler:-Build:-buildvars["CCOPT"];
Compiler:-Build:-buildvars["CCOPT"]:="-O3":
kernelopts(':-opaquemodules'=__oldkopts): # restore

Compiler:-_DumpConfig();

 

Platform: unix
System: X86_64_LINUX
GCC Version: 7.5.0
MAPLE_TEMPDIR: <<NULL>>
Temp: /tmp
Compile Command: gcc -c -fPIC -I. -DMCLIENT_DLL_EXPIMP= -DX86_64_LINUX=1 -I/usr/local/maple/maple2019.2/extern/include -O3   -w  DUMMY.c -o DUMMY.o
Link Command: gcc -shared -L. -L/usr/local/maple/maple2019.2/bin.X86_64_LINUX  DUMMY.o -o DUMMY.so -lhf -lmaple -lmrt -lm
Post-Link Command: NULL
CCOUTPUT_FLAG: -o
OBJSUFFIX: .o
LDLIBS: -lhf -lmaple -lmrt -lm
EXTRACFLAGS:
EXTRALDFLAGS:
CPPFLAGS: -I. -DMCLIENT_DLL_EXPIMP= -DX86_64_LINUX=1 -I/usr/local/maple/maple2019.2/extern/include
LDFLAGS: -L. -L/usr/local/maple/maple2019.2/bin.X86_64_LINUX
LD: gcc
LDSHFLAGS: -shared
CCOPT: -O3
COMPILE_ONLY_FLAG: -c
TMPDIR: /tmp
LDOUTPUT_FLAG: -o
CC: gcc
EXESUFFIX:
DLLSUFFIX: .so
CCDEBUG:  
DLLPREFIX: lib
CCSHFLAGS: -fPIC
CFLAGS: -w

 

Download compiler_opt.mw

You wrote, "... to prevent this inflation of random variables..."

Does that mean that you are trying to improve performance or conserve memory?

The modules that contain the details of the distribution instances take up some memory, and there may (eventually) be a noticable overhead due to global name accumulation and the cost of .mla initial checking of additional global names.

If you unprotect and unassign the _ProbabilityDistributionXXX instances then their referenced modules may still hang around (with memory-based names like _m140554330413728 and so on). Getting rid of them altogether could require getting rid of all references to them (including _RXXX names and anything else).

Or do you have only a modest number of such distributions, and you simply want to be neat and tidy?

Or do you have some other motivation?

note: I know that it can get quite awkward (because it's not convenient to utilize in the content of eval or use or assuming), but is it not at all possible to utilize the generic RV instantiation and re-assign specific values to the parameter name? For example,

restart;
with(Statistics):
x:=RandomVariable(Exponential(a)):
a:=2:
Mean(x), Sample(x,1);
              2, [8.23569715700137]
a:=1:
Mean(x), Sample(x,1);
              1, [1.43494745936376]

Maple has no facilities for creating animation files (eg. mp4, mov, avi, etc) from multiple images.  Animated gif from plots is all it has.

Yes, this is a sorry state of affairs. It's been requested many times over the past two decades. (Sister product MapleSim can do mpeg-2 export of some simulations.)

The ImageTools:-Embed command can only insert once per Execution Group or Document Block. Later instances within the same Group will overwrite the contents of the embedded Task region. That GUI limitation is shared with Explore, Tabulate, InsertContent, and a few other things. IIRC it is documented in a few places. 

Did you want to export it an a single column Matrix? For example,

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

f := proc (x) options operator, arrow; 15.5*exp(-(1/3710000)*(x-12590)^2)+14.55*exp(-(1/3000000)*(x-16100)^2) end proc:

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

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.)

M := [seq(evalf(Int(E(0-xi, 39000-i)*f(xi), xi = 0 .. 20000, method = _NCrule, epsilon = 10^(-6))), i = 10000 .. 20000, 250)]:

plots:-listplot(M);

ExportMatrix(cat(kernelopts(homedir), "/Documents/mapleprimes/M.txt"), `<|>`(`<,>`(M)));

435

 

``

Download getD1_ac.mw

The GUI does not send individual commands in the same session to separate kernel instances. A "session" implies a kernel, communicating input and output back and forth with the interface.

The GUI does not control or run try...catch, the kernel does.

If the kernel instance crashes then there's nothing else (on top of that, controlling the computation, with access to the session's computational history).

You need to wait for MapleSim 2020, if you want it to work properly with Maple 2020.

MapleSim 2019 works properly with Maple 2019, and not Maple 2020.

MapleSim 2020 won't be available for another few weeks.

You don't have to suppress output (using full colons, say), if running this in the GUI.

Instead you could either,
1) Set  interface(typesetting=standard)
or,
2) Retain interface(typesetting=extended)  which is default, while
    also setting  interface(prettyprint=1)

writeto_gui.mw

First 132 133 134 135 136 137 138 Last Page 134 of 336