MaplePrimes Questions

1.1 * 10^2

but export text become two lines

               2

1.1 *   10

pretty printing = 3 

but still two lines

 

how to export in one line such as 10^2 ?

               

I want to insert each row at a time into a excel sheet from a maple code .  But i dont want a new excel file created for each insert.

First my list L has say [(a,1),(a,2),(a,3),.....,(a,100)] 100 elements this is first i insert it into my excel first row
next  [(b,1),(b,2),(a,3),.....,(b,100)] 100 elements i should insert into excel second row and so on

but dont want to store them here on a rtable, vector,array "all together" then export

I justt store 1 row at a time insert it and do on the same excel file file dynamically. without creating multiple copies of the same file

can anyone help with a code using exceltools package or any

 

Suppose i have a set say

 

A={{"1"."8"},{"1","4"},{"1","10"}}

if i want to convert A to set such that {"{"1"."8"}","{"1","4"}","{"1","10"}"}  where each element is a string with minium time I have given a small set here i may have set with 48 to 100 such element that is s set of sets i want to convert the inside sets to strings without much of looping in minimum time can any one help


 

``assume(0 < k, k < 1)

int(x^2/sqrt((-x^2+1)(-k^2*x^2+1)), x = 0 .. k)

int(x^2/(-x(-k^2*x^2+1)^2+1)^(1/2), x = 0 .. k)

(1)

sqrt(k^2)

k

(2)

``


 

Download ellipticIntegralTest.mw

Hi everyone, 

I am trying to use elliptic integral from Maple, however, it did not generate any result. Can you help me with that?

let me just explains the big picture first, then give small example.

When using standard modules, I had one module, and number of smaller modules, all private to the main module. This worked well.

Each sub module, can only be accessed from the top module, which is seen by user. The sub modules can't be called by user directly.

Now I changed the main module to become an object (since I want to make more instances of it).

I want to still use the code in those submodules I had, but want to keep them private to the object class, so they can be seen only from inside the object class methods. So they are part of the object class now. But remain as modules. I do not want to copy all those methods in these submodules and put them in the object class directly.

But I can't get the syntax right to do this. I do not want to modify the code inside the sub-modules, but only how to integrate them into the object.

Notice that I can call those external modules fine from the object, but I simply want to make them private to the object class, so they can't be called from outside. 

The question is how to do this? 

Here is a very small example. (in practice, I have these submodules in .mpl files, but here I put them all in the example).

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);#this call does not work
      end proc;

      #this is module, that I want to be private to this class only
      #eventually, I'd like this module be in separate mpl file also.
      local big_car::static :=module()  #module does not take arguments!

            #this below should be private only to the this module
            #and not seen by the enclosing object.
            local big_car_name::string:="UNKNOWN";  

            #this export to allow parent object to call it
            export set_name::static:=proc(o::car_class,_name::string)
                   o:-big_car:-big_car_name:=_name;
            end proc;

      end module;

end module:

o:=Object(car_class);
o:-set_name(o,"GM");

Error, (in set_name) module `car_class` does not export `big_car`

I found after playing more with it, that this works

I just replaced o:-big_car:-big_car_name:=_name;  with big_car:-big_car_name:=_name; had to remove ::static from definition of proc inside the private module.

restart;	
module car_class()
      option object;
      local name::string :="UNKNOWN";

      export set_name::static:=proc(o::car_class,_name::string)
        o:-name := _name;
        o:-big_car:-set_name(o,_name);
      end proc;

      local big_car::static  :=module() 
          local big_car_name::string:="UNKNOWN";  

          export set_name:=proc(o::car_class,_name::string)
              big_car_name:=_name;
          end proc;

     end module;
end module:

Now it works. However, maple help says "In Maple, method names should be declared as static. "

I would like to factor

factor(98-28*sqrt(7));

which I would like to output 14*(7 - 2*sqrt(7)),

but Maple keeps returning 98 - 28*sqrt(7).

code_(1).mw
 

 

 

Hello! hope you all be fine. i m running a code for `Anew Technique of intial Boundary Value Problem Using ADM `(Elaf*Jaafar*Ali) but my code is for positive integer and i want to run it for fractional can anyone help me please code file is attached 

 

If one refers to a name in Maple, I thought it will look at the global context to find it. So when one does latex(....) then this is assumed to be the system latex command. No need to do :-latex()

