acer

32385 Reputation

29 Badges

19 years, 340 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The expression is zero, for y=0 and 3 <= x <= 4 . So its maximum is not negative.

The RealDomain:-solve and solve commands are not super strong when tackling trig equations over specified ranges.

You could try this,

Student:-Calculus1:-Roots(sec(x) = sqrt(2), x=3*Pi*(1/2) .. 2*Pi);

            [7   ]
            [- Pi]
            [4   ]

I am not sure how it works on your Windows (command shell), but have you tried this kind of redirection?

ssystem("ffmpeg -i c:/test/test.mp3 2>&1");

What you were missing -- I suspect -- is that ffmpeg usually sends its media stream to stdout, and its diagnostics to stderr. I just checked ffmpeg's manual-page, and it states, "By default the program logs to stderr."

So, I had to redirect stderr in order to get ffmpeg's messages from Maple's ssystem. That was on Linux, and I expect it behaves similarly on Windows.

I'm also assuming that ssystem allows forward slash as directory separator on your Windows, and that part of your call was ok.

You could consider why this is ok here. And you might also apply sqrt afterwards.

minimize(1-(4*(x-1))*(1-y)/(x^2*(1+y)), x=3..4, y=0..1, location);

            1   /[                1]\ 
            -, { [{x = 3, y = 0}, -] }
            9   \[                9]/ 

I'll try and find time to look at what causes the original failure; it may be part of a pattern. (I was making a study of problematic cases a while back, but got busy.)

Here are some ideas:

restart;

T:=325:
a12:=2305.28444347652 - 9.14490843016421*T + 0.00680052257590234*T^2:
a21:=-6665.24838284836 + 46.0897018087247*T - 0.0694991633494123*T^2:
alfa:=0.3:
x2:=1-x1:
tau12:=a12/T:
tau21:=a21/T:
G12:=exp(-alfa*tau12):
G21:=exp(-alfa*tau21):
lng1:=x2^2*(tau21*(G21/(x1+x2*G21))^2+tau12*(G12/((x2+x1*G12)^2))):
lng2:=x1^2*(tau12*(G12/(x2+x1*G12))^2+tau21*(G21/((x1+x2*G21)^2))):
lnga1:=subs(x1=xa1,lng1):
lngb1:=subs(x1=xb1,lng1):
lnga2:=subs(x1=xa1,lng2):
lngb2:=subs(x1=xb1,lng2):
r1:=lnga1+ln(xa1)=lngb1+ln(xb1):

r2:=lnga2+ln(1-xa1)=lngb2+ln(1-xb1):

ans1 := fsolve(abs~((lhs-rhs)~([r1,r2])));
 

{xa1 = -7.290257776, xb1 = -7.290257776}

map(lhs-rhs, eval([r1,r2], ans1));

[0.+0.*I, 0.]

ans2 := fsolve(abs~((lhs-rhs)~([r1,r2])), {xa1,xb1}, avoid={ans1});

{xa1 = -7.290476897, xb1 = -7.290476897}

map(lhs-rhs, eval([r1,r2], ans2));

[0.+0.*I, 0.]

ans3 := fsolve(abs~((lhs-rhs)~([r1,r2])), {xa1,xb1}, avoid={ans1, ans2});

{xa1 = -1.173033030, xb1 = -1.173033030}

map(lhs-rhs, eval([r1,r2], ans3));

[0.+0.*I, 0.]


 

ansC := fsolve([r1,r2],{xa1=-10-I..10+I, xb1=-10-I..10+I});

{xa1 = 1.136495104-.9634251620*I, xb1 = 1.136495104-.9634251620*I}

map(lhs-rhs, eval([r1,r2], ansC));

[0.+0.*I, 0.+0.*I]

 

Download NRTL_ac.mw

There is no need to use the implicitplot command for this, and indeed it makes little sense to do so. The result using implicitplot computes less efficiently, is less smooth without resorting to extra options (eg. gridrefine), and is generally problematic for export as regular numeric data.

The above is also true if you made a simple sign mistake in the left-hand side of your equation.

