Maple 2015 Questions and Posts

These are Posts and Questions associated with the product, Maple 2015

I need to declare a whole set of variables as local. The variable names are generates algorithmically using assign. Like so:

seq(seq(assign(cat(S,i,j)=Vector(datatype=float)),i=1..9),j=1..9);

Stand-alone, this works and creates all these Vectors for later use. But this:

local seq(seq(assign(cat(S,i,j)=Vector(datatype=float)),i=1..9),j=1..9);

does not work; I get an "error; '(' unexpected".

I really do not want to type all these by hand... on the other hand, if I do not declare these as local I get 99 warnings about implicit local declaration; not nice.

Is there a way to do this?

Thanks,

M.D.

PS: I do not upload as the one line really is all that is needed. At the lowest level one does not get the implicit-declaration warning, but with "local" it still fails.

hello,my friends.I got a problem in using maple.

I want project a cuboid on a plane, and integrate function on that area.

for example, a cuboid which have a spatial diagonal between (0,0,0) and (1,2,1).
Then it was projected to a plane defined by three points (-1,0,0), (0,-1,0) and (0,0,-1).
Finally, a function x^2+y^2 was integrated on that projected area.

I found the cuboid can be defined with plottools:-cuboid and projected with plottools:-project in maple.
but how to integration next?
I can't find any commands in maple can do the integration with that irregular area.

I need some help.Thank you very much in advance.

Dear Useres!

Hope everyone is fine here! I want to compare the coeficient of exp(k*eta[3]+m*eta[1]+n*eta[2]) for k=0,1,2,3,...,N,n=0,1,2,3,...,N and m=0,1,2,3,...,N for N=10 in the following attached file. But I got some error, please have a look and try to fix it as early as possible. Please take care and thanks

Compare_coeff.mw

I am interested in the inner workings of SignalProcessing:-Convolution. I know I can list it with a higher setting of verboseproc:

with(SignalProcessing);
interface(verboseproc=3); # actually, 2 is enough here...
eval(Convolution);

and get

Obviously the real work happens in IPP:-Convolution, but that seems unknown. How can I list that??

TIA,

Mac Dude

Convolution.mw

I want to estimate numerically the value of P (that is the probability that f exceeds the value 12 when x, y and z are uniformly distributed within the box [-Pi, Pi]3).

restart
f := sin(x)+7*sin(y)^2+0.1*z^4*sin(x);
Omega := [x, y, z] =~ [(-Pi..Pi)$3]:
                                2        4       
               sin(x) + 7 sin(y)  + 0.1 z  sin(x)


h := Heaviside(f-12):
P := Int(h, Omega);


Here is a simple Monte Carlo estimation of P.

f_MC  := x -> sin(x[1])+7*sin(x[2])^2+0.1*x[3]^4*sin(x[1]); 
h_MC  := x -> Heaviside(f_MC(x) - 12);
omega := -Pi, Pi;
                         
P_MC := proc(N)
  local Z := Statistics:-Sample(Uniform(omega), [N, 3]):
  local F := Vector(N, n -> h_MC(Z[n])):
  local K := add(F):
  local P := evalf(add(F)/N):
  local q := Statistics:-Quantile(Normal(0, 1), 0.005, numeric):
  local e := -q*sqrt(P*(1-P)/N):
  printf("A bilateral 99%% confidence interval that Prob(f > 12) is %1.3e +/- %1.2e\n", P, e);
end proc:

P_MC(10^6)
A bilateral 99% confidence interval that Prob(f > 12) is 1.643e-02 +/- 3.27e-04

 

I was hoping to get a value for P using  evalf/Int with some method.
But I didn't succeed with any of the methods for multiple integration:

  • The following command returns 0 for n=1 and 2 and Int(h, Omega) if n >=3
    evalf( Int(h, Omega, 'epsilon=1e-n', 'method=_MonteCarlo') );
    

     

  • And all my attempts with methods from the Cuba library have resulted in an unevaluated Int(h, Omega) integral. 
     

Could you help me to estimate P using  evalf/Int ?
TIA

Hi,
Can anyone tell me what's going wrong with int(Heaviside(f-1/2), x=0..1, y=0..1); ?
 

restart:

f := x*y:

JH := int(Heaviside(f-1/2), x=0..1, y=0..1);  #???
                               1
                               -
                               4

 JP := int(piecewise(x*y>1/2, 1, 0), x=0..1, y=0..1); 
                          1   1      
                          - - - ln(2)
                          2   2      

# integrate "1" over the domain where f > 1/2

S := solve(f=1/2, x):
JS := int(1, x=S..1, y=1/2..1);
                          1   1      
                          - - - ln(2)
                          2   2      

Thanks in advance
 

Hi,

I solve numerically an ODE system which depends on 25 parameters.
I want to know the maximum value of the time at which a specific event is triggered, when these parameters vary (independently the one of the other) within a 25 dimensional hyperbox.

To solve this maximization problem, which I assume is local1, I would like to use NLPSolve

The attached zip (I use Mac OSX) contains:

  • a file that gives a full description of the problem (the original ".pages" file and its export as pdf),
  • an m file wich contains the solution procedure plus a few other variables needed to solve the problem,
  • the mw file which contains:
    • the reading of the m file,
    • the procedure (OBJ) which returns the trigerring time,
    • many attemps to find its maximum value using NLPSolve.

None of my attempts at using NLPSolve gave me the expected answer

Could you help me to fix this?

Thanks in advance

mw_and_m_files.zip

