Maple 2020 Questions and Posts

These are Posts and Questions associated with the product, Maple 2020

Suppose that we have a excel file as follows:


 


We can import the excel file to Maple as follows:

restart:
ExcelTools:-Import("C:\\Users\\student\\list.xlsx", "Page1");
  • QUESTION 1: How to filter the cell including ".edu" in the column A and how to print them to column B as follows:

 

I am having problems with the code I am trying to write in Maple 2020. I have attached the code in this question. 

I hope someone can help me out.

 

Error, invalid input: rhs received 0, which is not valid for its 1st argument, expr

 

Thanks very much
 

Download EXAMPLE.mw

 

Hello,

When I typ:

> phi; kappa;

It gives symbols φ and K.

I do not want this, I want the words phi and kappa.

How do I turn this off?

 

I understand it has something to do with SYMBOL or a Palette?
I see a Palette left named 'Greek' or 'Trigonometric & Hyperbolic' that have phi in them, but how do I delete a Palette (If that is how I stop these symbols)?


I'm not really good with the software, I just use it for some school work.

Thank you in advance for your help!

Hey

 

Is it possible to draw a slope field for a second order differential equation with initial conditions?

 

Why 3D .eps figures produced by Maple 2020 are often excessively large?

So, it´s a little heavy to the viewer and to compile to PDF.

  • How could we reduce the size without losing any quality? 

eq:= x^2-y^2*z-y*z^2;

plot3d(eq,x=0..1,y=0..1);

memory used=177.9MB, alloc=44.3MB, time=2.29
Picked up JAVA_TOOL_OPTIONS:
Initializing Java runtime environment.
munmap_chunk(): invalid pointer
Error, (in Maplets:-Display) computation interrupted

 

sometimes I have a need to do an assignment inside  operator call `if`(......) . but it is not possible it seems to do this in Maple.

This happens when I am using `if`(...) inside cat() to build a long string, and  depending on some condition, different string is build.  

This works fine in general, until I need to assign new value to a variable at the same time as I am building the string.

An example will make it more clear. Instead of the following

str:="A";
x:=10;

str:=cat(str,`if`(x=10," it was 10","it was not 10"));

if x=10 then
   x:=11;
else
   x:=9;
fi;                         

I'd like to do something like this (which does not work in Maple)

str:="A";
x:=10;
str:=cat(str,`if`(x=10,  x:=11;" it was 10" , x:=9; "it was not 10"))

Tried assign() also. Does not work.  I tried different variation on the above, none works. 

In Mathematica, the above is possible. But this is using standard `If`, which can be inlined

Is it possible to do something like this in Maple? 

The reason is that I do not have to do the checking twice: once to build the string, and once after that is done, in order to do the assignment. It is better if both are done in one place. The above is just an example. I could have more than one `if` inside as I am building the long string. 

Btw, how does one look up help on the operator if and not the statement if ? the help page for if does not talk about it or give any examples.

Maple 2020.2

 

EDİT:
I wrote a procedure in order to add the legends inside plots as follows:

restart:
newlegend:=proc(f::algebraic,g::algebraic,x_left,x_right)
local A,B,location,y_min,y_max,L1,L2,rect,T,F,G:

y_min:=min(minimize(f,x=x_left..x_right),minimize(g,x=x_left..x_right));
y_max:=max(maximize(f,x=x_left..x_right),maximize(g,x=x_left..x_right));
F:=unapply(f,x):
G:=unapply(g,x):
L1, L2:=plottools:-line([x_left,0.9*y_max],[x_left+abs(x_right-x_left)/15,0.9*y_max],color=red), plottools:-line([x_left,0.7*y_max],[x_left+abs(x_right-x_left)/15,0.7*y_max],color=blue):
rect:=plottools:-rectangle([x_left,y_max-abs(y_max-y_min)/3],[x_left+abs(x_left+x_right)/4,y_max],color=cyan);
T:=plots:-textplot([[x_left+abs(x_right-x_left)/9,0.9*y_max,f],[abs(x_left+x_right)/9,0.7*y_max,g]]):
A:=plot(F(x), x=x_left..x_right, style=line, color=red   ):
B:=plot(G(x), x=x_left..x_right, style=line,  color=blue  ):

plots:-display(A, B, L1, L2, T,rect,  scaling=constrained, size=[800,300],axes=boxed);
end proc:
newlegend(sin(x),cos(x),0,2*3.14)

 

Question 1: The lines behind the cyan rectangle seem. How to make the rectangle opaque? 

Question 2:  Could you help me improving the procedure? Because I have bad results for some functions. 

For example;

newlegend(exp(x),x,0,3)

Some Suggestions:

  • If we add an option to change the location of the legends like 'northeast' or 'southwest' etc, it will be a really good procedure.
  • If we add an option to remove the rectangular like "rectangular=off", it will be great.

If you share your valuable ideas and comments, I will be very glad. 

Hi,


I was applying the Grip Map to the procedure LArip. It apparently finished in less than 5 seconds. But when I wanted to display the results as an Array, this step required minutes. How can this time be reduced? Here is a piece of the code:

