Maple 2017 Questions and Posts

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

Greetings, I am trying to make augmented matrix in the form of A, B and F where A is the tridiagonal matrix, B is the vector and F is the non-linear part of the system. I already tried (A,B,F):=augment(X,output='A','B','F'); but it is an error. Can someone help me? Thank you in advance!

 

 

The matrix X is as follows:

 

X:=[[[-lambda/(h^2),-u/(2 h)+lambda/(h^2),0,0],

       [u/(2 h)+lambda/(h^2),-lambda/(h^2),-u/(2 h)+lambda/(h^2),0],

       [0,u/(2 h)+lambda/(h^2),-lambda/(h^2),-u/(2 h)+lambda/(h^2)],

       [0,0,u/(2 h)+lambda/(h^2),-lambda/(h^2)]]];

I have made a plots[multiple] with 3 different functions, but I wish to connect the ends with vertical lines. Does anybody have a solution to this? I have uploaded screenshot Thank you in advance. BR Jens

Hello people in mapleprimes,

I am writing this sentences, hoping to be given any answer from you, to the 
question I have, about conversion of Array to List.

restart;
a:=plot3d(theta*z,theta=0..2,z=0..1,coords=cylindrical,grid=[3,2]);
A:=op([1,1],a);

brings a response of Array as, which I call BB,

Array(1 .. 3, 1 .. 2, 1 .. 3, {(1, 2, 3) = HFloat(1.), (2, 2, 1) = HFloat(.540302305868139765), (2, 2, 2) = HFloat(.841470984807896505), (2, 2, 3) = HFloat(1.), (3, 2, 1) = HFloat(-.832293673094284814), (3, 2, 2) = HFloat(1.81859485365136342), (3, 2, 3) = HFloat(1.)}, datatype = float[8])

And, I converted it to List, with 

convert(A,list,nested);

The response of this is, which I call CC,

[[[0., 0., 0.], [0., 0., 1.]], [[0., 0., 0.], [.540302305868140, .841470984807897, 1.]], [[-0., 0., 0.], [-.832293673094285, 1.81859485365136, 1.]]]

, which is composed of three lists:
[[0., 0., 0.], [0., 0., 1.]]

[[0., 0., 0.], [.540302305868140, .841470984807897, 1.]]

[[-0., 0., 0.], [-.832293673094285, 1.81859485365136, 1.]]

Then, my question is following:

Seeing CC, I can see three segments are shown.
The first one is  the segment between [0., 0., 0.] and [0., 0., 1.].
But, I can't find any elements of Array BB corresponding to [0,0,0] above in CC.
And as for 0, 0 in [0, 0, 1] in CC above, the first 0 should be (1,2,1) and the second one should be (1,2,2).
But, there are no such (1,2,1) and (1,2,2) in BB. 
Despite of these, BB is converted to CC, from any reason I want to know and ask this question for.

As for [[0., 0., 0.], [.540302305868140, .841470984807897, 1.]] in BB, the circumstances are the same.
I don't know from where [0,0,0] appeared. Surely, as MESH requires three points, you might say that
such things might occur. But, it is only after I converted Array BB to List CC, with plot3d or MESH then having no relation 
to the present circumstances. So, I think that it is not possible to say that Maple added [0,0,0] or such things to Array BB

 as it is about plot 3D or about MESH.

So, my question is how the conversion of BB to CC could have occurred.

Thanks in advance.

May_16_2018_question.mw

I am trying to solve a factorial inequality.

solve(1/(n+1)! * exp(0.1)<=0.00001)

I get no result and a warning, "some solutions may have been lost".

Also same problem with the simpler inequality

solve(1/(n+1)! <=0.00001)

Wolfram has no problem solving it.

Am I entering it wrong? I attached a copy of my worksheet.

factorialinequality.mw

 

The problem came up when solving this problem: What degree of the maclaurin polynomial  is required so that the error in the approximation of e0.1 is less than 0.00001

When I right-click on a Matrix, the cursor rotates, but the context menu does not open at all (in Maple 2017, in document mode, in Win 10).
Any suggestions - Anyone else with this problem?

Hi, I want to define A matrix (shown below) that has some definite products. These products have two arguments e.g. (k=1..N) and (k<>i) but product expects only one argument. What should I do?

I appreciate any help you can provide.

 

Hi all

I wnat to produce following matrix P2r+1, 2r+1 in maple.

can any one help me please?

I have a multiple integration. I know my integrals exist. When I write procedure for Rimannian sum, Maple gives correct answers for every choice of parameters of my integral. But when I ask Maple to compute it with int(...,numeric) sometimes it shows a correct answer and sometimes it shows a wrong answer. I'm curios to know what is going wrong in Maple, is there any command to see the details and steps of the computation to see where Maple is going wrong? I also increased the number of digits after decimal from 10 to 12 and 14. But Maple just repeats the wrong answers with just two or four digits. So the problem is not related to the approximation arising from number of decimals.

Hey.
I have been trying to convert my maple .mw file to a PDF under 'Print...' but it does not work. The problem is when I click on the "Save as PDF" and I name my pdf and click on 'Save' it does not save my file anywhere. It simply will not save it. 
Does somebody know why it will not save as a PDF? It saves all other files properly (also converts word files to PDF fine). 

 

Can I somehow define a function based on a result from a PolynomialFit.
It doesn't seem to read it as a function the way I try to define it now (see attached maple file).

I could copy the result into a function, but then I lose some information since the values are approximated.

Define.mw

I am trying to find an eigenspace of a matrix, but I am getting an error. I have attached a screenshot of the error and my work to help. 

Dear Friends

Do I want to know how to merge these two loops in one? how to apply if-else loop? help me in this regard. the source file is attached. Thank you! 

