Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Hello, 

I want to insert a histogram for weighted data in my  question Maple TA. I have difficulties in my code. 

Some ideas?

Thks

I searched the questions for an answer before posting and found that I had asked the question 10 years ago! I still do not understand although it appears every other Maple user does. Embarrassing!
 

I have done some time consuming computations in my worksheet and would like to save the results for further investigation. Let's say, for example, that I have a long list L of numbers, strings etc, and a very large Matrix A . I am working on a Mac running 10.12.6.
From reading the documentation many times I gather that I can create a file with the values of L and A. I might then be able to open another worksheet and read the values of L and A into that worksheet but I cannot figure out how to do that.

Here are some of the (unhelpful) error messages I get using toy examples:

after creating a text file by hand

> read "testZ";
Error, unable to read `testZ` 

or

read testn. txt;
Error, read must have a file name

ro

read "Users/awass/Desktop/testn";
Error, unable to read `Users/awass/Desktop/testn`
 

So, how do I write my info to a file? Must I somehow create the file before I save?
Where should that file be placed? Desktop? Folder?
How do I read from the file after I have saved.
Can I save both L and A to the same file? Do I need 2 commands?

I would appreciate some explicit toy examples. Many thanks.
 

 

 

 



 

This presentation is about magnetic traps for neutral particles, first achieved for cold neutrons and nowadays widely used in cold-atom physics. The level is that of undergraduate electrodynamics and tensor calculus courses. Tackling this topic within a computer algebra worksheet as shown below illustrates well the kind of advanced computations that can be done today with the Physics package. A new feature minimizetensorcomponents and related functionality is used along the presentation, that requires the updated Physics library distributed at the Maplesoft R&D Physics webpage.
 

 

Magnetic traps in cold-atom physics

 

Pascal Szriftgiser1 and Edgardo S. Cheb-Terrab2 

(1) Laboratoire PhLAM, UMR CNRS 8523, Université Lille 1, F-59655, France

(2) Maplesoft

 

We consider a device constructed with a set of electrical wires fed with constant electrical currents. Those wires can have an arbitrary complex shape. The device is operated in a regime such that, in some region of interest, the moving particles experience a magnetic field that varies slowly compared to the Larmor spin precession frequency. In this region, the effective potential is proportional to the modulus of the field: LinearAlgebra[Norm](`#mover(mi("B"),mo("→"))`(x, y, z)), this potential has a minimum and, close to this minimum, the device behaves as a magnetic trap.

 

 

 

Figure 1: Schematic representation of a Ioffe-Pritchard magnetic trap. It is made of four infinite rods and two coils.

_________________________________________

 

Following [1], we show that:

 

  

a) For a time-independent magnetic field  `#mover(mi("B"),mo("→"))`(x, y, z) in vacuum, up to order two in the relative coordinates X__i = [x, y, z] around some point of interest, the coefficients of orders 1 and 2 in this expansion, `v__i,j` and `c__i,j,k` , respectively the gradient and curvature, contain only 5 and 7 independent components.

  

b) All stationary points of LinearAlgebra[Norm](`#mover(mi("B"),mo("→"))`(x, y, z))^2 (nonzero minima and saddle points) are confined to a curved surface defined by det(`∂`[j](B[i])) = 0.

  

c) The effective potential, proportional to LinearAlgebra[Norm](`#mover(mi("B"),mo("→"))`(x, y, z)), has no maximum, only a minimum.

 

Finally, we draw the stationary condition surface for the case of the widely used Ioffe-Pritchard magnetic trap.

  

 

  

Reference

  

[1] R. Gerritsma and R. J. C. Spreeuw, Topological constraints on magnetostatic traps,  Phys. Rev. A 74, 043405 (2006)

  

 

The independent components of `v__i,j` and `c__i,j,k` entering B[i] = u[i]+v[i, j]*X[j]+(1/2)*c[i, j, k]*X[j]*X[k]

   

The stationary points are within the surface det(`∂`[j](B[i])) = 0

   

U = LinearAlgebra[Norm](`#mover(mi("B",fontweight = "bold"),mo("→",fontweight = "bold"))`)^2 has only minima, no maxima

   

Drawing the Ioffe-Pritchard Magnetic Trap

   


 

MagneticTraps.mw or in pdf format with the sections open: MagneticTraps.pdf

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

