MaplePrimes Questions

Dear Users!
Hope you all are fine with everything. How we can identify the same equations from a number of equations using maple command, like
Eq1:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]+183.346494441862*`τu`[2, 2]-1069.52121757753*`τu`[3, 2]+178.253536262923*`τu`[1, 3]-1069.52121757753*`τu`[2, 3]+6238.87376920228*`τu`[3, 3];
Eq2:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]-91.6732472209439*`τu`[3, 2]+178.253536262923*`τu`[1, 3]+356.507072525849*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-3/7;
Eq3:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]+356.507072525849*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]-91.6732472209439*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-9/7;
Eq4:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]+20.3718327157631*`τu`[2, 2]+30.5577490736484*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]+30.5577490736484*`τu`[2, 3]+45.8366236104784*`τu`[3, 3]-12/7;
Eq5:=5.09295817894067*`τu`[1, 1]-30.5577490736439*`τu`[2, 1]+178.253536262923*`τu`[3, 1]+50.9295817894067*`τu`[1, 2]-305.577490736439*`τu`[2, 2]+1782.53536262923*`τu`[3, 2]+504.202859715131*`τu`[1, 3]-3025.21715829077*`τu`[2, 3]+17647.1000900295*`τu`[3, 3]-18/7;
Eq6:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+50.9295817894067*`τu`[1, 2]+101.859163578814*`τu`[2, 2]+152.788745368241*`τu`[3, 2]+504.202859715131*`τu`[1, 3]+1008.40571943027*`τu`[2, 3]+1512.60857914560*`τu`[3, 3]-3;
Eq7:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]-30.5577490736439*`τu`[1, 2]-61.1154981472883*`τu`[2, 2]-91.6732472209439*`τu`[3, 2]+178.253536262923*`τu`[1, 3]+356.507072525849*`τu`[2, 3]+534.760608788841*`τu`[3, 3]-3/7;
Eq8:=5.09295817894067*`τu`[1, 1]+10.1859163578814*`τu`[2, 1]+15.2788745368241*`τu`[3, 1]+10.1859163578814*`τu`[1, 2]+20.3718327157631*`τu`[2, 2]+30.5577490736484*`τu`[3, 2]+15.2788745368241*`τu`[1, 3]+30.5577490736484*`τu`[2, 3]+45.8366236104784*`τu`[3, 3]-12/7;
Eq9:=41.7622570673196*`τu`[3, 1]+41.7622570673196*`τu`[1, 3]+15.2788745368220*`τu`[1, 1]+83.5245141346398*`τu`[2, 3]+30.5577490736443*`τu`[2, 1]+113.063671572516*`τu`[3, 3]+83.5245141346398*`τu`[3, 2]+30.5577490736443*`τu`[1, 2]+61.1154981472892*`τu`[2, 2];
In above equations Eq2 and Eq7; Eq4 and Eq8 are same. If I have set of 100 equation how I can identify similar equations?
@acer @Kitonum @Preben Alsholm

The uploaded worksheet describes a mechanics scenario which I would like to animate.

While I understand the expression for the kinetic energy of the torus, the term containing cos(theta) within the expression for the KE of the pearl baffles me.

From which physics aspect of the scenario does this term derive?

Pearl_in_torus.mw

Hi, 

While trying to convert into integers a sample S drawn from a binomial distribution,  I've observed that  round~(S) didn't do the job while map(round, S) did it.

First question: why the first syntax and the second one are not equivalent on this case?

I investigated a little bit further by applying round~ on a row vector T of Hfloats (thus T and S are "identical")

Second question: While  round~(S) doesn't work but round~(T) does?


 

restart

S := Statistics:-Sample(Binomial(10, 0.5), 2);
round~(S);      # Why round~(S) doesn't return integers
map(round, S);  # but map(round, S) does?

lprint(S)

S := Vector[row](2, {(1) = 6.0, (2) = 7.0}, datatype = float[8])

 

Vector[row]([6., 7.])

 

Vector[row]([6, 7])

 

Vector[row](2, {1 = HFloat(6.), 2 = HFloat(7.)}, datatype = float[8], storage = rectangular, order = Fortran_order, shape = [])

 

# Evaluation of round~(T) on a vector of Hfloats



