dpaddy

99 Reputation

7 Badges

16 years, 251 days

MaplePrimes Activity


These are questions asked by dpaddy

The set and list produced by map (see below) contain duplicates.  How to remove duplicates?
 

p := (1+5^(1/2))*(1/2)

1/2+(1/2)*5^(1/2)

(1)

with(Bits)

[And, FirstNonzeroBit, GetBits, Iff, Implies, Join, Nand, Nor, Not, Or, Settings, Split, String, Xor]

(2)

with(LinearAlgebra)

[`&x`, Add, Adjoint, BackwardSubstitute, BandMatrix, Basis, BezoutMatrix, BidiagonalForm, BilinearForm, CARE, CharacteristicMatrix, CharacteristicPolynomial, Column, ColumnDimension, ColumnOperation, ColumnSpace, CompanionMatrix, CompressedSparseForm, ConditionNumber, ConstantMatrix, ConstantVector, Copy, CreatePermutation, CrossProduct, DARE, DeleteColumn, DeleteRow, Determinant, Diagonal, DiagonalMatrix, Dimension, Dimensions, DotProduct, EigenConditionNumbers, Eigenvalues, Eigenvectors, Equal, ForwardSubstitute, FrobeniusForm, FromCompressedSparseForm, FromSplitForm, GaussianElimination, GenerateEquations, GenerateMatrix, Generic, GetResultDataType, GetResultShape, GivensRotationMatrix, GramSchmidt, HankelMatrix, HermiteForm, HermitianTranspose, HessenbergForm, HilbertMatrix, HouseholderMatrix, IdentityMatrix, IntersectionBasis, IsDefinite, IsOrthogonal, IsSimilar, IsUnitary, JordanBlockMatrix, JordanForm, KroneckerProduct, LA_Main, LUDecomposition, LeastSquares, LinearSolve, LyapunovSolve, Map, Map2, MatrixAdd, MatrixExponential, MatrixFunction, MatrixInverse, MatrixMatrixMultiply, MatrixNorm, MatrixPower, MatrixScalarMultiply, MatrixVectorMultiply, MinimalPolynomial, Minor, Modular, Multiply, NoUserValue, Norm, Normalize, NullSpace, OuterProductMatrix, Permanent, Pivot, PopovForm, ProjectionMatrix, QRDecomposition, RandomMatrix, RandomVector, Rank, RationalCanonicalForm, ReducedRowEchelonForm, Row, RowDimension, RowOperation, RowSpace, ScalarMatrix, ScalarMultiply, ScalarVector, SchurForm, SingularValues, SmithForm, SplitForm, StronglyConnectedBlocks, SubMatrix, SubVector, SumBasis, SylvesterMatrix, SylvesterSolve, ToeplitzMatrix, Trace, Transpose, TridiagonalForm, UnitVector, VandermondeMatrix, VectorAdd, VectorAngle, VectorMatrixMultiply, VectorNorm, VectorScalarMultiply, ZeroMatrix, ZeroVector, Zip]

(3)

with(VectorCalculus)

[`&x`, `*`, `+`, `-`, `.`, `<,>`, `<|>`, About, AddCoordinates, ArcLength, BasisFormat, Binormal, Compatibility, ConvertVector, CrossProduct, Curl, Curvature, D, Del, DirectionalDiff, Divergence, DotProduct, Flux, GetCoordinateParameters, GetCoordinates, GetNames, GetPVDescription, GetRootPoint, GetSpace, Gradient, Hessian, IsPositionVector, IsRootedVector, IsVectorField, Jacobian, Laplacian, LineInt, MapToBasis, Nabla, Norm, Normalize, PathInt, PlotPositionVector, PlotVector, PositionVector, PrincipalNormal, RadiusOfCurvature, RootedVector, ScalarPotential, SetCoordinateParameters, SetCoordinates, SpaceCurve, SurfaceInt, TNBFrame, Tangent, TangentLine, TangentPlane, TangentVector, Torsion, Vector, VectorField, VectorPotential, VectorSpace, Wronskian, diff, eval, evalVF, int, limit, series]

(4)

b := proc (x, w) options operator, arrow; (-1)^GetBits(x, w, output = number) end proc

proc (x, w) options operator, arrow; (-1)^Bits:-GetBits(x, w, output = number) end proc

