MaplePrimes Questions

Hello

I have a couple of large lists that will be further processed.  One of the steps is to index a list using another list (a list of indices).  A short example will be something like

L:=[2,1,4,3,7,6,8,3,4,5];
ind:=[2,2,3,3,5,6,7,1,4,10];

The solution 

L1:=L[ind]:

does not seem to be a good choice since it takes longer than the following solution

 

L1:=Threads:-Map(w->L[w],ind):

 

Since I am not a Maple expert, it is very likely that is a faster solution.   

 

Many thanks

 

Occasionally commands in the form of (exprseq1)(exprseq1) are proposed.

(as the solution in https://www.mapleprimes.com/questions/232263-Subscripts-In-Maple)

Questions:

  • Is this syntax and its use documented somewhere?
  • Can the first parenthesis (exprseq1) be considered as an operator?
  • In which situations such commands are preferable?

I had look at Maples help system but could not find any further explanations. What I found so far:
syntax talks about parenthesized expression and refers to
operators,precedence which does not define the precedence of parenthesis
examples,functional two examples show the use of functional operators within rounded brackets
help("Definition,bracket") explains the different types of brackets [moderator note: in common mathematical parlance, not in the technical sense in Maple].

ProgrammingGuide,Chapter02 only refers to a pair of rounded brackets but not 2 pairs
The left and right parentheses group terms in an expression, arguments in a function call, and parameters in a procedure definition.

...

The left and right parentheses are also used to select components from certain data structures (programmer indexing).

Hi, I have created a procedure and it keeps giving the error "Error, reserved word `then` unexpected". What am I doing wrong?


Clasterms:=proc(P)
local L,a,b;
L:=(`[]`@ op)~(indets(P, indexed));
a:=Search(1,L[1]); b:=Search(2,L[1]);
 if a<>0 and b<>0 then print("mixed");
 elif a<>0 and b=0 then print("t-only");
 elif a=0 and b<> then print("x-only") ; end if;
 end proc:

Product: Maple 2021

hey guys, I'm curious if there is any way to do a group assignment like the following

JointNum := 3;
                    
seq(alpha[i], i = 1 .. JointNum) := 0, 0, 0;

which should as result be the following assignment

alpha[1], alpha[2], alpha[3]:=0,0,0

which is a valid assignment standalone but not works in the sequence style form . how can I implement this type of assignment

When trying to understand what a proof is trying to show, I like to construct some examples to see what the proof is trying to show. For example, constructing some sequence to show whether it converges, visualizing some functions to understand the squeeze theorem in calculus, etc. I found Maple has worked well for this kind of work.

Now I am taking course in Measure Theory and everything is so abstract and I am not sure if Maple is capable of building the objects discussed. For example, this is from the book Probability Essentials:

How can I use Maple to support understanding the proofs? It would be nice if I can build the objects discussed and write functions to verify their properties and just play around with them in general to get an intuition of how the proof works.

 

 

 

 

Hi, when I tried the simple example of Java OpenMaple on Mac, I can compile the code but couldn't run it. It complained about not finding libjopenmaple.jnilib. I checked that library directory, there was /libjopenmaple.jnilib but not libmaplec.dylib. Any suggestions?

> java -Djava.library.path=/Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX -classpath "$MAPLE/java/externalcall.jar:$MAPLE/java/Maple.jar:." test

Error loading libraries: java.lang.UnsatisfiedLinkError: /Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib: dlopen(/Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib, 1): Library not loaded: @rpath/libmaplec.dylib
  Referenced from: /Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib
  Reason: image not found
java.lang.UnsatisfiedLinkError: /Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib: dlopen(/Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib, 1): Library not loaded: @rpath/libmaplec.dylib
  Referenced from: /Library/Frameworks/Maple.framework/Versions/2021/bin.APPLE_UNIVERSAL_OSX/libjopenmaple.jnilib
  Reason: image not found
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
    at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:316)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:282)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2440)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:809)
    at java.base/java.lang.System.loadLibrary(System.java:1893)
    at com.maplesoft.openmaple.Engine.<clinit>(Engine.java:23)
    at test.main(test.java:22)
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'long com.maplesoft.openmaple.Engine.getKernel(java.lang.String[], com.maplesoft.openmaple.EngineCallBacks, java.lang.Object, java.lang.Object)'
    at com.maplesoft.openmaple.Engine.getKernel(Native Method)
    at com.maplesoft.openmaple.Engine.<init>(Engine.java:44)
    at test.main(test.java:22)

 

 

