MaplePrimes Questions

A simple question:

Can I define a Vector using:

a) Initial Value (a), Final Value (b) and the number of elements (N) (assuming linear spacing)
For example: Starts at 1, finishes at 12 with 5 elements:

[ 1 , 3.75 , 6.5 , 9.25 , 12 ]

b) Initial Value (a), Final Value (b) and step (s)
For example: Starts at 2, finishes at 6 with a step of 0.5

[ 2 , 2.5 , 3 , 3.5 , 4 , 4.5 , 5 , 5.5 , 6]

but using only a,b and N ; or a,b and s directly?



I know this can be done using the seq command and some basic definitions:

In the first case:
Vector([ seq(a+(b-a)/N*i,i=0..N) ]); should do the trick

And the second case is even easier:

PS. I know for the second case that using any arbitrary step can result in loosing the final value "b" of the sequence because you won't step on b using that arbitrary step value.

As I said above. I just want to know if there is a direct way to define these cases.

Does Maple have a built in hash map (associative array) datatype. I need to write a program where I will be iteratively building a lookup table. It will be very convenient for me if Maple has a hash map map structure built in.


Is it possible to capture programatically the values of theta, phi and psi when you manually rotate a 3D plot?

Thanks in advance

PS: The target version is Maple 2020

sometimes I get equations where there is clearly more simplification on it. For an example


Doing this by hand, I would now write the above as

by multiplying both sides by sqrt(u(x))

new_ode :=sqrt(u(x))*lhs(new_ode)=simplify(sqrt(u(x))*rhs(new_ode))

Since I am doing this in a program, without knowing what the expression is, I need to have this simplification done automatically, since I do not know before hand, if the resulting expression has this form or not. So I automatically call simplify on it.

I tried on a simpler example


And want to simplify this to u=1

I can't do  

new_expr :=sqrt(u)*lhs(expr)=sqrt(u)*rhs(expr)

Since this is done in a program, without the benefit of looking first and then deciding what to do. Everything needs to be automated since the expression can be anything.

So I need a generic operation to apply and have Maple simplify it, if this pattern exist.  I tried many things, but do far nothing is working:

expand(expr) assuming real;
simplify(lhs(expr)-rhs(expr)=0) assuming u<>0; # I expected this to work
simplify(expr) assuming real;
simplify(expr,sqrt) assuming real;
simplify(expr,sqrt) assuming positive;
simplify(expr,sqrt,symbolic) assuming positive;
simplify(expr,sqrt,symbolic,size=false) assuming positive;
simplify(expr) assuming u<>0;

no change.

Please do not give me an answer that requires one to use specific solution assuming one can see the expression. The solution needs to be something generic and work on any such expression that I can apply to any expression and have Maple simplify the sqrts on both sides, if they are there, since this is done in a program.

From the above, this should have worked

simplify(lhs(expr)-rhs(expr)=0) assuming u<>0;

Using Mathematica

expr = Sqrt[u] == 1/Sqrt[u]
Simplify[expr[[1]] - expr[[2]] == 0, Assumptions -> u != 0]

Any suggestions? I am sure there is a simple way to do this in Maple, I just have not found it yet.

Maple 2020.2



Why Maple can't simplify this expression to zero?

ode:=diff(y(x),x)-y(x) = x*y(x)^(1/2);
sol:=dsolve([ode, ic],y(x));

simplify(check) assuming x>0

In Mathematica:

check = -2*x + 4*x*Exp[x/2] - x^2 -x*Sqrt[x^2 - 8*x*Exp[x/2] + 4*x + 16*Exp[x] - 16*Exp[x/2] + 4]
Simplify[check, Assumptions -> x > 0]