acer

32954 Reputation

29 Badges

20 years, 150 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

The error message explains the problem. You are passing as invalid argument to the rhs command.

You are passing den1 to rhs, but the value of den1 is not an equation or something with a right-hand side.

The problem is not with the plot3d command. It is within the subs call that you are passing as its first argument.

Perhaps you meant to substitute values for lambda and w into den1 as follows:

restart;

with(PDEtools):

A1:=Matrix([[phi,(chi),conjugate(phi),conjugate(chi)],
          [chi,(phi),conjugate(chi),conjugate(phi)],
          [lambda*phi,-(lambda)*(chi),
           conjugate(lambda)*conjugate(phi),-conjugate(lambda)*conjugate(chi)],
          [lambda*chi,-(lambda)*(phi),
           conjugate(lambda)*conjugate(chi),-conjugate(lambda)*conjugate(phi)]]);

A1 := Matrix(4, 4, {(1, 1) = phi, (1, 2) = chi, (1, 3) = conjugate(phi), (1, 4) = conjugate(chi), (2, 1) = chi, (2, 2) = phi, (2, 3) = conjugate(chi), (2, 4) = conjugate(phi), (3, 1) = lambda*phi, (3, 2) = -lambda*chi, (3, 3) = conjugate(lambda)*conjugate(phi), (3, 4) = -conjugate(lambda)*conjugate(chi), (4, 1) = lambda*chi, (4, 2) = -lambda*phi, (4, 3) = conjugate(lambda)*conjugate(chi), (4, 4) = -conjugate(lambda)*conjugate(phi)})

d1 := LinearAlgebra:-Determinant(A1):

d1; length(%);

