## When i type sqrt(25), i get 1.81847767202745*10^(-...

Yeah, i have tried evalf[10](sqrt(25)).
How can i get a simple number as answer? I'm loving the software but i just wished i could type in:
int(sin(x), x = 0 .. pi)
and get 2 instead of (2.739493386*10^(-116) + (2.739493386*10^(-116))*I)*pi.
Also, when i type evalf[50](pi), i wish to get all the 50 digits, but i just get \pi :/.

## some problems with maple...

i have a matrix named S. it has two variables with the names sigma1 and tau. i do some computations with these varibels to obtain a matrix named S_NEW. when i calculate S_NEW with parameters and then i substitute parameter tau with zero i got the answer a zero Matrix. but when i put tau=0 at the initiation of my code, i got another answer. what is the problem?

the second issue is related with the name of parametes in maple. when the varible has the name sigma1 (and tau=0), the matrix S_NEW is a matrix with the only component of (1,1). when i change the parameter name to sigma the matrix S_NEW is a matrix with the only component of (3,3). where is the problem?

 > restart:with(LinearAlgebra):
 > tau:=0;
 (1)
 > S:=Matrix(3,[[sigma1,tau,0],[tau,0,0],[0,0,0]]):B1:=Matrix(3):
 > A12,B12:=(Eigenvectors(S)):
 > V12:= Matrix(Normalize~([Column(B12,1..3)],Euclidean)):
 > S_NEW:=simplify(V12^+.S.V12) assuming real ;
 (2)
 > eval(S_NEW,tau=0)
 (3)
 >
 >
 >

## Physics package Determinant...

Hello,

I have installed the Physics Package with:

PackageTools:-Install("5137472255164416", version = 329, overwrite)

I have a question about the calculation of the Tensor determinant:

I use two ways to calculate the determinant of the same matrix:

The first with Physics package and the second with LinearAlgebra Package:

It is easy to calculate analytically the result it is : -1

But Physics Package gives : +1 and LinearAlgebra gives: -1

My question is why I found +1 with Physics Package : What I doing wrong ?.

**************************************************

restart

with(Physics)

Setup(coordinates = {X = [t, x, y, z]}, dimension = 4, metric = {(1, 1) = 1, (2, 2) = -1, (3, 3) = -1, (4, 4) = -1}, signature = +---, mathematicalnotation = true)

Define(H[mu, nu] = Matrix(4, {(1, 1) = 1+h, (1, 2) = h, (2, 2) = -1+h, (3, 3) = -1, (4, 4) = -1}, shape = symmetric))

H[]

H[determinant]

with(LinearAlgebra)

B := Matrix(4, {(1, 1) = 1+h, (1, 2) = h, (2, 2) = -1+h, (3, 3) = -1, (4, 4) = -1}, shape = symmetric)

Determinant(B)

***************************************

Sincerely yours

Xavier

## why rewriting the ODE changes it classification by...

This for me seems strange. A first oder ODE of degree one of form   A+B*y'=0. Asking Maple for its classification, it gives exact AND rational.  After rewriting it in the form y'=f(x,y) , now Maple says it is rational only. It no longer recognize it as exact.

How could this be possible? It is the same ODE, just rewrittng differently.  Maple 2019.1 on windows.

 > restart;
 > Typesetting:-Settings(typesetprime=true):

 > dsolve(ode)

 > new_ode:=convert(ode,D); #so I can solve for y' RHS:=solve(new_ode,D(y)(x));

 > dsolve(new_ode)

 >

## help list integer equation solve?...

 (1)

 (2)

 (3)

 (4)

i want to list variable m in integer number from solve?

Can you help me?

@acer

@Carl Love

## Equating multiple multivariate polynomials to find...

I want to solve for the coefficients in some multivariate polynomials by equating them to other known multivariate polynomials.

Something like this. I have

p[1]=(a+b)*x^2+(a+c)*x*y+d*z;

p[2]=(a-b)*x+e*y*z+f*z^2;

I want to impose that p[1]=x^2+2*x*y+3*z and that p[2]=x+4*y*z and I want Maple to tell me the values of (a,b,c,d,e,f).

Sounds simple enough, but I have not been able to do it

## How to solve initial Newton iteration is not conve...

I want to solve an ODE system numerically, but maple show not converge for iteration, can you give a solution
with(VectorCalculus);
with(linalg);

pi := 4; eta := 6; mh := .1; mv := .3; bh := .15; Nh := 400; Nv := 200; bv := .25; b := .8; d := .1; p := .5; B := 10; A := 1; alpha := .25; beta := .7; K := 400; r := .5; c := .9; q := .8; Sh0 := 225; Sv0 := 100; Ih0 := 175; Iv0 := 600; P0 := 50; T := 35; B := 10;