But if there is local variable in Object class called latex, why then is object:-latex gets confused with global Maple command latex()?  Here is an example

module ode_class()
      option object;
      local latex::strring :="";

      export init::static:=proc(o::ode_class)
        o:-latex:= latex(1/2,output=string);
      end proc;
end module:

my_ode:=Object(ode_class): 

Error, static procedure `ode_class:-init` refers to non-static local or export `ode_class:-latex::strring` in surrounding scope
 

ofcourse easy to fix, I just replace the RHS latex(1/2,output=string);  with :-latex(1/2,output=string); 

But my question why is object:-latex := latex(...)  makes Maple think the latex in the RHS is the variable name in the class, when it does not have the  object:- prefix?  Is this expected  behaviour in Maple? 

But now I am starting to worry that each maple command/function/name used inside the Object needs  :- added to it, just in case of a current or future name conflict with local object variables names.

 

 

For example the below is a c code how to write this in maple

 

void swap(int *a, int *b)

 {

     int temp;

emp = *a;

*a = *b;    

 *b = temp;  

}    //permutation function

 void permutation(int *arr, int start, int end)

 {      

if(start==end)

     {        

 printarray(arr, end+1);

         return;    

 }      

int i;    

 for(i=start;i<=end;i++)  

   {          //swapping numbers      

   swap((arr+i), (arr+start));      

   //fixing one first digit          //and calling permutation on          //the rest of the digits          permutation(arr, start+1, end);          swap((arr+i), (arr+start));  

   }  

}

Could anyone help me with how to open an .m file in Maple in Windows? Thanks a lot.

Please, anyone with the idea on how to plot D1 against alpha[n]. The link is attached below

Help!!!.mw

 

The pdf shows the derivation procedure of Image from 1.2.1 to 1.2.5. However, when we obtain the (7) in pdf, which is the 

 

expansion of 1.2.4, we hope to see the hamiltonian operator in the output.  We obtain the (10) in pdf (Maple). Actually, it is the expansion of 1.2.5. However, it is too cockamamie compared with that (1.2.5) in the textbook.

 

Hence, I hope to show the hamiltonian operator in the (10) in PDF. I hope to see the simplest type of equation.

How could I do? Appreciate the kind help from anyone!

The Maple code is also uploaded.
 

 

 

 

restart*with(Physics[Vectors])

Step(mathematicalnotation = true)*SetCoordinates('cartesian'[i, j, k])

Step(mathematicalnotation = true)*SetCoordinates(cartesian[i, j, k])

(1)

``

NULL``

"  UU(x,y,z):=ux(x,y,z)*(_i)+uy(x,y,z)*_j+uz(x,y,z)*_k; "

proc (x, y, z) options operator, arrow, function_assign; Physics:-Vectors:-`+`(Physics:-Vectors:-`+`(ux(x, y, z)*_i, uy(x, y, z)*_j), uz(x, y, z)*_k) end proc

(2)

"&nabla;(pressure(x,y,z));  Laplacian(UU(x,y,z));  BB(x,y,z):=0*_i+0*_j+10*_k"

proc (x, y, z) options operator, arrow, function_assign; Physics:-Vectors:-`+`(Physics:-Vectors:-`+`(0*_i, 0*_j), 10*_k) end proc

(3)

-VectorCalculus[Nabla](pressure(x, y, z))+Laplacian(mu*UU(x, y, z))+BB(x, y, z) = 0*_i+0*_j+0*_k

_i*(-(diff(pressure(x, y, z), x))+mu*(diff(diff(ux(x, y, z), x), x))+mu*(diff(diff(ux(x, y, z), y), y))+mu*(diff(diff(ux(x, y, z), z), z)))+_j*(-(diff(pressure(x, y, z), y))+mu*(diff(diff(uy(x, y, z), x), x))+mu*(diff(diff(uy(x, y, z), y), y))+mu*(diff(diff(uy(x, y, z), z), z)))+_k*(-(diff(pressure(x, y, z), z))+mu*(diff(diff(uz(x, y, z), x), x))+mu*(diff(diff(uz(x, y, z), y), y))+mu*(diff(diff(uz(x, y, z), z), z))+10) = 0

(4)

``