1: Initializing a local method (see the explanation file) with different points gave me different optimizers but all of them led to rather close values of the objective function. Thus the problem is either global instead of local, or convergence might not be achieved for all the initialization points (but keep in mind that I'm not interested in the location of the minimizer(s) but in the maximum value of if the time when the event is triggered).

Hi!

The so called Haar system is given as the follwoing sequence of functions:

 

 

Someboy know how to code the above functions? For a given n, I think that the rpoblem is to find the numbre k in the above definition.

Many thanks in advance for you comments.

In a calculation I am encountering expressions of the following kind:

-.27059805007310*sin(.12+epsilon)+.27059805007310*sqrt(1.-cos(.12+epsilon)^2)

As is known, for epsilon < Pi-0.12, the two terms are equal but opposite in sign and the result should be zero (ok, maybe a few 1E-15 for round-off). But for the heck of it I cannot get Maple to simplify this with the assumption e.g. epsilon < 0.1.

This can probably be simplified by squaring the two terms and then subtracting them, but that can possibly lead to other "interesting" effects and besides is a bit cumbersome.

Has anybody found a good way of  doing this?

Thanks,

M.D.

Dear Users! Hope everything fine here. For any vales of M and N I generated the system of equation.

for j from 2 while j <= N do
for i while i <= M do

omega[2]*(2-b[1])*u[i, j]+(2*b[1]*omega[2]-b[2]*omega[2]-omega[2]+1)*u[i, j-1]-omega[2]*(sum((b[l+2]-2*b[l+1]+b[l])*u[i, j-l-1], l = 1 .. j-2))
end do end do

But I want to convert it into matrix for example if N = 3 and M = 4, I need the following form

I am waiting for your response.

Hi!

I see that from Maple 2018 there is a command to compute the so called Radial Basis Function Interpolation:

https://www.maplesoft.com/support/help/Maple/view.aspx?path=Interpolation%2FRadialBasisFunctionInterpolation

I am trying to implement that code in Maple 2015, but it returns the error

Error, (in h) bad index into Vector

Displaying the vectors computed with the procedure, they seem correct, but the function that I want to return seems to fail (it is a summatory).

Attached the maple file

RBF_Interpolation.mw

I will appreciate any suggestion. Many thanks in advance for your comments!

BR,

GGM

It seems that DrawGraph cannot display the weights of more than 45 arcs of a directed graphs (the arcs themselves are keeping to be displayed correctly).

Maybe a version issue?

WeightedGraphs.mw

I rewrite my code with Grid library using local vCPU of amazon 

discover no license of distributed HPC when setup command show need go to acresso.com

can Grid still be used and function with local 96 number of vCPU?

then when I test code, I can not pkill mserver in ps -aux in LInux 

can the performance really improved ? Because I suppose 3 to 5 minutes mserver will end and disappear from ps -aux but grid node of mserver still running

originally I can run 100 batches every day., but I have to monitor decrease of memory in order to determine whether can kill mserver for next batch 

I expect run 400 batches per day. But Can not kill mserver when using grid

In my code I had using time limit(30, ...) 

when using Grid seq of function , can lprint work normally to get results into text ?

i notice Grid up to 57, do I need to recalculate and revise code to fit 96 vCPU for grid number 96?

Hi,

I would like the display of a piecewise-function F with DocumentTools:-Tabulate to look like the one I get with print.
How is it possible to do this?

Here is an example

restart:
with(DocumentTools):
with(DocumentTools:-Layout):

MV := kernelopts(version);
Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895

# Extract the version number for subsequent use
MV := parse(substring(StringTools:-Split(convert(MV, string), ",")[1], 7..-1))

# I want to display F and G while using DocumentTools
# As you see the display of F is not very pretty.
# This is not a problem related to the "height" of the formula for G is pretty-displayed
# even if it as roughly the same "height" than F

F := piecewise(seq(op([x<k, k]), k=1..5)):
g := x -> 1/(1+x):
G := (g@@5)(x):
Tabulate([F, G]):

# using DocumentTools:-Layout doesn't help

C1 := Cell( Textfield(style=TwoDimOutput,Equation(F))):
C2 := Cell( Textfield(style=TwoDimOutput,Equation(G))):
T  := Table(Column(),Column(),
         Row( C1, C2 )
       ):

if MV < 2018 then
  InsertContent(Worksheet(Group(Input( T )))):
else
  InsertContent(Worksheet( T )):
end if;


This is what DocumentTools:-Tabulate displays


DocumentTools_piecewise.mw


TIA

Hi, 

First question
Let P1 the logical proposition

restart
with(Logic):
local O
P1 := (&not O) &and (&not C) &implies (&not Q);

Is it possible to obtain its contraposition P2  in a form that contains &implies?

# P2 := (Q) &implies &not ((&not O) &and (&not C));


Second question
Why does the modulo 2 canonical form of proposition P5 above contains "1" "plus" other terms:
(if 1 is present this means 1 + something = 1 and then that P5 is a tautology, which is obviously wrong as Tautology(P5) shows)

restart
with(Logic):
local O
P1 := (&not O) &and (&not C) &implies (&not Q);-
P2 := (Q) &implies &not ((&not O) &and (&not C));
P3 := op(1, P2) &and (&not C);
P4 := op(2, P2) &and (&not C);
P5 := P3 &implies P4:

Canonicalize(P5, {O, C, Q}, form=MOD2)

                   C O Q + C Q + O Q + Q + 1


Verificaion of what the modulo 2 canonical form of a proposition including an "addititive" tautology is

T := O &or (&not O):
Canonicalize(T, {O}, form=MOD2);
Canonicalize(T &or S, {O, S}, form=MOD2);
                               1
                               1

Is it that I missed something or is iot a bug?

Watchout: this result has been obtained with Maple 2015.2

TIA
 

5 6 7 8 9 10 11 Last Page 7 of 72