(5)

l := proc (x, t, u, v) options operator, arrow; frac(x)*Vector([b(floor(x), 0)*t, b(floor(x), 1)*u, b(floor(x), 2)*v])+(1-frac(x))*Vector([b(floor(x), 0)*v, b(floor(x), 1)*t, b(floor(x), 2)*u]) end proc

proc (x, t, u, v) options operator, arrow; VectorCalculus:-`+`(VectorCalculus:-`*`(frac(x), VectorCalculus:-Vector([VectorCalculus:-`*`(b(floor(x), 0), t), VectorCalculus:-`*`(b(floor(x), 1), u), VectorCalculus:-`*`(b(floor(x), 2), v)])), VectorCalculus:-`*`(VectorCalculus:-`+`(1, VectorCalculus:-`-`(frac(x))), VectorCalculus:-Vector([VectorCalculus:-`*`(b(floor(x), 0), v), VectorCalculus:-`*`(b(floor(x), 1), t), VectorCalculus:-`*`(b(floor(x), 2), u)]))) end proc

(6)

map(l, {0, 1, 2, 3, 4, 5, 6, 7, 8}, 0, 1, p)

{Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian])}

(7)

map(l, [0, 1, 2, 3, 4, 5, 6, 7, 8], 0, 1, p)

[Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian])]

(8)

q := ListTools:-MakeUnique(%)

q := [Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian])]

(9)

Equal(q[1], q[9])

true

(10)

qq := [op({q[]})]

qq := [Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = -1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = -1/2-(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian]), Vector(3, {(1) = 1/2+(1/2)*5^(1/2), (2) = 0, (3) = 1}, attributes = [coords = cartesian])]

(11)

LinearAlgebra:-Equal(qq[1], qq[5])

true

(12)

NULL


 

Download cp.mw

I get the following message:

"Error, (in Bits:-GetBits) argument 1, the number, must be a nonnegative integer"

Presumably "argument 1" does not mean that the offending argument is 1 (the problem is that the offending argument "must be a nonnegative integer", but 1 is a nonnegative integer).  So how do I get maple to report what the offending argument is? 

 

I would like to plot h over the real interval from 0 to 2*Pi, but

produces an empty plot...  How can I plot successfully?

If I enter the following I do not get the residue... how do I make the residue command work?

 

I can't cut and paste from my maple worksheet (because syntax somehow gets changed in the process), so perhaps the following attempt at carefully worded  prose will do (alternately, please someone tell me how to attach screen shots).  Here goes...

I execute

The optimization succeeds and the assignment takes place.  The result is what I'ld like to cut and paste so youall can see...  it looks as follows. 'r:=' (but no quotes)  followed by open square bracket, then a number, then a comma, then another open square bracket, then a vertically arranged list of stuff, then two close brackets.  I presume the vertically arranged stuff in the innermost matching square brackets somehow represents the point in the search space where the minimum takes place, and the minimum is the number that follows the first square bracket and is before the comma.  My goal is to write to disk the the point in the search space where the minimum takes place (I suppose that vector is in some sense r[2]) .  My attempt to write it to disk is

ExportMatrix("maple.txt", r[2], target = auto)

but maple complains

ExportMatrix("maple.txt", r, target = auto);
Error, invalid input: ExportMatrix expects its 2nd argument, M, to be of type {Matrix, list(Matrix)}, but received [293148935266.099426, Vector(28, {(1) = -233674.34818878854, (2) = 12.62636610207248, (3) = 0.3337043409389546e-2, (4) = 0.13303915611938133e-1, (5) = .0, (6) = .2589485687872699, (7) = 0.9341600279762804e-1, (8) = 0.3293862590239189e-1, (9) = 0.12892649003200331e-1, (10) = 0.606528143324688e-1, (11) = 0.17524827222051658e-1, (12) = -0.16059611469561555e-17, (13) = 0.621465506367271e-1, (14) = .29826235341855, (15) = -0.16288776533795546e-17, (16) = 0.15301368661023716e-1, (17) = 0.1529933711903137e-18, (18) = 0.4375115591744606...

How can I write the result of optimization to disk as a plain ascii text file (tsv format)?

Thanks

 

 

1 2 3 Page 1 of 3