MaplePrimes Questions

I was trying to use the idea explained in this post (), using `densityplot` to create a barplot. But there are several difficultes specially using new Maple that has problem with exporting plots in pdf format the same as displayed inside Maple.

The example code:

zmin := 0;
zmax := 1;
verthuebar := plots:-densityplot(z, dummy = 0 .. 1, z = zmin .. zmax, grid = [2, 10], style = patchnogrid, size = [90, 260], colorscheme = [ColorTools[Color]([0, 0, 1]), ColorTools[Color]([1, 0, 0])], style = surface, axes = frame, labels = [``, ``], axis[1] = [tickmarks = []], axis[2] = [tickmarks = [aList[1] = "0   ", 0.5 = typeset(alpha*` `), 1 = "1    "]]);

Problems:

1- When I export the bar-plot as `.eps`, it shows white lines as a grid, while I don't want it and it is not the same way it is displayed at Maple! 

test-1.pdf

I tried adding `gridlines=false` and other similar things, but had no effect. I changed `10` to `3` in `grid = [2, 10]`, but it increases the distance of 0 and 1 from the borderies and therefore wrong numbers will be read from the color bar. Exporting the picture as `.pdf` doesn't have that gridlines problem, but destroys the proportions of the image, so I want to stick on the `.eps` one, but without those white lines.

2- How can I have 0 and 1 exactly on the start and end of the color bar and with no distance from the edges? I can use `view=[0..1,0..1]` at the end of the above code, but depending on the number in the `grid=[2,n]` that I choose, the colors may not start and end exactly at the specified colors.

I think Maple's simplify could need much more improvement. 

Here is another example, which I can't get Maple to simplify to zero for positive x, when it is clearly zero there

restart;
ode:=x = (diff(y(x),x)^2+1)^(1/2)*diff(y(x),x);
mysol:=y(x)=_C1+int(  sqrt(-2+2*sqrt(4*a^2+1))/2,a=0..x);
check:=odetest(mysol,ode);

The above is zero for x>0

But I tried every assumption or option on it, and it will not give zero.

simplify(check) assuming x>0;
simplify(check,symbolic);
simplify(check,symbolic,sqrt) assuming x>0;
simplify(check,sqrt) assuming x>0;
simplify(check,radical) assuming x>0;
simplify(check,power) assuming x>0;
etc...

Here it is in Mathematica

ClearAll[x];
check = x - (Sqrt[2 + 2 Sqrt[4 x^2 + 1]]) (Sqrt[-2 + 2 Sqrt[4 x^2 + 1]])/4;
Simplify[check, Assumptions -> x > 0]

Why Maple can't simplify this to zero?  Is there some other specific trick one must use each time?

Maple 2020.2 on windows 10

 

hi. i write this code with "for" loop. but i dont want to show comma sign in my print. how can i remove it

for example

thanks in advance

code

restart;
for i to 2 do
    for j to 2 do S[i, j] := 2*mu*varepsilon[i, j] - add((2*mu)/3*varepsilon[r, r]*delta[i, j], r = 1 .. 3); print("S"[i, j] = S[i, j]); end do;
end do;
 

HI everyone I have this excel spreedsheet ValeursB.xlsx and I know how to import Data in Maple. But What i don t know is how to tell to maple to use this data, to be able to make differents plots like you can see in the picture, i have shared. Your helps is very welcome.

The interval [0,T] is divided into n subintervals [i*h, (i + 1)*h], i = 0,1,2, . . . ,n -1, of equal lengths h where h=T/n.

The first (n + 1) hat functions   is defined as follows:

 

Question:

How to find g_ij ( the value of the following integral)

=

where 

i = 0,1,2, . . . ,n -1,

alpha>0,

0<=t<h.

 

In fact, 

by using the Maple, I want to check whether it is equal to the following expression or not:

There is the following differential equation:

 

where l(t)=2+t,  g=10 and the goal is to find φ(t). I wrote the following code:

M := diff(phi(t), t);

M1 := diff(M, t);
g := 10;
M2 := diff(l(t), t);
ode := M1 + 2*M2*M/l(t) + g*sin(phi(t))/l(t) = 0;
ics := phi(0) = 1, D(phi)(0) = 1;
l := t -> 2 + t;
ode;
dsovle([ode, ics]);
 