Divergence(-VectorCalculus[Nabla](pressure(x, y, z))+Laplacian(mu*UU(x, y, z))+BB(x, y, z) = 0*_i+0*_j+0*_k)

-(diff(diff(pressure(x, y, z), x), x))+mu*(diff(diff(diff(ux(x, y, z), x), x), x))+mu*(diff(diff(diff(ux(x, y, z), x), y), y))+mu*(diff(diff(diff(ux(x, y, z), x), z), z))-(diff(diff(pressure(x, y, z), y), y))+mu*(diff(diff(diff(uy(x, y, z), x), x), y))+mu*(diff(diff(diff(uy(x, y, z), y), y), y))+mu*(diff(diff(diff(uy(x, y, z), y), z), z))-(diff(diff(pressure(x, y, z), z), z))+mu*(diff(diff(diff(uz(x, y, z), x), x), z))+mu*(diff(diff(diff(uz(x, y, z), y), y), z))+mu*(diff(diff(diff(uz(x, y, z), z), z), z)) = 0

(5)

 

algsubs(Divergence(UU(x, y, z)) = 0, %)

-(diff(diff(pressure(x, y, z), x), x))+mu*(-(diff(diff(diff(uy(x, y, z), x), x), y))-(diff(diff(diff(uz(x, y, z), x), x), z)))+mu*(-(diff(diff(diff(uy(x, y, z), y), y), y))-(diff(diff(diff(uz(x, y, z), y), y), z)))+mu*(-(diff(diff(diff(uy(x, y, z), y), z), z))-(diff(diff(diff(uz(x, y, z), z), z), z)))-(diff(diff(pressure(x, y, z), y), y))+mu*(diff(diff(diff(uy(x, y, z), x), x), y))+mu*(diff(diff(diff(uy(x, y, z), y), y), y))+mu*(diff(diff(diff(uy(x, y, z), y), z), z))-(diff(diff(pressure(x, y, z), z), z))+mu*(diff(diff(diff(uz(x, y, z), x), x), z))+mu*(diff(diff(diff(uz(x, y, z), y), y), z))+mu*(diff(diff(diff(uz(x, y, z), z), z), z)) = 0

(6)

simplify(%)

-(diff(diff(pressure(x, y, z), x), x))-(diff(diff(pressure(x, y, z), y), y))-(diff(diff(pressure(x, y, z), z), z)) = 0

(7)

Laplacian(-VectorCalculus[Nabla](pressure(x, y, z))+Laplacian(mu*UU(x, y, z))+BB(x, y, z) = 0*_i+0*_j+0*_k)

