MaplePrimes Questions

Hi User!

Hope you would be fine with everything. I have a vector "POL" of M dimension obatined for the following expression

restart; with(LinearAlgebra); nu := 1; M := 3;
for k while k <= M do
Poly[k] := simplify(sum(x^i*GAMMA(nu+1)/(factorial(i)*GAMMA(2*nu)), i = 0 .. k-1))
end do;
POL := `<,>`(seq(Poly[k], k = 1 .. M))

and I want to construct a matrix of M by M by collocating it on the points x=i/(M-1) for i=0,1,2,...,M-1 like the following way,

For M=3 I need

Matrix(3, 3, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/2), (1, 3) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/2), (2, 3) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/2), (3, 3) = Poly[3](1)});

For M=4 I need

Matrix(4, 4, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/3), (1, 3) = Poly[1](2/3), (1, 4) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/3), (2, 3) = Poly[2](2/3), (2, 4) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/3), (3, 3) = Poly[3](2/3), (3, 4) = Poly[3](1), (4, 1) = Poly[4](0), (4, 2) = Poly[4](1/3), (4, 3) = Poly[4](2/3), (4, 4) = Poly[4](1)})

 

and general form is like this

[[[Poly[1](0/(M-1)),Poly[1](1/(M-1)),Poly[1]((2)/(M-2)),...,Poly[1]((M-1)/(M-1))],[Poly[2](0/(M-1)),Poly[2]((1)/(M-1)),Poly[2]((2)/(M-1)),...,Poly[2]((M-1)/(M-1))],[Poly[3]((0)/(M-1)),Poly[3]((1)/(M-1)),Poly[3]((2)/(M-1)),...,Poly[3]((M-1)/(M-1))],[...,...,...,...,...],[Poly[M]((0)/(M-1)),Poly[M]((1)/(M-1)),Poly[M]((2)/(M-1)),...,Poly[M]((M-1)/(M-1))]]];

Another problem is I want to define a vector of M dimension using a function f(x)=sin(x) and two points a=1, b=2 like the following way,

Vec:=[[[a],[f((1)/(M-1))],[f((2)/(M-1))],[f((3)/(M-1))],[...],[f((M-1)/(M-1))],[b]]]
Please fix my problem. I'm waiting for your kind response.
Special request @acer @acer @Carl Love @Kitonum @Preben Alsholm

Dear Users!

Hope you would be fine with everything. I want the simpliest for of the following expression in two step:

diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z))+u[delta]*lambda[1]*(diff(U(X, Y, Z, tau), tau, tau))/L[delta]+u[delta]*lambda[1]*(diff(U(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), X))/L[delta]+u[delta]*lambda[1]*U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, X))/L[delta]+u[delta]*lambda[1]*(diff(V(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), Y))/L[delta]+u[delta]*lambda[1]*V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, Y))/L[delta]+u[delta]*lambda[1]*(diff(W(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), Z))/L[delta]+u[delta]*lambda[1]*W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, Z))/L[delta];
Step 1:
diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z))+u[delta]*lambda[1]*(diff(diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z)), tau))/L[delta];
Step 2: (final form I need)
(1+(u[delta] lambda[1])/(L[delta]) (&PartialD;)/(&PartialD;tau)) ((&PartialD;)/(&PartialD;tau) U(X,Y,Z,tau)+U(X,Y,Z,tau) ((&PartialD;)/(&PartialD;X) U(X,Y,Z,tau))+V(X,Y,Z,tau) ((&PartialD;)/(&PartialD;Y) U(X,Y,Z,tau))+W(X,Y,Z,tau) ((&PartialD;)/(&PartialD;Z) U(X,Y,Z,tau)));
I'm waiting for your response.
Special request:
@acer @Carl Love @Kitonum @Preben Alsholm

I'm fairly new to using Maple and am having a bit of a hard time calculating the following inner product. Firstly, I define the tensors (which to this end I'm not certain they are correctly defined), 

with(Physics):

Setup(mathematicalnotation=true)

Setup(coordinatesystems=spherical):

ds2 := - dt^2 + a(t)^2 /( 1-k*r^2)*dr^2 + a(t)^2*r^2*dtheta^2 + a(t)^2*r^2*sin(theta)^2*dphi^2;
Setup(coordinates = spherical, metric = ds2);

e[mu, `~nu`] = Matrix(4, {(1,1)= a(t)/sqrt(1-k*r^2), (2,2)=a(t)*r, (3,3)=a(t)*r*sin(theta), (4,4)=1}, fill=0); (15) 
Define((15))
f[`~mu`, nu] = Matrix(4, {(1,1)=sqrt(1-k*r^2)/(a(t)), (2,2)= 1/(a(t)*r), (3,3)=1/(a(t)*r*sin(theta)), (4,4)=1}, fill=0); (28)
Define((28))

Thus, I defined two mixed tensors e[mu, `~nu`] (one covariant and one contravariant index ) and f[`~mu`, nu] (one contravariant and one covariant index).

Then, I try to take the following inner product between the two mixed tensors and the Christoffel symbols of the second kind, namely,