Dear Community,

I try to slove a simple 2nd order ODE describing a simple pulley. Unfortunately dsolve does not like what I'm trying to do, and I get en error message. My goal is to plot travel distance, velocity and acceleration (  h(t), dh(t)/dt, d2h(t)/dt2 ) of the lifted weight. Could you pls. have a look what I'm doing wrong?

Also is there a way to transform this worksheet to a MapleSim document somehow? Worksheet attached.

tx in advance,

best regards

Andras

SimplePulley.mw

 

Since I installed Maple 2021 I have noticed a problem with the left corner of the menu and toolbar.  See the screenshot attached. I don't know if this is a general problem in Win10 or is this a problem with my installation.

Edit

I found the problem. Let me rephrase it. I keep original question below. 

This causes an error

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):
A:=module()
   export module_A1;
   local person_type;

   module person_type()
       option object;
       export name::string; 
       export age::string; 
    end module;

   module_A1:=module()
        export boo;
        boo:=proc()
          local X::A:-person_type;  #THIS LINE CAUSES ERROR
          #local X::person_type;    #THIS LINE ALSO CAUSES ERROR
          #local X;                 #THIS WORKS. No error
          X:=Object(person_type);
          return X;
       end proc;
    end module:
end module:

A:-module_A1:-boo();
           Error, (in boo) module does not export `person_type`

If I change  local X::person_type;  to just local X;  then no error is generated:

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

A:=module()
   export module_A1;
   local person_type;

   module person_type()
       option object;
       export name::string; 
       export age::string; 
    end module;

   module_A1:=module()
        export boo;
        boo:=proc()
          local X;  
          X:=Object(person_type);  #now this works
          return X;
       end proc;
    end module:

end module:

A:-module_A1:-boo();

              `Object<<person_type,1822742359104>>`

So the problem was in the variable declaration. Maple for some reason does not like   local X::A:-person_type;  and does not like local X::person_type; but things seem to work by just removing the ::type altogother. 

So this solves this problem for me for now, I can keep person module local, and still use it in other child modules. Even though I do not understand why Maple complains about it when I use ::

original question. Can be ignored now.

I have one main module, with 2 submodules (child modules) A1 and A2. The child modules are all exported so they can be called from outside the main module.

But I want to have one additional module X as object, to share among the child modules A1 and A2, but without having to also export module X.

But Maple wants me to also export module X in order to use it inside the child modules A1, and A2.

Is there a way to share X  among child modules, without exporting it? I only want X be visible to child modules (i.e. modules inside the main module)

The module X has option object and I want to use it as just a type basically (instead of using Record).

Here is an example

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):
A:=module()
   export module_A1,module_A2;
   local person_type;

   module person_type()
       option object;
       export name::string; 
       export age::string; 
    end module;

   module_A1:=module()
        export boo;
        boo:=proc()
          local X::A:-person_type;
          X:=Object(A:-person_type);
          return 1;
       end proc;
    end module:

   module_A2:=module()
        export boo;
        boo:=proc()
          local X::A:-person_type;
          X:=Object(A:-person_type);
          return 1;
       end proc;
    end module:

end module:

Now the call A:-module_A1:-boo(); fail with Error, (in boo) module does not export `person_type`

This can be fixed by changing local person_type;  to export person_type;  but this means person_type can now be seen from outside the main package.

In Ada, it is possible to have private data type shared among child packages. How to do the same in Maple?

 

 

Hi, I am looking for a way to extract a specific operand from a given expression. Something similar to the coeff command, but rather than just the coefficient, I want the whole term. For example,
Given an expression A:=u[1,2]+u[2]*u[1,1,1], if I want to extract the term u[2]*u[1,1,1]. then a command, let's say LT which takes the expression and a component, which then will return the term containing that component.
input: LT(A, u[1,1,1])
output: u[2]*u[1,1,1]


Thank you for your help.

Dear Maple community, 
I've been trying to calculate all eigenvalues of a (large) symbolic matrix M (see EigenvaluesQ.mw) using:

with(LinearAlgebra):
LinearAlgebra:-Eigenvalues(M):

or simply 

Eigenvalues(M)