But I don't get any result. How can I solve this differential equation?

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?

Thanks.

------
------

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:
Vector([seq(i,i=2..6,0.5)]);

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.

Hi,

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

restart;
ode:=y(x)=diff(y(x),x)^3*y(x)^2+2*x*diff(y(x),x);
new_ode:=PDEtools:-dchange({y(x)=sqrt(u(x))},ode,{u});

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

expr:=sqrt(u)=1/sqrt(u)

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:

restart;
expr:=sqrt(u)=1/sqrt(u);
expand(expr);
expand(expr) assuming real;
combine(expr);
combine(expr,sqrt);
combine(expr,radical);
combine(expr,power);
expand(expr);
collect(expr,sqrt(u));
collect(lhs(expr)-rhs(expr)=0,sqrt(u));
simplify(lhs(expr)-rhs(expr)=0) assuming u<>0; # I expected this to work
simplify(expr) assuming real;
simplify(expr,size=false);
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,symbolic,size=false);
simplify(expr) assuming u<>0;
rationalize(expr);

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


expr:=sqrt(u)=1/sqrt(u);
simplify(lhs(expr)-rhs(expr)=0) assuming u<>0;
simplify(lhs(expr)-rhs(expr)=0,symbolic);

Using Mathematica

ClearAll[u];
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?

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

simplify(check) assuming x>0

In Mathematica:

ClearAll[x]
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]

note that using x>=0 instead of x>0 does not change the above output.

Any work around in Maple?

 

How to change the size of Text area box , i want to increase the box size

I have been trying to figure out a good way to work with z-transform expressions which display keeping everything in terms of negative powers of z. I am not using the z-transform procedure, but writing the equations directly by hand.

For example, given an expression a*z^(-1), Maple will output this as a/z. This is even more dramatic when dealing with rational forms in z^(-1).

The issue here is that z^(-1) has an explicit meaning in terms of delay blocks and causality.

If anyone has a nice way for Maple to return these in a pretty-printed fashion retaining the z^(-1) terms, that would be great. I still need to be able to manipulate the expressions algebraically.

 

I think this is also wrong ode type given by ode advisor.   The following clearly can't be _dAlembert ode. 

restart;
ode:=diff(y(x),x)*tan(diff(y(x),x))+ln(cos(diff(y(x),x))) = y(x);

It does not even have an explicit on its own, in the RHS. D'Alembert ode has the form

The ode above has the form   y=f(p)+g(p)  or one can argue the form y=F(p). Either way, there is no in the RHS.

For the first form above, f(p)=p*ln(p) and g(p)=ln(cos(p))

So why Maple says

DEtools:-odeadvisor(ode)

And Maple knows this. But for some reason, for the above ode, I think it made the wrong call.

restart;
ode:=y(x)=x*f(diff(y(x),x))+g(diff(y(x),x));
DEtools:-odeadvisor(ode);

ode:=y(x)=f(diff(y(x),x))+g(diff(y(x),x));   #no x
DEtools:-odeadvisor(ode)

 

Is there something I am overlooking here? 

Maple 2020.2 with Physics 908 on windows 10

 

I need to find and remove any abs that shows up only inside ln anywhere in an expression.

I used to do this in multiple steps before, by using loop and subs. But I am now learning evalindet which is powerful command. I should use it more. 

I wanted to see if it is possible to do this in one call to evalindent. Both finding and replacing.

Here is an example. Given

expr:=sin(x)+ln(abs(x))+ln(x+abs(y)/sqrt(abs(x+3)))+ln(x^3)+cos(abs(x));

The goal is to change it to the following

This is what I ended up with

restart;
expr:=sin(x)+ln(abs(x))+ln(x+abs(y)/sqrt(abs(x+3)))+ln(x^3)+cos(abs(x));
expr:=evalindets(expr,
          'specfunc( satisfies(u->has(u,abs)),  ln)',
          f->evalindets(f,'specfunc(anything,abs)',f->op(1,f))
          )

My question is: Is there a more optimal or better way to do this? I had to use evalindets inside the transformer to remove the abs. At first I did not know if it will work, but it did work.

Any place for improvement?

Maple 2020.2

First 331 332 333 334 335 336 337 Last Page 333 of 2308