It's easy enough to flip the axes (without requiring any additional plottools command) by simply using the parametric calling sequence of the plot command.

It's easy enough to apply either Re or Im to the parts of the explicit solution, if solving B explicitly in terms of a.

Or you could solve a explicitly in terms of B and plot directly, and omit any use of the Re command. (As suggested, if there is a sign mistake then a plot similar to described arises.)

Ensure that the expression is as you want it, ie. no mistakes. Then figure out which portion of these you want to plot.

Look at the explicit formula which you choose to plot (whether it be B in terms of a, or a in terms of B) and check whether it makes sense to you.

You can exclude any of the options like view, colorlabels, gridlines, axis[2], tickmarks, etc, which are there mostly to modify the aesthetic. If in doubt, call the plot command without them, and add as desired.
 

restart;

Digits:=15:

eqn := (7.72-7.72*B)*(-7.717267500*a) = 662204.4444*B^2;

-7.717267500*(7.72-7.72*B)*a = 662204.4444*B^2

A := solve(eqn,a);

11115.0452892842*B^2/(-1.+B)

plot([A,B,B=0..1], labels=[a,B],
     view=[default,default], gridlines,
     axis[2]=[tickmarks=[seq(0..1.0,0.1)],
              location=low]
    );

S:=[solve(eqn,B)];

[0.449840722180451e-4*a+0.226516148099715e-12*(0.394383920330943e17*a^2-0.175343805433755e22*a)^(1/2), 0.449840722180451e-4*a-0.226516148099715e-12*(0.394383920330943e17*a^2-0.175343805433755e22*a)^(1/2)]

plot(map(Re,S),a=-80000..80000, labels=[a,Re(B)], color="Burgundy");

plot(S[1],a=-400000..0, labels=[a,B],
     view=[-400000..0,0..1], gridlines,
     axis[2]=[tickmarks=[seq(0..1.0,0.1)],
              location=low]
    );

plot(Re(S[1]),a=0..20000, labels=[a,B],
     view=[default,0..1], gridlines,
     axis[2]=[tickmarks=[seq(0..1.0,0.1)],
              location=low]
    );

 

Download flipped.mw

Do you mean the Help page with Topic  rtable_indexing ?

Or are you looking for help with function calls of an indexed name, such as, say,

F[bar]( some_args )

Or are you looking for the (uncommon) prefix-form indexing operator,  `?[]` , eg,

`?[]`(K,[1,2,3]);

               K[1, 2, 3]

You can use solve(E) to obtain all the roots of this particular example exactly.

You could also use fsolve(E,x,complex) if floating-point approximations were acceptable to you.

The select and selectremove commands can be used to separate the list of roots for various properties.

restart;

E:=2*x^(7)-x^(6)-4*x^(5)-15*x^(4)-14*x^(3)+19*x^(2)+28*x+30;

2*x^7-x^6-4*x^5-15*x^4-14*x^3+19*x^2+28*x+30

All:=[solve(E)];

[5/2, -1/2-((1/2)*I)*11^(1/2), -1/2+((1/2)*I)*11^(1/2), 2^(1/2), -2^(1/2), -1/2-((1/2)*I)*3^(1/2), -1/2+((1/2)*I)*3^(1/2)]

R,C := selectremove(is,All,real);

[5/2, 2^(1/2), -2^(1/2)], [-1/2-((1/2)*I)*11^(1/2), -1/2+((1/2)*I)*11^(1/2), -1/2-((1/2)*I)*3^(1/2), -1/2+((1/2)*I)*3^(1/2)]

CP,CN := selectremove(c->is(Im(c)>0), C);

[-1/2+((1/2)*I)*11^(1/2), -1/2+((1/2)*I)*3^(1/2)], [-1/2-((1/2)*I)*11^(1/2), -1/2-((1/2)*I)*3^(1/2)]

# real roots
R;

[5/2, 2^(1/2), -2^(1/2)]

# complex roots with strictly positive imaginary component
CP;

[-1/2+((1/2)*I)*11^(1/2), -1/2+((1/2)*I)*3^(1/2)]

 