but, unfortunately, my computer (64Gb RAM, Maple 2020) doesn't deliver a solution after 1 hour of computation. Am I doing something wrong? Thank you very much in advance!

In Maple V the display of a lengthy expression often contained "auxiliary variables" named %1, %2, ... to make it more readable ( (a personal point of view, see for instance Introduction to Maple, A. Heck, p 97).
When did this feature disappear? Has it been replaced by something else?

TIA

 

how this integration can be computed and plotted? tnx in advance

 

restart:Digits:=20:

T := 10^(-6);
delta := 10;
m := 1;
alpha:= 75/10;
v := 65;
mu := 8;

1/1000000

 

10

 

1

 

15/2

 

65

 

8

(1)

z := sqrt((omega^2 - 4*m^2)/alpha^2 - v^2/alpha^2*(4 *delta/alpha*tan(theta)^2 - v^4/alpha^4*tan(theta)^4))

(2/135)*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2)

(2)

a := sec(theta)/sqrt(2)*sqrt((2 *delta)/alpha - v^2/alpha^2*tan(theta)^2 + z)

(1/90)*sec(theta)*2^(1/2)*(5400-152100*tan(theta)^2+30*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2))^(1/2)

(3)

f1 := 1/(exp(( omega/2 - mu)/T) + 1);
f2 := 1/(exp((- (omega/2) - mu)/T) + 1);

1/(exp(500000*omega-8000000)+1)

 

1/(exp(-500000*omega-8000000)+1)

(4)

A1 := evalf(-(f1 - f2)*abs(omega/(4*a*alpha*cos(theta)^2*(-delta+ a^2 *alpha* cos(theta)^2) + 2*a*v^2*sin(theta)^2 + 1/10000)))

-1.*(1/(exp(500000.*omega-8000000.)+1.)-1./(exp(-500000.*omega-8000000.)+1.))*abs(omega/(.47140452079103168293*sec(theta)*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*cos(theta)^2*(-10.+0.18518518518518518519e-2*sec(theta)^2*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))*cos(theta)^2)+132.77894002280725736*sec(theta)*(5400.-152100.*tan(theta)^2+30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*sin(theta)^2+0.10000000000000000000e-3))

(5)

b := sec(theta)/sqrt(2)*sqrt((2*delta)/alpha - v^2/alpha^2*tan(theta)^2 - z)

(1/90)*sec(theta)*2^(1/2)*(5400-152100*tan(theta)^2-30*(81*omega^2-324-1825200*tan(theta)^2+1930723600*tan(theta)^4)^(1/2))^(1/2)

(6)

f3 := 1/(exp(( omega/2 - mu)/T) + 1);
f4 := 1/(exp((- (omega/2) - mu)/T) + 1);

1/(exp(500000*omega-8000000)+1)

 

1/(exp(-500000*omega-8000000)+1)

(7)

A2 := evalf(-(f3 - f2)*abs(omega/(4*b*alpha*cos(theta)^2*(-delta+ b^2 *alpha* cos(theta)^2) + 2*b*v^2*sin(theta)^2 + 1/10000)))

-1.*(1/(exp(500000.*omega-8000000.)+1.)-1./(exp(-500000.*omega-8000000.)+1.))*abs(omega/(.47140452079103168293*sec(theta)*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*cos(theta)^2*(-10.+0.18518518518518518519e-2*sec(theta)^2*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))*cos(theta)^2)+132.77894002280725736*sec(theta)*(5400.-152100.*tan(theta)^2-30.*(81.*omega^2-324.-1825200.*tan(theta)^2+1930723600.*tan(theta)^4)^(1/2))^(1/2)*sin(theta)^2+0.10000000000000000000e-3))

(8)

plot(int(A1+A2,theta=0..2*Pi),omega=0..50);

Warning,  computation interrupted

 

 


 

Download code.mw

I have the following equations and plot in Maple, but I would like for Maple to only consider positive values of k, but I cannot find a way to do this as k is dependent on x. Is there any way to do this either in the code for k, or in the code for the plot?

 

 

 

 

For an expression like u[1,1,2]+u[1,1]*u[2,3], I want to extract the subscripts in an another set/list [{1,1}, {2,3}, {1,1,2}]. Any help is much appreciated. Thanks

First 405 406 407 408 409 410 411 Last Page 407 of 2427