MaplePrimes Questions

How we can generate given matrix A with help of loop?

Surely there is some button I can click that simply shows all my posts/questions without having to search?

Hello everyone,

I am a studen and have an astrophysics class where I programmed a basic space probe to go from a planet A to a Planet B.

I have a 2D grap and a 3D graph already done however I would like to animate them.

I have included both a picture and my whole program. Also see some code below. 

Thanks to all.

 

Download SondeII_(1).mwSondeII_(1).mwSondeII_(1).mw

restart:

with(linalg):
with(DEtools):

#Sonde
Position := [x(t), y(t)]:

#Terre
omega1 :=2*Pi:
r1 := [cos(omega1*t), sin(omega1*t)]:
x1(t) := innerprod([1, 0], r1):
y1(t) := innerprod([0, 1], r1):

#Mars
omega2 := sqrt(2)*Pi/2:
phi2 := Pi/2:
r2 := [2*cos(omega2*t + phi2), 2*sin(omega2*t+ phi2)]:
x2(t):= innerprod([1, 0], r2):
y2(t):= innerprod([0, 1], r2):

#Les couplages gravitationnelles (masse).
c1 := 1.0:
c2 := 0.2:
c0 := 100:

#Les forces appliqués sur la sonde
ForceGravitationnelle1 := -c1*(Position-r1)/(sqrt((x(t)-x1(t))^2+(y(t)-y1(t))^2))^3:
ForceGravitationnelle2 := -c2*(Position-r2)/(sqrt((x(t)-x2(t))^2+(y(t)-y2(t))^2))^3:
ForceGravitationnelle0 := -c0*(Position)/(sqrt((x(t))^2+(y(t))^2))^3:

#La somme des forces.
Force := ForceGravitationnelle1 + ForceGravitationnelle2 + ForceGravitationnelle0:

Fx := innerprod([1, 0], Force):
Fy := innerprod([0, 1], Force):

#L'interval de temps.
TempsInit := 0:
TempsFinal := 3:

#Les équations différentielles de deuxieme ordre.
eq1x := (D(D(x)))(t) = Fx:
eq1y := (D(D(y)))(t) = Fy:

#Les conditions initiales..
phi0 :=(Pi)/2:
V0 := 12.946802:
x0 := 1:
y0 := 0.1:
Vx0 := V0*cos(phi0):
Vy0 := V0*sin(phi0):

ConditionsInit := x(0) = x0, y(0) = y0, D(x)(0) = Vx0, D(y)(0) = Vy0:

#La trajectoire de la sonde.
Trajectoire := dsolve({eq1x, eq1y, ConditionsInit}, {x(t), y(t)}, numeric, range = TempsInit..TempsFinal, maxfun=0):

#Tracage du graphique de la trajectoire en 2D
plots[odeplot](Trajectoire, [[0,0],[x1(t),y1(t)],[x2(t), y2(t)], [x(t), y(t)]],
TempsInit..TempsFinal, numpoints = 1000, axes = boxed, scaling = constrained, thickness = [2],
color = ["Black", "Green", "Blue", "Red"],
labels = ["X (L)", "Y (L)"],
labelfont = ["Times", 14], title = "Mouvement de la sonde dans le plan",
titlefont = ["Helvetica", 14], style=[point,line,line,line], symbol = solidcircle);

#Tracage du graphique en 3D:
plots[odeplot](Trajectoire, [[0,0,t],[x1(t),y1(t), t],[x2(t), y2(t), t], [x(t), y(t), t]],
TempsInit..TempsFinal, numpoints = 1000, axes = boxed, scaling = constrained, thickness = [3],
color = ["Black", "Green", "Blue", "Red"],
labels = ["X (L)", "Y (L)", "t"],
labelfont = ["Times", 14], title = "Mouvement de la sonde dans le plan",
titlefont = ["Helvetica", 14], style=[point,line,line,line], symbol = solidcircle);
 

 

 

 

 

 


 

Hi

I will write a code that to take one matrix (for example A) and produce B matrix, how write this code in Maple? the A matrix is optional.

A:=Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]]);

B := Matrix([[10, 11, 12], [7, 8, 9], [4, 5, 6], [1, 2, 3]]);

Tnx...


I am unable to replicate solution of problem 169 below.  Can you help me debug?

Melvin Brown

Schrdiff(o(t), t, t)dinger PDE on (x,y,t) with initial and boundary conditions. Zero potential: problem number 169

 

Here is the problem 169 specification and solution from the Nasser list:

restart

with(PDEtools); with(CodeTools)

x:='x';t:='t';y:='y';hbar:='hbar';

x

 

t

 

y

 

hbar

(1.1)

interface(showassumed=0);

1

(1.2)

pde:=I*diff(f(x,y,t),t)=-hbar^2*(diff(f(x,y,t),x$2)+diff(f(x,y,t),y$2))/(2*m);

I*(diff(f(x, y, t), t)) = -(1/2)*hbar^2*(diff(diff(f(x, y, t), x), x)+diff(diff(f(x, y, t), y), y))/m

(1.3)

