Maple 2015 Questions and Posts

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

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
 

Hi, I want to animate the motion of an electrond around a negative-source electric field. The trajectory would be iperbolic, however I've encountered one problem: I have to compose the movemente with 4 different animate pointplot3d, and they all start at a certain point at the same time and end in another at the same time. Can I make it so that they all start when another one has finished and only the moving one is shown?

display(
animate(pointplot3d, [[A, sqrt(A^2 - 1), 0], symbol = solidsphere, symbolsize = 15, color = "Blue"], A = 1 .. 3), 
pointplot3d([0, 0, 0], symbol = solidsphere, color = "Blue", symbolsize = 15), 
animate(pointplot3d, [[-A, -sqrt(-1 + (-A)^2), 0], symbol = solidsphere, symbolsize = 15, color = "Blue"], A = -3 .. -1), 
animate(pointplot3d, [[A, 3*sqrt(2)/4*A - sqrt(2)/4, 0], symbol = solidsphere, symbolsize = 15, color = "Blue"], A = 3 .. 6), 
animate(pointplot3d, [[-A, 3*sqrt(2)/4*A - sqrt(2)/4, 0], symbol = solidsphere, symbolsize = 15, color = "Blue"], A = -6 .. -3), 
implicitplot3d(x^2 + y^2 + z^2 = 17, x = -6 .. 6, y = -10 .. 10, z = -10 .. 10, color = "Green", style = wireframe), 
scaling = constrained)

This is the code I've come up with, the blue still point is the elctron which powers the field, the moving blue point (there are 4 of them but all represent the same thing) is the moving electron and the green ball is a representation of the electric field.

Edit: I'll use the code for interactive components.

Thanks in advance to everyone!

 

Hi friends! Hope everything is fine here

I want to generate a piecewise function using some already computed functions. Like I compute B[0], B[1], B[2] and B[3] using some formula which are given as,

B[0] := (1/6)*x^3/h^3;
B[1] := (1/6)*(4*h^3-12*h^2*x+12*h*x^2-3*x^3)/h^3;
B[2] := -(1/6)*(44*h^3-60*h^2*x+24*h*x^2-3*x^3)/h^3;
B[3] := (1/6)*(64*h^3-48*h^2*x+12*h*x^2-x^3)/h^3;

Now, I want to define the corresponding piecewise function as

piecewise(x <= 0, 0, 0 < x and x <= h, B[0], `and`(h < x, x <= 2*h), B[1], `and`(2*h < x, x <= 3*h), B[2], `and`(3*h < x, x <= 4*h), (B[3], 0)

similarly for already computed functions B[0], B[1], B[2], B[3] and B[4] which are given as

B[0] := (1/24)*x^4/h^4;
B[1] := -(1/24)*(5*h^4-20*h^3*x+30*h^2*x^2-20*h*x^3+4*x^4)/h^4;
B[2] := (1/24)*(155*h^4-300*h^3*x+210*h^2*x^2-60*h*x^3+6*x^4)/h^4;
B[3] := -(1/24)*(655*h^4-780*h^3*x+330*h^2*x^2-60*h*x^3+4*x^4)/h^4;
B[4] := (1/24)*(625*h^4-500*h^3*x+150*h^2*x^2-20*h*x^3+x^4)/h^4;

I want to define the corresponding piecewise function as

piecewise(x <= 0, 0, 0 < x and x <= h, B[0], `and`(h < x, x <= 2*h), B[1], `and`(2*h < x, x <= 3*h), B[2], `and`(3*h < x, x <= 4*h), B[3], `and`(4*h < x, x <= 5*h), B[4], 0)

Can someone please let me know a general procedure (using seq command, loop etc.) to define piecewise function if B[0], B[1], B[2],...,B[M] are known? I shall be very thankful for your answer.

Dear Users!

Hope everything going find with you. I want to generate sequence of Spline[i,p], p=1…M as given bellow

restart; M := 3;
for p while p <= M do
(x-x[i])*B[i, p-1]/(x[i+p]-x[i])+(x[i+p+1]-x)*B[i+1, p-1]/(x[i+p+1]-x[i+1]);
B[i, p] := collect(%, [`$`(B[i+s, 0], s = 0 .. M)]);
B[i+1, p] := eval(%, i = i+1)
end do;
for p while p <= M do
Spline[i, p] := B[i, p]
end do

The expression for Spline[i,1] and Spline[i,2] are fine but the expressions of Spline [i,p] p>2 is not in simplified form I got the its simplification like given bellow for Spline[i,3]

Spline[i, 3]:=(x-x[i])^3*B[i, 0]/((x[i+3]-x[i])*(x[i+2]-x[i])*(x[i+1]-x[i]))+(((x-x[i])*(x-x[i]))*(x[i+2]-x)/((x[i+3]-x[i])*(x[i+2]-x[i])*(x[i+2]-x[i+1]))+(x-x[i])*(x[i+3]-x)*(x-x[i+1])/((x[i+3]-x[i])*(x[i+3]-x[i+1])*(x[i+2]-x[i+1]))+(x[i+4]-x)*(x-x[i+1])^2/((x[i+4]-x[i+1])*(x[i+3]-x[i+1])*(x[i+2]-x[i+1])))*B[i+1, 0]+((x-x[i])*(x[i+3]-x)^2/((x[i+3]-x[i])*(x[i+3]-x[i+1])*(x[i+3]-x[i+2]))+(x[i+4]-x)*(x-x[i+1])*(x[i+3]-x)/((x[i+4]-x[i+1])*(x[i+3]-x[i+1])*(x[i+3]-x[i+2]))+((x[i+4]-x)*(x[i+4]-x))*(x-x[i+2])/((x[i+4]-x[i+1])*(x[i+4]-x[i+2])*(x[i+3]-x[i+2])))*B[i+2, 0]+(x[i+4]-x)^3*B[i+3, 0]/((x[i+4]-x[i+1])*(x[i+4]-x[i+2])*(x[i+4]-x[i+3]));

I am waiting for positive respone. Please take care and thanks in advance

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