MaplePrimes Questions

I was setting up a worksheet for my vactor calculus class and tried to show how the DifferentialDiff command from the VectorCalculus package was limited.  I was expecting to have it give undefined or something similar for all directions with the function I am using.  Unfortunately, I got 0 when the directional derivative is truly undefined and I got undefined when the directional derivative is 0.

This is the code I am using.  Unfortunately, this site will not take the worksheet or plot the function for me.
 

with(VectorCalculus):
s := min(abs(x),abs(y));
plot3d(s,x=-1..1,y=-1..1);
DirectionalDiff(min(abs(x),abs(y)),<-1,1>,[x,y],point=<0,0>);

 

 

Hi, 
I just realized inadvertently that it was possible to edit a reply even if you were not the author (mmcdara is my personal account and sand15 my professional one and I modified under the former a reply I'd made with the later).

To be sure of that I've modified the last @acer's answer here 232397-Plotting-Multiple-Vectors-On-One-3D--Graph

You could show us what you've got so far

is now

You could show us what you have got so far

(I hope @acer will excuse me)


I think this is a weakness of Mapleprimes for no one should be allowed to change what others have written.

I solved this ode with IC, and obtained a solution.  Maple odetest says my solution satisfies the ODE but not the initial conditions. But I do not see why. When I plugin manually the initial conditions into the solution, I get true.

So I am not sure what is going on.

restart;
ode:=x*diff(y(x),x)*y(x) = (x+1)*(y(x)+1);
ic:=y(1)=1;
mysol:=y(x)-ln(y(x)+1)=-ln(2)+x+ln(x);
my_sol_at_IC:=subs([y(x)=1,x=1],mysol);

#now check manually
evalb(my_sol_at_IC);
is(my_sol_at_IC);

Using odetest gives

odetest(mysol,ode);
odetest(mysol,[ode,ic]);

What Am I doing wrong? 

Maple 2021.1

 

Edit June 12, 2021

This is another example where odetest gives different result depending on how the solution is written !

restart;
ode:=diff(y(x),x)=2/3*(y(x)-1)^(1/2):
mysol_1:=y(x) = 1/9*x^2 - 2/9*x + 10/9:
mysol_2:=y(x) - (1/9*x^2 - 2/9*x + 10/9) = 0 :
odetest(mysol_1,ode);
odetest(mysol_2,ode);

 

Hi,

I have created some vectors v[1] and v[2] and a vector field..I am new at Maple and learning so I can plot each vector on a 3D plot but cannot

figure out how to plot both vectors and the vector field on the SAME graph...

Any suggestions?

Thanks

Frank

Suppose that we have something like

plots:-animate(F,[theta],theta=0..2*Pi,background=plot([cos(t)-2,sin(t),t=0..2*Pi]),
scaling=constrained,axes=none);

I want to change the range of the parameter theta to something like theta=L[i],i=1..20.
Here, L is a list of numbers. Can I?
Thank you.

mapleatha

 

I can't figure what is going on here. I have an expression, where when I run the program, I see inside the debugger that the result of evalb(simplify(tmp_1)) where tmp_1 is the expression, gives false

When I copy the same tmp_1 expression to new worksheet and do evalb(simplify(tmp_1)) it gives true.

I added print statements in the code to print tmp_1 and print result of simplify(tmp_1) and for some reason, it gives false when I run the program, but it gives true when I do the same thing in a work sheet, by copying tmp_1 and trying it there.

Never seen anything like this, as expression is all numbers. Here is the print out when I run the program

Here is the same thing in worksheet

restart;
tmp_1 :=-(2*ln(-2))/7 - ln(-1)/7 = ln(1) - (2*ln(-2))/7 - ln(-1)/7;
simplify(tmp_1);
evalb(simplify(tmp_1));

                      true

and if you think I made mistake somewhere, here is also screen shot from the debugger window itself

 

again, same thing gives true in separate worksheet, copying same exact expression from above

There seem to be something loaded when I run my program that causes this difference, but I have no idea now what it is.  This has nothing to do with the debugger loaded btw, I am just using the debugger to show the details. When I run the program, without the debugger, I get false for the above, and I was trying to find why.

Any suggestions what to try and what to check for and what could cause this? Should it not give true when I run the program also? Could it be some Digits setting changed when the program run? I do not change any system defaults of any sort when running the program. 

Maple 2020.1

edit june 12, 2021

Here is another manifestation of the same problem I just found. There is something seriously wrong for it to behave this way.

This is an expression called tmp_1 in a local variable in a proc inside a module. There are not even any local symbols in it. When I run the program, all the attempts to show it is true fail. Some give FAIL and some give false when the result should be true

When I simply copy the expression from the debugger window to an open worksheet, I get true

Here is the screen shot

 

Only when I did is(expand(tmp_1)) did it give true

But when I copy the expression to the worksheet, it gives true using all the other attempts:

restart;
tmp_1:=1 = 5/4*exp(0)+1/4*piecewise(0 <= 1,-1,1 < 0,exp(-2)):
is(tmp_1);
is(simplify(tmp_1));
is((rhs-lhs)(tmp_1)=0);
is(simplify((rhs-lhs)(tmp_1)=0));
evalb(simplify((rhs-lhs)(tmp_1)=0));
is(expand(tmp_1))

I can't make a MWE so far, since these problems only show up with I run my large program. I think Maple internal memory get messed up or something else is loaded that causes these stranges problems.

For now, I added expand() to the things I should try. My current code now looks like

if is(tmp_1) or is(simplify(tmp_1)) or is((rhs-lhs)(tmp_1)=0)
               or is(simplify((rhs-lhs)(tmp_1)=0)) or evalb(simplify((rhs-lhs)(tmp_1)=0))
               or is(expand(tmp_1)) then    
   ....

Maple 2021.1

 

 

Given finite points on a plane, how to calculate the Newton polygon, i.e. the lower bound of its convex hull?

The convex hull can be obtained by ConvexHull command from ComputationalGeometry package, but I don't know how to get its lower bound easily. Besides that, theoretically the Newton polygon does not depend on the full structure of convex hull, so maybe there is a more effective way to do that?

 

P.S. There is a method DEplot_polygon in DETools that can "generate the plot of the Newton polygon of a linear differential operator at a point“, but I not sure how it can be used to calculate the Newton polygon for general cases.

When I fit a function to data [e.g., the logistic function to population data], I want to be able to plot both the function and the data. How do I do this in Maple Flow?

I came across this example from Maple's Online Help:

F := proc(t)
plottools[line]([-2,0], [cos(t)-2, sin(t)], color=blue),
plottools[line]([cos(t)-2, sin(t)], [t, sin(t)], color=blue),
plot(sin(x), x=0..t, view=[-3..7, -5..5]);
end proc:

animate(F,[theta],theta=0..2*Pi,background=plot([cos(t)-2,sin(t),t=0..2*Pi]),
scaling=constrained,axes=none);


Why is it not working?

Thank you!

mapleatha

Hi, I have a problem with tensor calculus. Please guide me.

I have two Tensors B[mu, nu] and A[~mu, ~nu].

Furthermore, I have two mixed tensors as U[~1, mu, nu] and U[~2,mu,nu]

rho, mu, and nu can run from 1 to 2. Hence, A, B, and both Us are 2*2 matrices.

Note that there was only one U, but since it is a mixed tensor, hence I have separated it into two tensors for making it easy.

Now I want to compute the following summation:

U[~rho,mu,nu] U[~alpha,beta,gamma] B[rho,alpha] A[~mu,~beta] A[~nu,~gamma].

Maple must give a number for rho, mu, nu, alpha, beta, and gamma (which can take 1 and 2) and compute "all" possible summations. Since the result will be just "a number", hence I could not use TensorArray.

How can I do it and get a result?

The forms of all tensors are in the attached maple file:
question.mw

Download question.mw

I need to change any occurance of   anything*sqrt(anything)  to say Z in any large expression.  (later, I can add the correct replacement once I know how to do it for Z).

I can change   sqrt(anything) with the help of the answers in Substitution-Of-Sub-Expressions-Is  but not  anything*sqrt(anything)

Here is an example to make it clear. Given

expr:=(-x + sqrt(9*x^2*exp(2*c) + 8)*exp(-c)+99)/(4*x)+ (a*sqrt(z)-99+sin(c*sqrt(r+4)+20))/3+10+1/(c+exp(-x)*sqrt(exp(x)))+sqrt(h)

Need to all some transformation on  those subexpressions circled above. For now, lets say I wanted to replace them with so it should becomes this

I can do this

subsindets(expr,anything^({1/2,-1/2}),ee->Z)

But I need to have the term (if any) that multiplies the sqrt as well included.

And that is the problem. Can't figure how to do it. When I try

subsindets(expr,anything*anything^({1/2,-1/2}),ee->Z)

Maple says Error, testing against an invalid type Ok. So anything*anything^({1/2,-1/2}) is not a type. What to do then?  Tried also subsindets(expr,t::anything*anything^({1/2,-1/2}),ee->Z) same error

And 

applyrule(t1::anything*sqrt(t0::anything)=Z, expr);

gives  which is wrong.

How to make this work in Maple using subsindets? Can one use pattern with subsindets? How to make a type for

               anything*sqrt(anything) 

Maple 2021.1

 

I 'd like to extract all items that contain "a" in an expression except "ab". What I can think of is to use the two functions select and remove to do it, but I feel a little less automated. Is there a better way?

f := a*b+a*c+a+b+c
s:=remove(has,select(has,[op(f)],a),a*b)                    

 s := [a c, a]

Hi,

 

I'm a student learning calculus I

 

Would someone explain what the synax in the steps means? I don't understand what is going on with the section that has _X0 in it.

 

 

 

I want to plot a 2D graph without labels. The labes=["",""] option does half of the job—it prints the empty string for labels (that's good) but it reserves room for them (that's bad).  In the following code I use a large size labelfont in order to exaggerate the effect:

restart;
plots:-setoptions(labelfont=[TIMES,64]);  # large labelfont selected on purpose
p1 := plot([[0,0],[1,1]], labels=["", ""]);

Note the large blank space at the bottom reserved for the the non-existent label.

I know one way to eliminate the label altogether:

p2 := subs(AXESLABELS=NULL, p1);

This does the right job but is there a more orthodox way of doing that?

Afterthought:  It would be good if the labels option to the plot command  accepted none as argument, as in labels=[none, none].

Why Maple likes to extract exp() outside the sqrt when its argument has minus sign vs. not?  Compare the following

restart;
eq2 := ln(2*u^2 + u - 1) = -c - 2*ln(x);
sol:=[solve(eq2,u)]:
simplify(sol[1])

and

eq2 := ln(2*u^2 + u - 1) = c - 2*ln(x);
sol:=[solve(eq2,u)]:
simplify(sol[1])

I like the above much better than the first one. Mathematica keeps both same form (i.e. keeps the exp() inside):

Maple's answers are correct ofcourse, I just do not understand the logic why when there is a minus sign on it likes to format it differently as shown.

Is there a way to make not do that?

 

1 2 3 4 5 6 7 Last Page 3 of 2035