MaplePrimes Questions

I am new to Maple. I attempted to write a procedure that takes another procedure as input. It is not working correctly. As you can see from the output of a call to procedure A that something went wrong.
How do I do this correctly?
 

H := proc (n::integer)::real; local s, i; s := 0; for i by 2 to n do if i <= n-1 then s := s+1./((i*(i+1))) else s := s+1./i end if end do; return s end proc

A := proc (n::integer, T::procedure)::real; local d1, d2, s; d1 = T(n+1)-T(n); d2 = T(n+2)-T(n); s := T(n+1)-d1*d2/(d2-d1); return s end proc

proc (n::integer, T::procedure)::real; local d1, d2, s; d1 = T(n+1)-T(n); d2 = T(n+2)-T(n); s := T(n+1)-d1*d2/(d2-d1); return s end proc

(1)

H(11)

.7365440115

(2)

A(10, H)

.7365440115-d1*d2/(d2-d1)

(3)

``


 

Download st.mw

Maple Apps-Venn Diagrams does not work.  In box on the right there is an error message.

How do I calculate the first 5 values of the bisection method using the starting values of 4 and 5 of the function f(x) = (5 - x) * (e^x)-5

 

a := 4;
b := 5;
nStep := 5;
                               4
                               5
                               5
 

To obtain the columns of matrix as a list, this is what I currently do

A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);

Now

[seq(A[..,i],i=1..4)];

Also this does it

map(i->A[..,i],[$1..4]);

Is there a "shorter" way to do it?  For example, A[..,[$1..4]] does not do it ofcourse, it just gives the matrix itself back.

 

 

To solve this, I got this far but am not sure where to go next?

 

f2 := x^2 - 3;
f2d := diff(f2, x);
                              2    
                             x  - 3
                              2 x

set value for x0, number precision

x0 := 3;
eps := 0.1*10^(-5);
                               3
                            0.000001
 

I do not understand what ColumnSpace is doing in Maple, as I can't get it to match my hand solution and the book. It must be using different definition which is not the book standard.

In the textbook, it says to find column space of matrix A, is to find the Echelon form, then lookup the pivot columns. Then pick the corresponding columns from the original A. These are the column space.

I'll show the book example, and Maple code to try to get same answer.

Here is an example from the book

Notice the columns space are the first, second and fourth columns of A. Since these correspond to the pivot columns of the Echelon form.

In Maple, the Echelon is found using LinearAlgebra:-GaussianElimination(A,'method'='FractionFree'); which gives the same pivot columns as the book. So far so good (the numbers are not the same, but this is normal, as Echelon form is not unique. Only reduced Echelon form is unique), but as long as the pviot columns are correct, that is the important part. 

But when I do LinearAlgebra:-ColumnSpace(A); I get completely different result. The only thing I could see in help, is that it says The Vectors are returned in canonical form with leading entries 1.

I do not underand what that means or how to convert Maple answer to make it match the expeted result since the result is completely different and I do not see the mapping needed.

restart;
A:=Matrix([[1,2,1,3,2],[3,4,9,0,7],[2,3,5,1,8],[2,2,8,-3,5]]);
LinearAlgebra:-GaussianElimination(A,'method'='FractionFree');
LinearAlgebra:-ColumnSpace(A);


I also tried this on Wolfram Alpha, and got same answer as the book

 

 

Maple 2020.1

reference: Differential Equations and linear algebra, 4th ed., Edwards, Penney and Calvis. Pearson. 2017. page 247.

Hi,

I do not understand why this simple procedure evaluates so differently depending on the type of its second parameter?

A typo somewhere or a bug?


 

restart:

interface(version)

`Standard Worksheet Interface, Maple 2015.2, Mac OS X, December 21 2015 Build ID 1097895`

(1)