ic:=f(x,y,0)=sqrt(2)*(sin(2*Pi*x)*sin(Pi*y)+sin(Pi*x)*sin(2*Pi*y));

f(x, y, 0) = 2^(1/2)*(sin(2*Pi*x)*sin(Pi*y)+sin(Pi*x)*sin(2*Pi*y))

(1.4)

bc:=f(0,y,t)=0,f(1,y,t)=0,f(x,1,t)=0,f(x,0,t)=0;

f(0, y, t) = 0, f(1, y, t) = 0, f(x, 1, t) = 0, f(x, 0, t) = 0

(1.5)

cpu_time := timelimit(60*10,CodeTools[Usage](assign('sol',pdsolve([pde,ic,bc],f(x,y,t))),output='realtime'));

memory used=159.58MiB, alloc change=102.00MiB, cpu time=4.37s, real time=4.23s, gc time=452.40ms

 

4.233

(1.6)

with(plots); evalf(f(1, 2, 2))

f(1, 2, 2)

(1.7)

plot3d(f(x, y, 3), x = -1 .. 1, y = -1 .. 1)

Warning, expecting only range variables [x, y] in expression f(x,y,3) to be plotted but found name f

 

 

The problem seems to fail... Why?

``


 

Download TestCaseforMapleStaff.mw

Hi everyone. Thank you all in advance.

My question: is there a function for quotient and reminder for something like:

(22*Pi/3, Pi/2)

I tried frem, rem, quo. Neither of them worked.

I'm creating some graphs in another program that I want to then insert into the document side by side. However, since the plots are not created in Maple I'm not sure if I have the ability to position them side by side with the embed command. Any workarounds (other than creating the plots in maple)?

I am trying to derive Heisenberg's equation of motion for an observable given by two Fermionic operators. The Hamiltonian has both Fermionic and Bosonic creation and annihilation operators.  

H := sum(g[`qαβ`]*C[alpha]*v[beta]*b[q]-g[`qαβ`]*B[q]*V[beta]*c[alpha], `qαβ`)

When I take the commutator with 

A := C[nu]*c[nu]

and try to simplify down it will only go so far. I know the final answer and have checked what it gives by hand, but it will not sum over the different indexes. 

animate(plot, [fourier(f(x,t),x,w)/t,w=0..100], t=0.1..1, frames=100):

 

works fine, but use a scaling function for time(to get it to play nice) such as

 

animate(plot, [fourier(f(x,2^t),x,w)/2^t,w=0..100], t=0.1..1, frames=100):

 

and maple refuses to work well. It takes about 100 times longer if it plots at all. 2^t is just a scaling factor on f, it doesn't add any real algebraic complexity.

 

 

 

 

I'm doing a simple system of equations problem and for some reason fsolve doesn't give any answer. I know the system has a unique solution, it's actually pretty trivial to solve. This is what I have written:

 

sys = {1800*40+15*(300*30)-30*Biy = 0, -1800+Biy+Ciy-300*30 = 0};
      sys = {207000 - 30 Biy = 0, -10800 + Biy + Ciy = 0}
                       fsolve(sys, {Biy})

If I rewrite to manually solve one by one, like this:

fsolve(1800*40+15*(300*30)-30*Biy = 0);
                             6900.
fsolve((-1800)+6900+Ciy-300*30 = 0);
                             3900.


So obviously it can be solved. I want to know why it doesn't solve when put in the first way. By the way I know this is a really simple system, and obviously there is a way to work around this problem and get an answer. I'm asking because I want to understand better how solve works, and so I can avoid more difficult issues later.

I'm trying to plot the fourier transform of a function(a sigmoid) and maple refuses to plot it. It seems to try to compute it symbolically then craps out because it can't reduce it to a computable form. Of course trying to do some type of numerical evaluation is impossible because it substitutes the numerical value for the transform variable.

S := x->erf(x):

plot(abs(fourier(S(x),x,w)),w=0..100):

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

Just want to plot the transform, I do not understand why it is do difficult for maple to do numerically. It should fall back on a numerical routine instead of crapping out.

 

 

 

How does one sync two or more different animations? Ideally it would be something like display(..., synchronize=true)

Hi, I am trying to solve a recurrence with rsolve:

rsolve({f(1) = 1, f(n) = n + sum(f(i), i=1..n-1)}, f)

Unfontunately, maple just prints the same function without evaluation:

rsolve({f(1) = 1, f(n) = n + sum(f(i), i=1..n-1)}, f)

How to get the expected result 2^n - 1 from maple?

when evalhf is used it shows error. please help

 

evalhf.mw

Hello everyone, Greetings!

I am facing a really strange problem. I need to write an expression, however, maple out of nowhere assigns values to the variable used. only to those which are written inside sin (). In previous versions the out put is fine. Is there a new way to write expressions in maple 2019? I am not sure.


 

restart

96*sin(2*beta*y)*cos(2*beta*y)*beta^4 + 96*sin(2*beta*y)*beta^4

(0.525982730176588e-113+0.525982730176588e-113*I)*beta^4

(1)

``


 

Download strngmpl.mw

 

First 687 688 689 690 691 692 693 Last Page 689 of 2425