How do i plot

in one plot with this paraellogram (it has to come out of the center of it)

How to get a function value for this HPM code. in the equations p-value 0 to N also some problem.

 

Still in Maple 2017 the palette is almost not readable without the help of a magnifier under a UHD screen (3840x2160) resolution. I have set all things which could be set for scaling and sizing, no effect on the palette. With the trend to higher resoluiton screen this should be fixed in the near future - or is there any work around?

https://gist.github.com/hoyeunglee/b0c6b61fafd1bee988fcafef3cfe6025
https://gist.github.com/hoyeunglee/a1e0ca335be8bbc8fde301c6aded66f8

test1 = o(a(x,y),z)

test1.args[0]

python sympy can not get function name o and a

Hi. I am using JetCalclulus to prolong infinitesimal generators.

Then I want to find invariants, it means I want to act on some function by these differential operators and to solve linear PDEs.

Is it possible to do it automatically?

restart;
with(Groebner):

DoExist := proc(tau, n)
if rtable_num_elems(tau) >= n then
	return tau[n];
else
	return 0;
end if;
end proc;

IsZero := proc(a, b)
if a=0 then 
	return 0;
else 
	return a/b;
end if
end proc;

g1 := x^2-w*y;
g2 := x*y - w*z;
g3 := y^2 - x*z;
gro := Basis([g1,g2,g3],plex(x,y,z,w));

X1 := `*`(LeadingTerm(g1, tdeg(x, y, z, w)));
X2 := `*`(LeadingTerm(g2, tdeg(x, y, z, w)));
X3 := `*`(LeadingTerm(g3, tdeg(x, y, z, w)));
X12 := lcm(X1,X2);
X13 := lcm(X1,X3);
X23 := lcm(X2,X3);
S12 := SPolynomial(g1, g2, lexdeg([x, y, z, w]));
S23 := SPolynomial(g2, g3, lexdeg([x, y, z, w]));
S13 := SPolynomial(g1, g3, lexdeg([x, y, z, w]));
e1 := Vector([1,0,0]);
e2 := Vector([0,1,0]);
e3 := Vector([0,0,1]);
eq1:= S12 = h121*g1 + h122*g2 + h123*g3;
eq1 := S12 - expand(h121*g1 + h122*g2 + h123*g3):
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h121, h122, h123)), tdeg(x, y, z, w, h121, h122, h123), 'Q');
h121 := 0;
h122 := 0;
h123 := 0;
s12 := IsZero(X12,X1)*e1-IsZero(X12,X2)*e2-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

eq1 := S13-expand(h131*g1+h132*g2+h133*g3):
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h131, h132, h133)), tdeg(x, y, z, w, h131, h132, h133), 'Q');
h131 := 0;
h132 := 0;
h133 := 0;
s13 := IsZero(X13,X1)*e1-IsZero(X13,X3)*e3-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

eq1:= S23 - expand(h231*g1 + h232*g2 + h233*g3);
NormalForm(eq1, Basis([g1, g2, g3], tdeg(x, y, z, w, h231, h232, h233)), tdeg(x, y, z, w, h231, h232, h233), 'Q');
h231 := 0;
h232 := 0;
h233 := 0;
s23 := IsZero(X23,X2)*e2-IsZero(X23,X3)*e3-Vector([DoExist(<Q>,3), DoExist(<Q>,2), DoExist(<Q>,1)]);

with(LinearAlgebra):
#F = Syz*GrobnerBasis
F := simplify(MatrixMatrixMultiply(Matrix([[s12[1],s13[1],s23[1]],[s12[2],s13[2],s23[2]],[s12[3],s13[3],s23[3]]]), Matrix([[gro[1]],[gro[2]],[gro[3]]])));
F[1][1] - g1 = 0; 
F[2][1] - g2 = 0;
F[3][1] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[s12[1],0,s23[1]],[s12[2],0,s23[2]],[s12[3],0,s23[3]]]), Matrix([[gro[1]],[gro[2]],[gro[3]]])));
F[1][1] - g1 = 0; 
F[2][1] - g2 = 0;
F[3][1] - g3 = 0;