T := Vector[row](2, [HFloat(6.), HFloat(3.)]);
lprint(S);
round~(T);   # round~(T) returns integers,
             

T := Vector[row](2, {(1) = HFloat(6.0), (2) = HFloat(3.0)})

 

Vector[row](2, {1 = HFloat(6.), 2 = HFloat(7.)}, datatype = float[8], storage = rectangular, order = Fortran_order, shape = [])

 

Vector[row]([6, 3])

(1)

 


 

Download Tilde_versus_map.mw

 

Hello, 

In this simple example in Maple 2019:

 

k[1] := 16;

solve(k[2]^2 = k[1], {k[2]}, useassumptions) assuming 0 < k;
 

The result of the solve is 

{k[2] = 4}, {k[2] = -4}

which is not what I'm expecting.

I'm expecting 

{k[2] = 4}

I'm trying to assume that both the variable named k[1] and the variable named k[2] are greater than 0 by assuming that 0 < k.
My goal is a way to make the same assumption for variables with the same base but different subscripts.
How can I do this?

Thanks in advance.


 

``

  Note: To enter units, I used the unit key (blue) in the Units palette.

  When I use the combine and simplify functions to manipulate temperature units, Maple returns a wrong answer, as we can see below;

combine(20*Unit(Unit('Celsius'))+30*Unit('K'), units)

50*Units:-Unit(K)

(1)

simplify(20*Unit(Unit('Celsius'))+30*Unit('K'))

50*Units:-Unit(K)

(2)

  The quantity 20 Celsius is not converted correctly. However, for other types of dimensions, the combine and simplify functions work correctly.

combine(10*Unit('m')+120*Unit('cm')+200*Unit('ft'), units)

(1804/25)*Units:-Unit(m)

(3)

simplify(10*Unit('m')+120*Unit('cm')+200*Unit('ft'))

(1804/25)*Units:-Unit(m)

(4)

``

Another strange thing happens with the convert function, with temperature units. When we use the same source unit, the convert function deletes the unit, leaving only the quantity.

convert(30*Unit('K'), temperature, Unit('K'))

30

(5)

 I do not understand why this occurs.

convert(10*Unit('m'), units, Unit('m'))

10*Units:-Unit(m)

(6)

I do not understand why this occurs.

 

Oliveira


 

Download Matching_units.mw

If I copy the output of a lprint command e.g.
lprint(<1,2;3,4>);

Matrix(2,2,{(1, 1) = 1, (1, 2) = 2, (2, 1) = 3, (2, 2) = 4},datatype = anything
,storage = rectangular,order = Fortran_order,shape = [])

and paste it in a new execution group, I obtain a "Line print output" instead of a Maple (1D) input,
so it cannot be executed.
(Of course, it's possible to paste in Notepad to remove the format, but it's annoying.)

This happens in Maple 2019,  Windows 64, Worksheet mode, 1D input;  but not all the time (sometimes it is as it used to be).
Do you see the same behavior?

 

Maple doesn't completely check the condition on the number of trials "n" for Binomial and NegativeBinomial distributions (package Statistics).
The attribute "Conditions" explicitely says that n must be a strictly positive integer but no strictly positive real valuereturna an error (ok, it would be stupid to set n to a non integer value !!!).

I think it is a default that ought to be corrected in future releases (this default still exists in Maple 2018)

 

restart

kernelopts(version)

`Maple 2015.2, APPLE UNIVERSAL OSX, Dec 20 2015, Build ID 1097895`

(1)

with(Statistics):


BINOMIAL DISTRIBUTION

X := RandomVariable(Binomial(n, p)):
L := [attributes(X)][3]:
A := exports(L)

Conditions, ParentName, Parameters, CDF, CharacteristicFunction, Kurtosis, Mean, Median, Mode, MGF, ProbabilityFunction, Skewness, Support, Variance, VariationCoefficient, CDFNumeric, QuantileNumeric, RandomSample, RandomSampleSetup, RandomVariate

(2)

L:-Conditions

[0 <= p, p <= 1, n::posint]

(3)

# Maple should return an error for N is not of type posint
#
# It seems that Sample uses floor(N)