eq1 := diff(L1(t), t) = -L1(t)*(-bh*b*Iv(t)/Nh-mh)-L2(t)*bh*b*Iv(t)/Nh; eq2 := diff(L2(t), t) = -L2(t)*(-mh-d)+L3(t)*bv*b*Sv(t)/Nv-L4(t)*bv*b*Sv(t)/Nv; eq3 := diff(L3(t), t) =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eq5, eq6, eq7, eq8, eq9, Ih(0) = Ih0, Iv(0) = Iv0, L1(T) = 0, L2(T) = 0, L3(T) = 0, L4(T) = 0, L5(T) = 0, P(0) = P0, Sh(0) = Sh0, Sv(0) = Sv0}, fcns, type = numeric);
fcns := {Ih(t), Iv(t), L1(t), L2(t), L3(t), L4(t), L5(t), P(t),

Sh(t), Sv(t)}
Error, (in dsolve/numeric/bvp) initial Newton iteration is not converging



## Solving a differential equation (relies on linear ...

Hello forums,

I appreciate all the help that has been given to me throughout the past months.  I'm trying to solve a differential equation that involves a matrice in it.  I'm not sure if I am entering in the problem in correctly nor do I know what commands to use.  Can someone please be of assistance and teach me?

Thanks

William

Solving_a_linear_algebra_differential_equation.mw

## Creating single random values from a distribution...

Dear Maple users

I wanted to create a list of random datapoints for the "simple linear regression model". Standard deviation sigma is given, slope a and fixed value b given for the line as well. Before the code below I had some random x-values created for the data points saved in the list X. To calculate the corresponding y-values randomly from a normal distribution with standard deviation sigma and mean equal to a*x+b I wrote the code below:

randomize():
for i from 1 by 1 to N do
mean:=a*X[i]+b:
Yvar:=RandomVariable(Normal(mean,sigma));
S:=Sample(Yvar,1);
Z[i]:=S[1];
end do:
Y:=convert(Z,list):

....

It actually works, but I just found it a bit strange having to repeatedly ask for a random sample with only a single member. Isn't it possible to do it more efficiently? I am aware of the special properties of the normal distribution, which would make it possible to take only one sample and add the mean afterwards, but I am not looking for ad hoc solutions, rather appropriate commands to create simgle random values from a distribution.

Erik

## How to Specify the Number of Non-zero Entries in a...

Hi,

I am using A:=LinearAlgebra:-RandomMatrix(10,10,generator=-10..10) to generate a random matrix. How may I specify that every row of A has at least three non-zero entries?

Thanks!

## How do i use multiple maplet windows ?...

Hello, i'm doing an interface for LU decomposition. I need to do a multiple windows interface using maplets, and i want to click one button on the inicial interface to open another window with other interface. I also need to create the second interface having N TextFields (N value will be inserted on the first window). Somebody knows how to do it?

## Plywood sheet optimization problem...

Suppose I have a list of plywood dimensions

4 - 40.625" x 20"
2 - 36" x 20"
2 - 34.75" x 20"
3 - 33.75" x 12"
6 - 18.825" x 12"
3 - 32.5" x 12"
3 - 33.75" x 19.5"

How many sheets of 4' x 8' plywood do I need to minimize the cost of my project?

## How to code for the betweeness of an unweighted Gr...

How does maple produce a Betweeness centrality matrix for unweighted, strongly connected graphs?

## how to correctly find leading sign on expression?...

8/24/19. Updated question the bottom

I need to find if expression has  a "-" in front of it or not.  This is for formatting purposes for something I am doing, that is all.

I was using the command sign() for this, and it seems to work OK, but sometimes a Maple error is generated or not leading term sign is returned.

The sign function computes the sign of the leading coefficient of expr.

Is there a better and more robust way to do this other than using sign() or Am I using sign wrong?

 > restart;
 > expr:=-sin(x)/ln(y)+1; op(expr);

 > #why this gives 1 as sign for the above? sign(expr);

 > #workaround? sign(op(1,expr))

 > expr:=sin(x)/ln(y)+1; sign(expr);

 > expr:=-x; sign(expr);

 > expr:=-LambertW(exp(p))+1; sign(expr)

 > expr:=-LambertW(exp(p))/(1+LambertW(exp(p)))+1; sign(expr)

Error, invalid argument for sign, lcoeff or tcoeff

 > #it seems the following is a work around for the above case #but why it is needed just here? sign(op(1,expr))

 >

UPDATE

Thanks to comment below about using frontend. I never used this before except for now. It seems a very useful command and I think I will be using it a lot more from now on.

Just to clarify again what I want. I am just looking to see if there is a leading negative sign in front of an expression. I am not looking to find if the expression itself can be postive or negative when evaluated or anything more subtle or deep than that.

I simply want to check if there is literally a "-" in front of the maple expression. That is all.

Only issue left, is why Maple still gives Error, invalid argument for sign, lcoeff or tcoeff for the last example below? Here is the updated worksheet.

 > restart;
 > expr:=-sin(x)/ln(y)+1; frontend(sign,[expr]);

 > expr:=sin(x)/ln(y)+1; frontend(sign,[expr]);

 > expr:=-x; frontend(sign,[expr]);

 > expr:=-LambertW(exp(p))+1; frontend(print,[expr]); frontend(sign,[expr]);

 > expr:=-LambertW(exp(p))/(1+LambertW(exp(p)))+1 ; frontend(print,[expr]); frontend(sign,[expr]);

Error, invalid argument for sign, lcoeff or tcoeff

 >