restart; M := 5;
for i1 while i1 <= M do N[i1, 0](u) = 1 end do;
                         N[1, 0](u) = 1
                         N[2, 0](u) = 1
                         N[3, 0](u) = 1
                         N[4, 0](u) = 1
                         N[5, 0](u) = 1
for k1 while k1 <= M do N[0, k1](u) = 0 end do;
                         N[0, 1](u) = 0
                         N[0, 2](u) = 0
                         N[0, 3](u) = 0
                         N[0, 4](u) = 0
                         N[0, 5](u) = 0

 

Hi,

 

I am trying to make Maple replace some expressions with variables so that I'll be able to get the coefficients of the resulting polynomial. 

I have the following piece of code:

h := map(proc(x) convert(x,parfrac,s,complex) end proc,convert(f,parfrac,t,complex));

for sub_var in subs do
               h:=applyrule(sub_var[1]=1/sub_var[2],h);

end do;

subs is a list automatically generated in a different procedure, here is a sample list:

[[t-3*I, a1], [t+3*I, b1], [s-3*I, c1], [s+3*I, d1], [t-.4948716594-.4285714286*I, a2], [t-.4948716594+.4285714286*I, b2], [s-.4948716594-.4285714286*I, c2], [s-.4948716594+.4285714286*I, d2], [t+.4948716594-.4285714286*I, a3], [t+.4948716594+.4285714286*I, b3], [s+.4948716594-.4285714286*I, c3], [s+.4948716594+.4285714286*I, d3]]

f is a rational function that breaks up nicely into partial fraction due to theoretical reasons. here is a sample:
f: = (1/2)*(3969*I)*(35*s^3*t^3+21*s^3*t-9*s^2*t^2+21*s*t^3+45*s^2+63*s*t+45*t^2+27)*(t^2+1)*(s^2+1)/(((27*I)*t^2+7*t^3-9*I-21*t)*((27*I)*s^2-7*s^3-9*I+21*s)*((27*I)*s^2+7*s^3-9*I-21*s)*((27*I)*t^2-7*t^3-9*I+21*t))
These particular samples have algebraic numbers in them. and that makes apply rule fail, it seems to only work if the numbers are rational. Any idea on how can I fix that? Alternatively, replace applyrule all together with something that actually works?

Thanks

Dear Maple users, m

I am willing to convert a Matlab text into Maple and create a Maple procedure that can compute the same, but since I never used Matlab I have no idea of the input.

I used the: Matlab[FromMFile]("covMarket.m", "mapleout.mpl"); to convert. But there is nothing converted actually, 

So I am wondering, can anybody help converting it and posting the converted maple text into the answers? If there are lots of work to be done, please at least show me what to do. Thanks in advance

Below is the Ledoit and Wolf, shrinkage estimator script in Matlab:

function [sigma,shrinkage]=covMarket(x,shrink)

% function sigma=covmarket(x)
% x (t*n): t iid observations on n random variables
% sigma (n*n): invertible covariance matrix estimator
%
% This estimator is a weighted average of the sample
% covariance matrix and a "prior" or "shrinkage target".
% Here, the prior is given by a one-factor model.
% The factor is equal to the cross-sectional average
% of all the random variables.

% The notation follows Ledoit and Wolf (2003)
% This version: 04/2014

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This file is released under the BSD 2-clause license.

% Copyright (c) 2014, Olivier Ledoit and Michael Wolf 
% All rights reserved.

% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:

% 1. Redistributions of source code must retain the above copyright notice,
% this list of conditions and the following disclaimer.

% 2. Redistributions in binary form must reproduce the above copyright
% notice, this list of conditions and the following disclaimer in the
% documentation and/or other materials provided with the distribution.

% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
% IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
% PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
% CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


% de-mean returns
t=size(x,1);
n=size(x,2);
meanx=mean(x);
x=x-meanx(ones(t,1),:);
xmkt=mean(x')';

sample=cov([x xmkt])*(t-1)/t;
covmkt=sample(1:n,n+1);
varmkt=sample(n+1,n+1);
sample(:,n+1)=[];
sample(n+1,:)=[];
prior=covmkt*covmkt'./varmkt;
prior(logical(eye(n)))=diag(sample);

if (nargin < 2 | shrink == -1) % compute shrinkage parameters
  c=norm(sample-prior,'fro')^2;
  y=x.^2;
  p=1/t*sum(sum(y'*y))-sum(sum(sample.^2));
  % r is divided into diagonal
  % and off-diagonal terms, and the off-diagonal term
  % is itself divided into smaller terms 
  rdiag=1/t*sum(sum(y.^2))-sum(diag(sample).^2);
  z=x.*xmkt(:,ones(1,n));
  v1=1/t*y'*z-covmkt(:,ones(1,n)).*sample;
  roff1=sum(sum(v1.*covmkt(:,ones(1,n))'))/varmkt...
      -sum(diag(v1).*covmkt)/varmkt;
  v3=1/t*z'*z-varmkt*sample;
  roff3=sum(sum(v3.*(covmkt*covmkt')))/varmkt^2 ...
      -sum(diag(v3).*covmkt.^2)/varmkt^2;
  roff=2*roff1-roff3;
  r=rdiag+roff;
  % compute shrinkage constant
  k=(p-r)/c;
  shrinkage=max(0,min(1,k/t))
else % use specified number
  shrinkage = shrink;
end

% compute the estimator
sigma=shrinkage*prior+(1-shrinkage)*sample;


 

MAPLE CODE [below link]:


Dispersion.mw

range of "kx" variable [0 to 8x106] and range of "f" variable  [80x1012 to 220x1012]

First 13 14 15 16 17 18 19 Last Page 15 of 40