N := 10.49; type(N::posint);
P := 1/2:
X := RandomVariable(Binomial(N, P)):
Mean(X), N*P;
ProbabilityFunction(X, k);
S := Sample(X, 10^6):
Mean(S);


# A non consistent result (only non negative values of k should be accepted)

eval(ProbabilityFunction(X, k), k=evalf(Pi));

N := 10.49

 

false

 

5.245000000, 5.245000000

 

piecewise(k < 0, 0, binomial(10.49, k)*(1/2)^k*(1/2)^(10.49-k))

 

HFloat(4.998903)

 

.1096019539

(4)


NEGATIVE BINOMIAL DISTRIBUTION

X := RandomVariable(NegativeBinomial(n, p)):
L := [attributes(X)][3]:
A := exports(L):
L:-Conditions

[0 < n, 0 < p, p <= 1]

(5)

N := 10.49:
P := 1/2:
X := RandomVariable(NegativeBinomial(N, P)):

Mean(X)


 

Download BinomialLaw.mw

 

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 :/.
Please help me.

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;

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 ;

Matrix(3, 3, {(1, 1) = sigma1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0})

(2)

eval(S_NEW,tau=0)

Matrix(3, 3, {(1, 1) = sigma1, (1, 2) = 0, (1, 3) = 0, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0})

(3)

 

 

 

Download problem.mw



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 ?.

Please find my source hereafter:

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

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)

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

Thanks for your answer,

Sincerely yours

Xavier

 

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):

ode:=2*x/y(x)-y(x)/(x^2+y(x)^2)+(-x^2/y(x)^2+x/(x^2+y(x)^2))*diff(y(x),x) = 0;
DEtools:-odeadvisor(ode);

2*x/y(x)-y(x)/(x^2+y(x)^2)+(-x^2/y(x)^2+x/(x^2+y(x)^2))*(diff(y(x), x)) = 0

[_exact, _rational]

dsolve(ode)

y(x) = x/tan(RootOf(-_Z+x*tan(_Z)+_C1))

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

2*x/y(x)-y(x)/(x^2+y(x)^2)+(-x^2/y(x)^2+x/(x^2+y(x)^2))*(D(y))(x) = 0

(2*x^3+2*x*y(x)^2-y(x)^2)*y(x)/(x*(x^3+x*y(x)^2-y(x)^2))

new_ode:=diff(y(x),x)=RHS;
DEtools:-odeadvisor(new_ode);

diff(y(x), x) = (2*x^3+2*x*y(x)^2-y(x)^2)*y(x)/(x*(x^3+x*y(x)^2-y(x)^2))

[_rational]

dsolve(new_ode)

_C1-arctanh((-2/(x^4*(1/y(x)^2+(x-1)/x^3)))^(1/2)*x/((-2*x+2)/(x^3*(1/y(x)^2+(x-1)/x^3))+2)^(1/2))+((-2*x+2)/(x^3*(1/y(x)^2+(x-1)/x^3))+2)^(1/2)/(-2/(x^4*(1/y(x)^2+(x-1)/x^3)))^(1/2) = 0

 


 

Download why_type_changed.mw


 

eq := solve({2*m-5 < 0, -3*m <= 5}, {m})

{-5/3 <= m, m < 5/2}

(1)

" implies result list m  in  `&Zopf;`, so m can m=0, m=1, m=2 and count=3"``

count := 0:

countt = 4

(2)

``

``

``

eq := solve({m-3 < 0, -m <= 6}, {m})

{-6 <= m, m < 3}

(3)

" implies result list m  in  `&Zopf;`, so m can m=-6, m=-5, m=-4, m=-3, m=-2, m=-1, m=0, m=1, m=2 and count=3"

count := 0:

countt = 9

(4)

``


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

Can you help me?

@acer

@Carl Love

Download help_list_integer_equation.mw

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

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(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t)*r*(1-P(t)/Nh)+P(t)*alpha*(Sv(t)+Iv(t))-q*P(t)*c

fcns := {Ih(t), Iv(t), L1(t), L2(t), L3(t), L4(t), L5(t), P(t), Sh(t), Sv(t)}; a := dsolve({eq1, eq10, eq2, eq3, eq4, 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

 

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

First 580 581 582 583 584 585 586 Last Page 582 of 2357