conjugate(lambda)^2*conjugate(phi)^2*chi^2-conjugate(lambda)^2*conjugate(phi)^2*phi^2-conjugate(lambda)^2*conjugate(chi)^2*chi^2+conjugate(lambda)^2*conjugate(chi)^2*phi^2+2*conjugate(lambda)*conjugate(phi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(phi)^2*lambda*phi^2-8*conjugate(lambda)*conjugate(phi)*conjugate(chi)*chi*lambda*phi+2*conjugate(lambda)*conjugate(chi)^2*chi^2*lambda+2*conjugate(lambda)*conjugate(chi)^2*lambda*phi^2+conjugate(phi)^2*chi^2*lambda^2-conjugate(phi)^2*lambda^2*phi^2-conjugate(chi)^2*chi^2*lambda^2+conjugate(chi)^2*lambda^2*phi^2

705

den:=simplify(d1,size); length(%);

-(-(conjugate(chi)-conjugate(phi))*(chi+phi)*conjugate(lambda)+lambda*(conjugate(chi)+conjugate(phi))*(chi-phi))*(-(conjugate(chi)+conjugate(phi))*(chi-phi)*conjugate(lambda)+lambda*(conjugate(chi)-conjugate(phi))*(chi+phi))

333

 

con1:=phi=exp(I*lambda*(x-t/(4*lambda^2)-w^2)):con2:=chi=exp(-I*lambda*(x-t/(4*lambda^2)-w^2)):

 

den1:=simplify((dsubs({con1,con2},den)));

4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*conjugate(lambda)^2+8*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*conjugate(lambda)*lambda+4*cos((1/4)*(4*w^2*lambda^2-4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda+t)/lambda)^2*lambda^2-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*conjugate(lambda)^2+8*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*conjugate(lambda)*lambda-4*cos((1/4)*(-4*w^2*lambda^2+4*x*lambda^2+conjugate((4*lambda^2*w^2-4*lambda^2*x+t)/lambda)*lambda-t)/lambda)^2*lambda^2-16*conjugate(lambda)*lambda

expr := simplify(evalc(eval(den1, [lambda=1+2*I, w=1])));

16*cos(2-2*x+(1/10)*t)^2+64*cosh(-4+4*x+(1/5)*t)^2-80

lprint( indets(expr, name) );

{t, x}

plot3d(expr,x=-1..1, t=-1..6);

 

NULL

Download 23May_1_ac.mw

By the way, there is no package plot so your call   with(plot)  is incorrect.  But note that you do not need to load   with(plots)   in order to call the plot3d command.

ps. Your attachment was saved in Maple 18, not Maple 2018 which is  much later version. I have adjusted your Question's header appropriately.

You make the loop work more complicated that it has to be, I think.

There's no reason to use a loop to contruct the Array of colors. It just makes unnecessary clutter.

Don't use a set with {} inside the call to plots:-display if you want a particular order for the plot legends to appear. Use a list instead (or no container) for which you can force the order.

Here are two ways to get a prime effect in the legend. There is a typesetting entity `⁗` which renders as four close prime symbols, but for derivatives higher than 4th that it normally renders as (5) etc in the superscript. There are also several ways to supress the (x) function application in the legend -- let me know if it really matters to you. You may find it a tradeoff, between convenience and appearance.

restart;

with(plots):

f := x -> exp(-x)*sin(x):

intvx := 0..3:

F := Array(0..5, [f]):
for i from 1 to 5 do
  F[i] := D(F[i-1])
end do:

C := Array(0..5,[red,blue,green,black,magenta,yellow]):

Typesetting:-Settings(typesetprime=true):

P := Array(0..5):
for i from 0 to 5 do
  if i=0 then U := Typesetting:-Typeset(f(x)) else
    U := 'Typesetting:-Typeset'(diff('f(x)',x$i));
  end if;
  P[i] := plot(F[i], intvx, color=C[i], thickness=3,
               legend=[U], legendstyle=[location=right]);
end do:

display([seq(P[i],i=0..5)], size=[600,400]);

restart;

with(plots):

f := x -> exp(-x)*sin(x):

intvx := 0..3:

F := Array(0..5, [f]):
for i from 1 to 5 do
  F[i] := D(F[i-1])
end do:

C := Array(0..5,[red,blue,green,black,magenta,yellow]):

P := Array(0..5):
for i from 0 to 5 do
  U := cat(`#mrow(mi(f)`,`,mo("′")`$i,`);`);
  P[i] := plot(F[i], intvx, color=C[i], thickness=3,
               legend=[U], legendstyle=[location=right]);
end do:

display([seq(P[i],i=0..5)], size=[600,400]);

 

Download betounes_ex_set_task_4def_acc.mw

The following is slightly terser, using a loop only for the derivative construction (as asked).  betounes_ex_set_task_4def_accc.mw

This can be done quite nicely with the plots:-inequal command.

You can also use the result alongside other plots, or redisplay it with different choices for options view, size, etc.

P:=plots:-inequal([x>=-Pi/4, x<=Pi/4, y<=sec(x), y>=0],
                  x=-Pi/4..Pi/4, y=0..maximize(sec(x),x=-Pi/4..Pi/4),
                  color="LightBlue"):

P;

plots:-display(P, view=[-1.5..1.5,0..1.5], scaling=constrained,
               xtickmarks=piticks, size=[500,400]);

 

Download inequal_plot.mw

Naturally, I could also have used sqrt(2) instead of maximize(sec(x),x=-Pi/4..Pi/4). I put it in to show a concept.

The symbol for sqrt(-1) is I, not lowercase i. You could change this using the command
  interface(imaginaryunit=i):
But note that setting is not reset in the GUI by restart.

You need to either put a space (2D Input, implicit multiplication) or an explicit multiplication symbol between the brackets (or terms before them), or else your examples will be parsed a function application instead of multiplication. Your first three examples incurred this mistake (and so Carl's suggestion to correct the imaginary unit is insufficient alone to fix your examples).

Example 2: Multiplying Complex Numbers

 

(2-I)*(4+3*I)

(3+2*I)*(3-2*I)

(3+2*I)*(3-2*I)

(4*I)*(-1+5*I)

(3+2*I)^2

11+2*I

13

13

-20-4*I

5+12*I

NULL

(3 + 2*I)*(3 - 2*I);

(3+2*I)*(3-2*I); (3+2*I)*(3-2*I)

13

13

13

(3 + 2*I)(3 - 2*I);
(3+2*I)(3-2*I)

3+2*I

3+2*I

3(blah);
3(8);
3(8-17*I);

3

3

3

``

Download Multiplying_Complex_num_ac.mw

You can use the plots:-odeplot and dsolve commands, in a straightforward manner, to obtain a plot. 

I have removed the extra factors of y as just a name from the second equation. If those were supposed to be calls to y[o2](t) or y[co2](t) then you should replace them with the corrections. Any final plot could look different, of course, but if solvable then the plotting technique could be similar.

restart

e := 0.62e-2

r := 0.15e-1

DDo2 := .17*3600

DDco2 := .12*3600

N := 20

P1o2 := 3600*(1000*(27*10^(-13)*24.45)*100)/(10000*0.986923267e-2)

0.2408029155e-3

P1co2 := 3600*(1000*(99*10^(-13)*24.45)*100)/(10000*0.986923267e-2)

0.8829440235e-3

P2o2 := Pi*r^2*DDo2*N/(e+r)

408.1106684

P2co2 := Pi*r^2*DDco2*N/(e+r)

288.0781188

eq1 := diff(y[o2](t), t) = ((P1o2+P2o2)*(21-y[o2](t))-100*(167*y[o2](t)/(1.6+y[o2](t))*.25))*(1/1300)

eq2 := diff(y[co2](t), t) = ((P1co2+P2co2)*(0.4e-1-y[co2](t))+.25*(.8*(167*y[co2](t)/(1.6+y[co2](t))))*100)*(1/1300)

 #                initial*conditional     @t=0     yO2=21 , yco2=0.04

sol := dsolve({eq1, eq2, y[co2](0) = 0.4e-1, y[o2](0) = 21}, numeric)

plots:-odeplot(sol, [[t, y[o2](t)], [t, y[co2](t)]], t = 0 .. 30, size = [500, 300])

 

Download SAL_ac.mw

Since 2018 the Mobius Project and Maple TA are owned and managed by DigitalEd, which is a different company than Maplesoft.

They have their own Mobius user forum.

You don't have to use a spacecurve for this. You could also transform the 2D plot into a 3D plot. (I usually prefer a transformed curve, since 2D plot does adaptive plotting. In this case, however, I force that off.)

Here is some added detail. In such cases it sometimes helps to use an odd grid size (if the midpoint is problematic), but it's not quite clear here. A little transparency for the surface allows the curve to show better, upon rotation and visual inspection. I also show it with narrower ranges (which is better than zooming).

restart;

with(orthopoly):
with(LinearAlgebra):
with(plots):
interface(rtablesize=20):

Digits:=15:

k:=2:
M:=2:
K:=2^(k-1):
N:=K*M:

 

 

alpha:=1:


alpha1:=alpha: 
beta:=1:
lambda:=(m,alpha1,beta)->sqrt((2*m+alpha1+beta+1)*GAMMA(2*m+alpha1+beta+1)*m!/(2^(alpha1+beta+1)*GAMMA(m+alpha1+1)*GAMMA(m+beta+1)));
psii:=(n,m,x)->piecewise((n-1)/K <= x and x <= n/K,  2^(k/2) *lambda(m,alpha1,beta)*simplify(JacobiP(m,alpha1,beta,2^(k)*x-2*n+1)), 0);
local i,j: psi:=(x)->Array([seq(seq(psii(i,j,x),j=0..M-1),i=1..K)] ):

w:=(n,x)->(1+x)^(1/gama-1):
omega:=(n,x)->w(n,2^(k)*x-2*n+1):

lambda := proc (m, alpha1, beta) options operator, arrow; sqrt((2*m+alpha1+beta+1)*GAMMA(2*m+alpha1+beta+1)*factorial(m)/(2^(alpha1+beta+1)*GAMMA(m+alpha1+1)*GAMMA(m+beta+1))) end proc

proc (n, m, x) options operator, arrow; piecewise((n-1)/K <= x and x <= n/K, 2^((1/2)*k)*lambda(m, alpha1, beta)*simplify(JacobiP(m, alpha1, beta, 2^k*x-2*n+1)), 0) end proc


psi:=t->Matrix(N,1,[seq(seq(psii(i,j,t),j=0..M-1),i=1...K)] ):
 
 


for i from 1 to N do
X[i]:=evalf((2*i-1)/((2^k)*M)):
end do:

for i from 1 to N do
T[i]:=evalf((2*i-1)/((2^k)*M)):
end do:

for i from 1 to N do
r[i]:=evalf(psi(T[i])):
end do:
Phi_mxm:=Matrix([seq(r[i],i=1...N)]);
 

Matrix(4, 4, {(1, 1) = 1.73205080756888, (1, 2) = 1.73205080756888, (1, 3) = 0., (1, 4) = 0., (2, 1) = -3.87298334620742, (2, 2) = 3.87298334620742, (2, 3) = 0., (2, 4) = 0., (3, 1) = 0., (3, 2) = 0., (3, 3) = 1.73205080756888, (3, 4) = 1.73205080756888, (4, 1) = 0., (4, 2) = 0., (4, 3) = -3.87298334620742, (4, 4) = 3.87298334620742})

 

P:=proc(k,M,nn) local PB,m,i,p,j,xi;
m:=M*(2^(k-1)):
xi:=(i,n)->((i+1)^(n+1)-2*i^(n+1)+(i-1)^(n+1));
PB:=Matrix(m,m):
for i from 1 to m do
p:=0:
for j from 1 to m do
if i=j then PB[i,j]:=1;
 fi:
if i<j then p:=p+1:
PB[i,j]:= xi(p,nn);
 fi:
end do;
p:=1:
end do:
PB:=1/m^nn/GAMMA(nn+2)*PB;

return PB;
end proc:
PP:=alpha->Phi_mxm.P(k,M,alpha).MatrixInverse(Phi_mxm);

proc (alpha) options operator, arrow; `.`(Phi_mxm, P(k, M, alpha), LinearAlgebra:-MatrixInverse(Phi_mxm)) end proc


key:=4:
rho:=1:
mmm:=1:
sigma:=1:

u_exact:=(x,t)-> 1/(1+exp(sqrt(key/6)*x-(5/6)*key*t))^2 ;
f1:=unapply(u_exact(x,0),x):
g1:=unapply(u_exact(0,t),t);
g2:=unapply(u_exact(1,t),t);

 

U:=Matrix( N,N,symbol=u);
wwxx:= diff(f1(x),x,x)+(psi(x)^+.U.PP(alpha).psi(t))(1):
wwt:= diff(g1(t),t)+x*(diff(g2(t),t)-diff(g1(t),t)-(psi(1)^+.PP(2)^+.U.psi(t))+psi(x)^+.PP(2)^+.U.psi(t))(1) :
ww:= f1(x)+g1(t)-g1(0)+x*(g2(t)-g2(0)-g1(t)+g1(0)-(psi(1)^+.PP(2)^+.U.PP(alpha).psi(t)))(1)+(psi(x)^+.PP(2)^+.U.PP(alpha).psi(t))(1) :

MC:=unapply(wwt -rho*wwxx -key*ww .(1-(1/mmm)*ww^sigma ),x,t):

u_exact := proc (x, t) options operator, arrow; 1/(1+exp(sqrt((1/6)*key)*x-(5/6)*key*t))^2 end proc

g1 := proc (t) options operator, arrow; 1/(1+exp(-(10/3)*t))^2 end proc

g2 := proc (t) options operator, arrow; 1/(1+exp((1/3)*sqrt(6)-(10/3)*t))^2 end proc

Matrix(%id = 18446884636710097494)

PDEson:=Matrix(N,N):

for i from 1 to N do
for j from 1 to N do
PDEson(i,j):=simplify(
evalf(

MC(X[i],T[j])


)
)=0:
end do:
end do:

coz:=fsolve({seq(seq(PDEson(i,j),i=1..N ),j=1..N )}):
U:=subs(op(coz),U):
 


UU:=(x,t)->evalf(f1(x)+g1(t)-g1(0)+x*(g2(t)-g2(0)-g1(t)+g1(0)-(psi(1)^+.PP(2)^+.U.PP(alpha).psi(t)))(1)+(psi(x)^+.PP(2)^+.U.PP(alpha).psi(t))(1)):

graphic_3D:=plot3d(UU(x,t), x=0..1, t=0..1, grid=[301,301],
                   color=gray,transparency=0.1,style=surface):

graphic_2D:=plot(UU(0.5,t),t=0..1,thickness=2,color=red,
                 adaptive=false,numpoints=2001):

display(
  graphic_3D,
  plottools:-transform((x,y)->[0.5,x,y])(graphic_2D),
  lightmodel=Light1
);

graphic_3Df:=plot3d(UU(x,t), x=0.499..0.501, t=0.4..0.6, grid=[301,301],
                   color=gray,transparency=0.1,style=surface):

graphic_2Df:=plot(UU(0.5,t),t=0.4..0.6,thickness=2,color=red,
                  adaptive=false,numpoints=2001):

display(
  graphic_3Df,
  plottools:-transform((x,y)->[0.5,x,y])(graphic_2Df),
  lightmodel=Light1
);

 

Download problem_ac.mw

It is not necessary to declare P1 as global when calling it from within P2 (since you merely use it, and P2 doesn't assign to the name).

And you shouldn't declare it local, since you want the P1 from the outer scope to be accessed. 

Why do you write that the result from your example should be x*dy , instead of x*dx ? (Your Question originally stated, "...the expression should reduce to x * dy")

Is it possible that you are hoping for something like this?

restart;

dx := f -> diff(f, x):
dy := f -> diff(f, y):

x := () -> x:
y := () -> y:

eq1 := x * dy:
eq2 := y * dx:

eq1(eq2);
                x dx

This looks slightly suspicious to me, but perhaps I'm not understanding your purpose properly.

The following work in Maple 18.

(In modern Maple 2020 you only need to change from active sum to inert Sum. But that change, alone, is insufficient to make it work in your Maple 18.)

restart

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

lambda := .3:

omega := lambda+mu+xi:

alpha := 2*sqrt(lambda*mu)

.9165151390

NULL

B[1] := BesselI(k-1, alpha*(u-y))

BesselI(k-1, .9165151390-.9165151390*y)

B[2] := BesselI(k+1, alpha*(u-y))

BesselI(k+1, .9165151390-.9165151390*y)

evalf(Int(unapply(Sum((B[1]-B[2])*exp(-omega*(u-y)), k = 1 .. infinity), y), 0 .. u));

.7246342704

evalf(Int(unapply(Sum((B[1]-B[2])*exp(-omega*(u-y)), k = 1 .. infinity), y), 0 .. u))

.7246342704

This is slower, using active sum instead of inert Sum.
evalf(Int(unapply(sum((B[1]-B[2])*exp(-omega*(u-y)), k = 1 .. infinity), y), 0 .. u))

.7246342704

 

NULL

Download int_sum.mw

I am guessing that your original question was to find the inflection points of x^sin(x) . I consider this reasonably likely since it is short and simple, it's 1st derivative is the formula your originally posted, and there is clearly some confusion since your original query showed a (mistaken) attempt at rootfinding its 1st derivative.

If my guess is wrong then you could simply change the definition of the procedure body of f below, to match your originally posted fprime_expr formula.

But it would be best if you could clarify what is the actual, intended question.

restart;

with(Student:-Calculus1):
with(plots):
interface(warnlevel=0):

#
# I am guessing that your original question was to find
# the inflection points of x^sin(x) .|
#
# If not, then you simply have to change the first line below.
#

f := x -> x^sin(x);

proc (x) options operator, arrow; x^sin(x) end proc

diff(f(x), x);

x^sin(x)*(cos(x)*ln(x)+sin(x)/x)

#
# Inflection points occur where the expression's 2nd derivative
# changes sign.
#
# Another way to conceptualize it is to think of the points
# at which the curve changes between being "convex up" and
# "convex down".
#

Inflpts := InflectionPoints(f(x), x=0..10, numeric);

[1.395288666, 2.916095860, 7.258616748, 8.576145756]

Roots(diff(f(x), x, x), x=0..10, numeric);

[1.395288666, 2.916095860, 7.258616748, 8.576145756]

#
# Yet another way to conceptualize it is to think of the
# points where the first derivative attains a relative
# maximum or
 minimum. (But not the end-points...)
#
{ op( ExtremePoints(diff(f(x), x), x=0..10, numeric) ) } minus {0.,10.};

{1.395288666, 2.916095860, 7.258616748, 8.576145756}

#
# Here, the shaded portion changes color when the curve changes
# between being convex up and convex down (that is, at the inflection
# points).
#
display(
  pointplot(map(p->[p,f(p)],Inflpts),
            symbolsize=20,symbol=solidcircle,color=blue),
  FunctionPlot('f(x)', x=0.0..10.0),
  axis[1]=[tickmarks=Inflpts], size=[500,250]
);

#
# If we plot the 2nd derivative we can see that it changes sign at
# these points.
#
display(
  pointplot(map(p->[p,0],Inflpts),
            symbolsize=20,symbol=solidcircle,color=blue),
  plot(diff(f(x), x, x), x=0..10, legend=Diff(f(x),x,x)),
  axis[1]=[tickmarks=Inflpts], size=[500,250]
);

#
# If we plot the 1st derivative we can see that it has extreme
# values at these points.
#
display(
  pointplot(map(p->[p,D(f)(p)],Inflpts),
            symbolsize=20,symbol=solidcircle,color=blue),
  plot(diff(f(x), x), x=0..10, legend=Diff(f(x),x)),
  axis[1]=[tickmarks=Inflpts], size=[500,250]
);

 

Download inflectionpts.mw

Why do you think that all your separate r1() calls (within the same loop iteration, or even the same piecewise!) will produce the same value?! They do not.

In the loop, first assign the r1() call to some temp variable name. Then use that assigned name in the piecewise and the print.

I had previously submitted a similar bug report against Maple 2020.0 for Linux, for this unfortunate behavior regression. The default font size for 1D input is still (ostensibly) set to 12pt, but the appearance of it was unpleasingly larger than in previous versions.

Of course it makes no sense. My monitor and dot-pitch are unchanged, so 12pt ought to appear the same as before. The default zoom level is the same, at 100%.

If I set the font size to 11pt then it appears visually as the same dimension as 12pt did in previous versions.

I can set a custom style (with 11pt default), and make that my gui's home page. But it's more awkward.

I don't know if the problem is just a Java version idiosyncrasy, or something related to hi-res tweaks, or other.

 

Your eq1 is an equation, with x1 given explicitly.

You can use it to substitute a value for x1 into your eq2 equation (or something else in which x1 appears).

For example,

   eval(eq2, eq1);

 

Your code is full of syntax errors. The error messages explain them.

For example, your brackets don't match in the first mistake. The number of opening and closing brackets (delimiters) are different.

Also, you need to enter if...then and while..do all in a single execution group. You have mistakenly tried to write thise across multiple execution groups. Use Shift-Enter to move to a new line inside an execution group, and only use Enter to finish and execute it.

First 129 130 131 132 133 134 135 Last Page 131 of 342