#F = GrobnerBasis*Syz
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],s13[1],s23[1]],[s12[2],s13[2],s23[2]],[s12[3],s13[3],s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],0,s23[1]],[s12[2],0,s23[2]],[s12[3],0,s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;

#F = GrobnerBasis*Syz
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],s12[1],s12[1]],[s13[2],s13[2],s13[2]],[s23[3],s23[3],s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;
F := simplify(MatrixMatrixMultiply(Matrix([[gro[1],gro[2],gro[3]]]), Matrix([[s12[1],0,s12[1]],[s13[2],0,s13[2]],[s23[3],0,s23[3]]])));
F[1][1] - g1 = 0; 
F[1][2] - g2 = 0;
F[1][3] - g3 = 0;

syz result is s12, s23

but after verify, F is not equal to GrobnerBasis*Syz

 

restart

with(PDEtools)

declare(u(x, t))

` u`(x, t)*`will now be displayed as`*u

(1)

U := diff_table(u(x, t))

char := eta(x, t, U[])-U[x]-2*U[t]

eta(x, t, u(x, t))-(diff(u(x, t), x))-2*(diff(u(x, t), t))

(2)

       

pde := U[x]+U[x, x]

diff(u(x, t), x)+diff(diff(u(x, t), x), x)

(3)

tp1 := subs(U[] = char, pde)

diff(eta(x, t, u(x, t))-(diff(u(x, t), x))-2*(diff(u(x, t), t)), x)+diff(diff(eta(x, t, u(x, t))-(diff(u(x, t), x))-2*(diff(u(x, t), t)), x), x)

(4)

 

Just as the result above, I can't interpret why the last term of the formula (4) is (2)_xx.

 

Is ther a bug, or just because I made a mistake somewhere???

``

Thanks!

``

``

``

``

``

``


 

Download err_subs.mw

equations:
x[j-1]-2x[j]+x[j+1]=0, j=3...98 where x[j] is x-sub -j
-2x[1]+x[2]=5
x[1]-2x[2]+x[3]=-4
x[98]-2x[99]+x[100]=-8
x[99]-2x[100]=13
 
I'm trying to solve them using Isaac Newton's method for numerical approximation with epsilon equal to 1e-6 such in C++ code below
 
double epsilon=1e-6;
double x=1.0;
double f=x[j-1]-2x[j]+x[j+1] j=3...98; x3-x97+x98=3;
double Df=1-2+1;
while (fabs(f)>epsilon){
cout<<x<<endl;
x-=f/Df
f=x[j-1]-2x[j]+x[j+1] j=3...98; x3-x97+x98=3;
Df=1-2+1;}
cout<<x<<endl;

Much of this topic is developed using traditional techniques. Maple modernizes and optimizes solutions by displaying the necessary operators and simple commands to solve large problems. Using the conditions of equilibrium for both moment and force we find the forces and moments of reactions for any type of structure. In spanish.

Equlibrium.mw

https://www.youtube.com/watch?v=7zC8pGC4F2c

Lenin Araujo Castillo

Ambassador of Maple

Hello. I have a question on plotting discrete time plot. When I try to plot the equation below I get an error. Can't figure out where is the problem. If for example I choose for vector A () there is no error. I would appreciate your help.

 


Error, invalid input: DynamicSystems:-DiscretePlot expects its 2nd argument, v2, to be of type {realcons, list(extended_numeric), ('Vector')(extended_numeric)}, but received Vector(4, {(1) = 1+sin(1), (2) = 1+sin(2), (3) = 1+sin(3), (4) = 1+sin(4)})

Regards,

Tadej

test_sections.mw

Hi, I'm getting some unusual behaviour between the Explore() command / graphs and collapsed sections, as exemplified in the attached (linked) worksheet.  I'm trying to develop some worksheets with several sections where some of the sections have an explore() graph in them.  To keep things simple, I'd like some sections to be collapsed with the graphs hidden (and remain collapsed: View - Section - Autoexpanding - Uncheck) when the worksheet is evaluated.  In the attached, the section remains collapsed, so does the normal graph, but the explore "graph" gets published outside the collapsed section and when there is other information on the worksheet, the explore window appears almost randomly.

So is there any way to ensure the explore graph remains inside the collapsed section?

Sorry for the slightly longwinded explanation :-)

Thanks,

Maple:

how exp into ?

exp2: 

into

Help

First 904 905 906 907 908 909 910 Last Page 906 of 2224