e[nu, `~alpha`].f[`~sigma`, beta].Christoffel [`~nu`, sigma, mu];

where I used the Physics['.'] command . However, when I try taking this inner product, it returns unevaluated.

 

Did I define the mixed tensors incorrectly? Does it matter how you define the indices when you're gonna take the inner product? Because taking the inner product of simply e[mu, `~nu`].f[`~mu`, nu] also returns unevaluated. Also, I should mention that  e[mu, `~nu`] and f[`~mu`, nu] are inverses of each other, is there any way to define one and get the other, since, simply changing the way in which the indices are raised and lowered doesn't take the reciprocal of the components. 

Do you agree this solution given by Maple is not correct?

restart;
pde := diff(u(x,t),t)+diff(u(x,t),x)=0;
bc  := D[1](u)(0,t)=0;
ic  := u(x,0)=exp(-x^2);
sol:=pdsolve([pde,ic,bc],u(x,t)) assuming x>0,t>0;
pdetest(sol,pde)

Result of pdetest should be zero.

I think the PDE itself is not well posed (I copied it from different forum to see what Maple does with it). But still the solution clearly does not satisfy the PDE itself for x not zero. 

Maple 2019.2.1 with Physics version 573

Hi, 

It seems to me that variables (maybe I should have use 'names' instead) become "typed" only once they have been instanciated with ':=' ?

But is it possible in Maple  to do something like that
"I declare that variable V will be of type T even if I do not explicitely instanciate it?"

... or is it here one of the distinction between a "typed CAS" and a "non typed" CAS ?

Thanks in advance

test.mw

Please see the attached.

NLPSolve('f(x,y,'g(x,y)')', x=0..1,y=0..1) is not working...

with(ExcelTools):

 

Export(R,"𝙴𝚖𝚙𝚕𝚘𝚢𝚎𝚎𝚜.𝚡𝚕𝚜","𝙿𝚊𝚢𝚛𝚘𝚕𝚕","𝙱𝟸")

 

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

how to make the export excel file take his name from variable ?

for example 

V:=800;

so the export file will make name as 800 , and so on |?

How to use for loop inside unapply operator

test.mw

I am not sure why I cannot do: plot3d([f(x,y,'g(x, y)')], x=0..1,y=0..1).

And the use of single quote in Maple 2019 and 2017 are giving different results. that is, the plot (note, not plot3d) results in the attched script by Maple 2017 and 2019 are different...

I want to know whether sqp method do a local search or a global search. Thank you.

I found that i can use  simplify under assumption to gain the result :

simplify((-p^3)^(1/3), assume = negative);
                               -p

simplify((p^3)^(1/3), assume = positive);
                               p


But confusing ! I expected the simplify command just with the option=symbolic works at the same manner ?


 

My purpose :

simplify((-p^7)^(1/7), assume = negative);

-p

(1)

simplify((p^7)^(1/7), assume = positive);

p

(2)

Without negative sign the simple symbolic result appears :

simplify((p^3)^(1/3), symbolic);

p

(3)

In power 3 the Imaginary part is included too !

simplify(((-p)^3)^(1/3), symbolic);

(1/2)*p*(I*3^(1/2)+1)

(4)

NOT WORKING !

simplify((p^7)^(1/7), symbolic);

p

(5)

simplify((-p^7)^(1/7), symbolic);

p*(-1)^(1/7)

(6)

simplify((-p^7)^(1/7), symbolic, radical);

(-p^7)^(1/7)

(7)

``

``


 

Download odd_negative_powers.mwodd_negative_powers.mw

 

I create a lot of procs and functions and then find myself having to create sequences of their values. I use for loops, seq or create a new proc to do it.

 

e.g., suppose I have a proc like f := n->n^2 or whatever. I can do [seq(f(k),k=0..5)]. Is there a very simple notation that maple has to do the same? E.g., hypopthetically f($$0..5) and it handles the accumulation in to a sequence itself

e.g., I have an equation that is written like a/b*c and maple rewrites it as a*c/b.

c is a complicated expression and when it's written with b under it, it takes up far more vertical spaces than necessary giving less visual resolution even if b is just 2.

In latex notation it is the difference between \frac{a}{b} c and \frac{ac}{b}.

 

In general what is the process? I noticed I can sometimes use ` ` to block things in but this also interfers with mathamtical notation. e.g., `3^f` becomes just that rather than f writen as a superscript.

Clearly I could hack it using various things but I want something direct and simple that tells maple not to try to do it's magic tricks.

For example, sometimes I might have 2*(a + b) and maple displays it as 2a + 2b. If I write it as `2`*(a+b) then this is noted as 2*(a+b) but the 2 is different.. I guess it is treated as a string or something... For my cases it works since I'm not trying to calculate anything from the expression but just for visual purposes, other times though I might want to calculate(usually the visual doesn't matter in calculation but sometimes both are desired).

I really want to avoid having to litter the expressions with special syntax to get such simple behavior. Something to tell maple not to carry out whatever algebraic transform it is programmed to do.

 

BTW, what does ! do? !3 + 4 opens a new window with an exit code.

 

 

First 454 455 456 457 458 459 460 Last Page 456 of 2281