Download select_example.mw

It is just as easy to separate out the roots which are real and positive, etc.

restart;

h1 := -I*(c1*exp(A)-c2*exp(-A)):
h2 := c2*exp(A)+c1*exp(-A):
A := (I*a/2)*(x+b*t):

extra := [c1=sqrt(a+2*lambda)/a,
          c2=sqrt(a-2*lambda)/a]:

h1*h2;

-I*(c1*exp(((1/2)*I)*a*(b*t+x))-c2*exp(-((1/2)*I)*a*(b*t+x)))*(c2*exp(((1/2)*I)*a*(b*t+x))+c1*exp(-((1/2)*I)*a*(b*t+x)))

ans := simplify(eval(combine(convert(h1*h2,trig)),extra));

(2*(a+2*lambda)^(1/2)*(a-2*lambda)^(1/2)*sin(a*(b*t+x))-(4*I)*lambda)/a^2

simplify( eval(h1*h2,extra) - ans );

0

 

Download simptrig_example.mw

You could get that even smaller under certain assumptions on a and lambda. For example,

simplify(combine(ans)) assuming a>2*lambda;

(2*(a^2-4*lambda^2)^(1/2)*sin(a*(b*t+x))-(4*I)*lambda)/a^2

 

There were not many edits or syntax mistakes, to my eye.

I had to change two instances of square brackets to round brackets, for delimiting a term of an arithmetic expression.

I had to change the procedure parameters from r[D] and t[D] to r__D and t__D (as typed in 2D Input mode, for literal subscripts which are symbols in the proper sense).

Your use of exp(...) in 2D Input mode was fine. (Evidence for that, in advance, was the fact that the "e" rendered in Roman upright rather than italic.)

I turned the a(i) computations into a loop, to shorten it.

Please check it over.

restart

 

Find 1st 40 roots of this equation.

 

BesselY(1, alpha[n])*BesselJ(1, alpha[n]*r[eD])-BesselJ(1, alpha[n])*BesselY(1, alpha[n]*r[eD]) = 0

 

r[eD] := 4.5

4.5

"rootfunction( beta ) :=(Y)[1](beta)* (J)[1](beta *r[eD]) - (J)[1](beta) * (Y)[1](beta * r[eD]) "

proc (beta) options operator, arrow, function_assign; BesselY(1, beta)*BesselJ(1, beta*r[eD])-BesselJ(1, beta)*BesselY(1, beta*r[eD]) end proc

Define vector to store roots.

 

a := Vector(40, fill = 0)``

NULL

Initialize the root finding package.

==========================

``

with(RootFinding)

``

Find roots for the given r[eD].

====================

 

a(1) := NextZero(rootfunction, 0.1e-3)

"for i from 2 to 40 do    a(i):=NextZero(rootfunction,a(i-1)); end do:"
   

a

Vector[column](%id = 18446884500815317822)

NULL

a(1)

.9609795905

a(40)

35.90623590

 

Define this function:

p__D := proc (r__D, t__D) options operator, arrow; ((1/2)*r__D^2+2*t__D)/(r[eD]^2-1)-r[eD]^2*ln(r__D)/(r[eD]^2-1)-(1/4)*(3*r[eD]^4-4*r[eD]^4*ln(r[eD])-2*r[eD]^2-1)/(r[eD]^2-1)^2+Pi*add(BesselJ(1, a(i)*r[eD])^2*(BesselJ(1, a(i))*BesselY(0, a(i)*r__D)-BesselY(1, a(i))*BesselJ(0, a(i)*r__D))*exp(-a(i)^2*t__D)/(a(i)*(BesselJ(1, a(i)*r[eD])^2-BesselJ(1, a(i))^2)), i = 1 .. 40) end proc

p__D(1, 1)

.8021455142

p__D(.5, .5)

1.384740257

``

Download DifficultFunctionac.mw

You could try to install the last point-release update to Maple 2019.2.1 .

(I am not sure that it will help your case, but it's possible that point-release fixed a rare issue with licensing misidentification.)

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

 

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