KL := (a, b) -> (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a

proc (a, b) options operator, arrow; (1/4)*(2*ln(a+b)*a^2+4*ln(a+b)*b*a+2*ln(a+b)*b^2-2*ln(b)*b^2-a^2-2*a*b)/a end proc

(2)

evalf(KL(1e-10, 1/2))

-.2

(3)

evalf(KL(1e-10, 0.5))

-0.2500000000e-10

(4)

evalf(KL(1e-10, convert(0.5, rational)))

-.2

(5)

limit(KL(a, 1/2), a=0, left);
limit(KL(a, 1/2), a=0, right)

-(1/2)*ln(2)

 

-(1/2)*ln(2)

(6)

limit(KL(a, 0.5), a=0, left);
limit(KL(a, 0.5), a=0, right)

Float(-infinity)

 

Float(infinity)

(7)

 


 

Download I_am_lost.mw

(2x+a^2-3a)=a(x-1) with all the real values of a

I have a system of six ODEs. i solve them numerically using dolve,numeric command. the problem is setting step size for example stepsize=1e-5 or minstep=500 lead to a result of order 1e-2; But without using this option, results are of order integer numbers. could any one help? tnx in advance

EDITED
 

Download ode_problem.mw

Hello,

I'm trying to fit experimental data to a model in which a variable is the result of an equation.

In a procedure I solved the equation and found lambda22 for each of the data lambda11 I have. It depends on a a parameter I need to identify to fit the data to the model.

But then when I use DataFit from DirectSearch package, I get this error :

Is it impossible to specify more than one independant variable ? Or is it a problem coming from the procedure ?

Thanks in advance,

Manon

data.xlsx

restart;

data:=ExcelTools:-Import("D:/data.xlsx") : # importer les donnees
with(LinearAlgebra): 
lambdaX:=Column(data,1): 
PK1X:=Column(data,2):


tensF:=Matrix([[lambda11,0,0],[0,lambda22,0],[0,0,lambda22]]):
tensFbar:=Matrix([[(lambda11/lambda22)^(2/3),0,0],[0,1/sqrt((lambda11/lambda22)^(2/3)),0],[0,0,1/sqrt((lambda11/lambda22)^(2/3))]]):
tensBbar:=Multiply(tensFbar,Transpose(tensFbar)):

kappa:=100:
tensPK:=Multiply(Transpose(MatrixInverse(tensF)),(2/Determinant(tensF))*a*(tensBbar-(1/3)*Trace(tensBbar)*Matrix(3,shape=identity))+kappa*(Determinant(tensF)-1)*Matrix(3,shape=identity)):
PK1:=tensPK[1,1]:
eq:=0=tensPK[2,2]:


lambda22sol:=proc(aValue) 
   global __old_a;
   local res, i, eq1, sol1, lambda22Est;
   if not [aValue]::list(numeric) then
      return 'procname'(args);
   end if;
   lambda22Est:=Vector(1..RowDimension(lambdaX)):
   eq1:=Array(1..RowDimension(lambdaX)):
   if __old_a<>aValue then
      __old_a:= aValue;
     for i from 1 to RowDimension(lambdaX) do
     	eq1[i]:=eval(eq,[a=aValue,lambda11=lambdaX[i]]):
		sol1:=solve(eq1[i], lambda22);
		lambda22Est[i]:=sol1[1]:
	end do:
	res:=lambda22Est;
   end if;
end proc:

matrix1:=<lambdaX|lambda22sol(0.9)|PK1X>;
DS1:=CodeTools:-Usage(
        DirectSearch:-DataFit(PK1,matrix1,[lambda11,lambda22]));
res2:=eval(PK1,DS1[2]):

 

Hi,

Using Maple 2020 I can't seem to get a trigonometric equation (fairly simple at that) to solve properly.

solve_err.mw

Here's a capture :

 

Expected answer is 1/(25*sqrt(3))

Adding +2*Pi on the RHS to match the sign doesn't work either.

Hi everybody, I have a set from fsolve command. As shown in below image

When I want to obtain only numbers, I write cozum[1] but maple gives me c-4=1.591497964.. As you understand I want only numbers. How can I do this? 

int(1/(x-1)+sum((k+1)*x^k,k=0..2018)/sum(x^k,k=0..2019),x);

Direct integration produces a large, messy statement, including numbers like 2017, 2016,...,1

Looking at the parts, the numbers 2020, 2019, etc. are in each.

(**) sum((k+1)*x^k,k=0..2018);
x^2019*(2019*x-2020)/(x-1)^2+1/(x-1)^2

(**) sum(x^k,k=0..2019);
x^2020/(x-1)-1/(x-1)

Looks like this should reduct to some simple expession????

I made a mistake in entering this expression:  2020 should have been 2018.

int(1/(x-1)+sum((k+1)*x^k,k=0..2020)/sum(x^k,k=0..2019),x);

realloc(): invalid old size

Process Maple aborted (core dumped)


Nothing I can do from the keyboard should cause a core dump.

Looking at #6 in http://www.mit.edu/~pax/pdf/qualifying_round_2020_test.pdf

How do I entter the continued fraction in Maple?  I am using the command line interface (actually Emacs).

1 2 3 4 5 6 7 Last Page 3 of 1943