n := 8;
r := 2^n;
M := Vector(r, randperm(r) + [-seq(1, i = 1 .. r)], datatype = integer[4]);

LArip := proc(k::integer, r::integer, M::Vector(datatype = integer[4]))
local N, j, t, i, A;
N := Vector(r, 0); A := Vector(r, 0);
i := k - 1;
for j from 0 to r - 1 do
for t from 0 to r - 1 do
N[t + 1] := Occurrences(1, Split(Xor(And(t, i), And(M[t + 1], j)))) mod 2;
end do;
A[j + 1] := Occurrences(0, convert(N[], list));
end do;
return convert(A, list);
end proc;

infolevel[Grid:-Map] := 3;
rt := time[real]();
Bb := Grid:-Map(k -> LArip(k, r, M), [$ (1 .. r)]);
GridMapTime := time[real]() - rt;
 

The worksheet is here:

Magma_GridMap.mw

Thank you for your help.

restart;
eq := 61*x^2 + 1 = y^2;
sols := (isolve(eq) assuming (x::posint, y::posint)):
for sol in sols do
  print(subs(_Z1 = 1, sol));
end do;

isolve returns the solution in terms of _Z1, indicating there may be infinite number of solutions?
I think {x = 226153980, y = 1766319049} is the only solution with x::posint, y::posint.

How do I restrict this to only positive integers in the solution?

Why Float(undefined) appears in calculation integrals

3333.mw

command completion (when hitting the ESC key) in Maple could be made more useful. It does not seem to support type names for example.

What shows up on the command completion window are  possible commands that start with that partial text.

It does not list other known names by Maple, such as type names and other options.

This makes it hard to use in many places, where one have to remember type names exactly instead of the system helping them by listing all possible type names that start with that string.

Is there a way around this? Will Maple next version support smarter and more complete command completion menu?

 

 

The order in which expressions evaluate in Maple is something that occasionally causes even advanced users to make syntax errors.

I recently saw a single line of Maple code that provided a good example of a command not evaluating in the order the user desired.

The command in question (after calling with(plots):) was

animate(display, [arrow(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

This resulted in the error:

Error, (in plots/arrow) invalid input: plottools:-arrow expects its 3rd argument, pv, to be of type {Vector, list, vector, complexcons, realcons}, but received 0.5000000000e-1*(cos(t)^2+sin(t)^2)^(1/2)
 

This error indicates that the issue in the animation is the arrow command

arrow(<cos(t), sin(t)>)

on its own, the above command would give the same error. However, the animate command takes values of t from 0 to 2*Pi and substitutes them in, so at first glance, you wouldn't expect the same error to occur.

What is happening is that the command 

arrow(<cos(t), sin(t)>)

in the animate expression is evaluating fully, BEFORE the call to animate is happening. This is due to Maple's automatic simplification (since if this expression contained large expressions, or the values were calculated from other function calls, that could be simplified down, you'd want that to happen first to prevent unneeded calculation time at each step).

So the question is how do we stop it evaluating ahead of time since that isn't what we want to happen in this case?

In order to do this we can use uneval quotes (the single quotes on the keyboard - not to be confused with the backticks). 

animate(display, ['arrow'(<cos(t), sin(t)>)], t = 0 .. 2*Pi)

By surrounding the arrow function call in the uneval quotes, the evaluation is delayed by a level, allowing the animate call to happen first so that each value of t is then substituted before the arrow command is called.

Maple_Evaluation_Order_Example.mw

Hello

I am currently working on a visual proof that cutting a cone with a plane, can give you a mathematically correct ellipse.
Therefore i want to animate a cone, using the "cone" command, where you can set the origin, radius and height. I was wondering if it is possible to, using the animate command, make an animation with a cone, either chaning radius of base or height. I have tried various combinations of different commands, but have not had any success. I hope you can help me out!

- Oscar

I want to export Maple 3d graphics to Latex with high quality. ( MAPLE 2020.1)

I export the 3d graphics to a .jpeg or.png file, but the quality of graphics is very poor. So, I want to prefer Encapsulated PostScript files (.eps) format.

 I select the figure, right-click it and choose "Export as". and  I save the figure as  .eps file. No problem I get a file. But when I add the eps figure to Latex, I live some problems:

MY Example Code:

restart:
with(plots):
scheme1 := ["zgradient",["Blue","Cyan","Green","Yellow","Orange","Red"]]:

P1:=plot3d(x*y, colorscheme=scheme1,style=surfacecontour ): 
P2:=plot3d(x*y,colorscheme=scheme1,style=point,symbol=asterisk): 
final_plot:=display({P1,P2}); #I want to export this figure to .eps

 

PROBLEMS which I live:

  • Sometimes I get the result as follows:

  • Sometimes compiling takes too long time in latex, I don't get any results or get an error. (I tried on the all of TexStudio or TexMaker or overleaf)

I read the previous post on this site and applied the suggestions, but I still live the same problem.

 

P.S. 

I can add Maple 2d graphics to LATEX without any problem.

Any help would be appreciated.

First 16 17 18 19 20 21 22 Last Page 18 of 55