(mu*(diff(diff(diff(diff(ux(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(ux(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(ux(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(ux(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(ux(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(ux(x, y, z), z), z), z), z))-(diff(diff(diff(pressure(x, y, z), x), x), x))-(diff(diff(diff(pressure(x, y, z), x), y), y))-(diff(diff(diff(pressure(x, y, z), x), z), z)))*_i+(mu*(diff(diff(diff(diff(uy(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(uy(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(uy(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(uy(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(uy(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(uy(x, y, z), z), z), z), z))-(diff(diff(diff(pressure(x, y, z), x), x), y))-(diff(diff(diff(pressure(x, y, z), y), y), y))-(diff(diff(diff(pressure(x, y, z), y), z), z)))*_j+(mu*(diff(diff(diff(diff(uz(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(uz(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(uz(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(uz(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(uz(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(uz(x, y, z), z), z), z), z))-(diff(diff(diff(pressure(x, y, z), x), x), z))-(diff(diff(diff(pressure(x, y, z), y), y), z))-(diff(diff(diff(pressure(x, y, z), z), z), z)))*_k = 0

(8)

algsubs(-(diff(pressure(x, y, z), x, x))-(diff(pressure(x, y, z), y, y))-(diff(pressure(x, y, z), z, z)) = 0, %)

(mu*(diff(diff(diff(diff(ux(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(ux(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(ux(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(ux(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(ux(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(ux(x, y, z), z), z), z), z)))*_i+(mu*(diff(diff(diff(diff(uy(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(uy(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(uy(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(uy(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(uy(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(uy(x, y, z), z), z), z), z)))*_j+(mu*(diff(diff(diff(diff(uz(x, y, z), x), x), x), x))+2*mu*(diff(diff(diff(diff(uz(x, y, z), x), x), y), y))+2*mu*(diff(diff(diff(diff(uz(x, y, z), x), x), z), z))+mu*(diff(diff(diff(diff(uz(x, y, z), y), y), y), y))+2*mu*(diff(diff(diff(diff(uz(x, y, z), y), y), z), z))+mu*(diff(diff(diff(diff(uz(x, y, z), z), z), z), z)))*_k = 0

(9)

collect(%, mu)

((diff(diff(diff(diff(ux(x, y, z), x), x), x), x)+2*(diff(diff(diff(diff(ux(x, y, z), x), x), y), y))+2*(diff(diff(diff(diff(ux(x, y, z), x), x), z), z))+diff(diff(diff(diff(ux(x, y, z), y), y), y), y)+2*(diff(diff(diff(diff(ux(x, y, z), y), y), z), z))+diff(diff(diff(diff(ux(x, y, z), z), z), z), z))*_i+(diff(diff(diff(diff(uy(x, y, z), x), x), x), x)+2*(diff(diff(diff(diff(uy(x, y, z), x), x), y), y))+2*(diff(diff(diff(diff(uy(x, y, z), x), x), z), z))+diff(diff(diff(diff(uy(x, y, z), y), y), y), y)+2*(diff(diff(diff(diff(uy(x, y, z), y), y), z), z))+diff(diff(diff(diff(uy(x, y, z), z), z), z), z))*_j+(diff(diff(diff(diff(uz(x, y, z), x), x), x), x)+2*(diff(diff(diff(diff(uz(x, y, z), x), x), y), y))+2*(diff(diff(diff(diff(uz(x, y, z), x), x), z), z))+diff(diff(diff(diff(uz(x, y, z), y), y), y), y)+2*(diff(diff(diff(diff(uz(x, y, z), y), y), z), z))+diff(diff(diff(diff(uz(x, y, z), z), z), z), z))*_k)*mu = 0

(10)

``

``

 


``

 

Download 20200619.mw

 

 

Download 20200619-1.mw

20200619.pdf

 

Kind help with a maple code without using the permute function maple such that I that can get each permutation at a time and as I do not want to store all the permutations in a list as it would require too much memory space when n is larger. So I would like to

say I have to permute [1,2,3] first I get 1,2,3 leave it , next get 2,1,3 leave it, 3,2,1 leave it and so I don't store them after using it.

the same way for combinations too without using the combinat to store entire in a list i want say choose from 1,2,3,4 say 3 elements at a time I choose 1,2,3 leave it next I choose say 1,2,4 leave it without storing after I have just used it

kind help please

in my object, I have few private variables. To make sure the object is correctly initialized between each use, I'd like to initialize these private variables each time at the start of the call each time the object is called to process something.

Some of these variables represent equations, or symbols or functions. Some of these are set by the user of the object, but some are not. And I do not want to leave those that are not set, using old values from last call.

The problem  I can't use {} nor NULL to initialized these private variables, since I am telling Maple they are of type `=` or `symbol` or `function`.

To give a small example, I use a proc here to illustrate, since it the same idea, but less code.

restart;
kernelopts('assertlevel'=2):
foo:=proc(input_ode::`=`)
   local ode::`=`:={};  #i'd like to give this some initial value. But what?
   ode:=input_ode;
end proc;

now foo(diff(y(x),x)=5) gives

Error, (in foo) assertion failed in assignment, expected `=`, got {}
Same type of error happens if I use NULL.

Is there a special value or tag one can use to initialize/reset any variable, regardless of its type? I thought at first that NULL will work, but it is not.

The idea is that I'd like all my object private variable to always have known state when the same object is called each time. ie. to clean it up before the next time is made.

The above is just an example. Ofcourse I could just do this

restart;
kernelopts('assertlevel'=2):
foo:=proc(input_ode::`=`)
   local ode::`=`; #leave it un-initialized since it will be overwritten next
   ode:=input_ode;
end proc;

And now no error. 

I read  help document of :

with(Physics[Vectors]):
(%Nabla)(f(x,y,z))
value(%)

 

But if I want to use Composition function , is it not useful? why? how to do?

(%Nabla@@4)(f(x,y,z));
value(%)

we know that:

(Nabla@@4)(f(x,y,z))

 

First 253 254 255 256 257 258 259 Last Page 255 of 2143