tomleslie

13876 Reputation

20 Badges

15 years, 174 days

MaplePrimes Activity


These are answers submitted by tomleslie

use MatrixPower, as in

A:=<5,4;4,5>;
B:=LinearAlgebra:-MatrixPower(A, 1/2);
B.B

As far as I know, Maple does not have this kind of conditional formatting

The 'symbol' represented by the capital letter 'O' (that's the letter between 'N' and 'P') merely indicates the order of the 'next' term in the series. See the help at ?series

For any use of the series() command, you can control how many terms are returned by supplying a third argument. So examine what happens, with

series(x/(-x2-x+1), x = 0, 6)

series(x/(-x2-x+1), x = 0, 7)

series(x/(-x2-x+1), x = 0, 8)

EAch of the above wll generate an extra term, and the power of 'x'; int the final order term (ie the O() bit will increase)

You can remove this final 'order' term from any generated series, by using convert(.., polynom). Contrast

series(x/(-x2-x+1), x = 0, 6) with

convert( series(x/(-x2-x+1), x = 0, 6), polynom)

can be computed with

   restart:
   with(LinearAlgebra):
   vv:= Vector(3, symbol=v);
#
# Get the Euclidean norm: note that
# Maple allows for the fact that
# vector elements may be complex
#
   Norm(vv,2);
#
# Compute the weighted norm, with the
# weights contained in an appropriate
# (diagonal) matrix
#
   cc:=Matrix(3,3, symbol=c, shape=diagonal):
   sqrt(abs~(Transpose(vv)).cc.abs~(vv));

Not sure I know what the weighted norm of a matrix is - do you have a defintion?

The attached worksheet will

  1. Evaluate the integral over any range lowlim <= E <= hilim, where lowlim >0. (integrand is singular at E=0).
  2. Plot the integrand over the range lowlim <= E <= hilim, where lowlim >0.

One of these may be what you want???

intProb.mw

Time series data is (implicitly) two-dimensional - ie it is a sequence of values spaced by some time function (which may be anything from nanoSeconds to centuries). A contour represents points of equal value in a three-dimensional surface - hence requesting a contour of two-dimensional data is simply meaningless

Curvature is a function of a "curve". A list/sequence of points is not a curve: hence requesting the curvature of such data is also meaningless. It is possible to interpolate a function fitting such data (eg using CurveFitting) and then compute the curvature of the interpolant. Maybe this is what is required?

vv's answer is almost certainly the best - but I think it is overkill

If one uses showstat(`convert/elsymfun`), one gets

[deleted as violation of Mapleprimes terms of use: copyright violation]

then the reason for the problem is pretty obvious - the line vars:=indets(p). However it is pretty trivial to produce a version of this procedure which accepts the set of variables as an argument, with an appropriate change to the line vars:=indets(p), as in

convElsymfun:= proc(p::polynom, z)
                                      local vars, n, x, i, p1, p2, v, ss, r;
                                      vars := z;
                                      if    type(p,(':-symmfunc')(op(vars))) then
                                            n := nops(vars);
                                            p1 := x^n+add(s || i*x^(n-i),i = 1 .. n);
                                            p2 := mul(x+v,v = vars);
                                            match(p2 = p1,x,'ss');
                                            r := map(u -> subsop(1 = rhs(u),2 = lhs(u),u),ss);
                                            subs(ss,sort(`simplify/nosize`(expand(p),r)))
                                     else
                                            error "polynomial is not symmetric"
                                     end if
                            end proc:

then

convElsymfun( a*(x+y) + b*(x^2+y^2) + a*b*(x^3+y^3), {x,y});

will return

a*b*(x+y)^3-3*a*b*(x+y)*x*y+b*(x+y)^2+a*(x+y)-2*b*x*y

The rand() command only works with floating-point ranges (eg -0.5..0.5) from Maple 2015 onwards. Hence ThU's response is correct if you are running Maple 2015, 2016 or 2017 - but anything earlier will generate the error message which the OP reports, ie

Error, invalid input: rand expects its first argument, r,  to be of the type {posint, integer..integer} but received -.5 .. .5

For Maple versions, prior to Maple 2015, then the correct approach is that given in gkokovidis response. I personally would simplify this slightly by generating a procedure for the random number generation, using the 'makeproc' option, as in

restart;
with(RandomTools):
r:= Generate(float(range=-0.5..0.5), makeproc=true):
randNums:=[seq( r(), j=1..100)];

Note that re-executing the above  multiple times will always lead to the *same* list of random numbers, because the same 'seed' is used for the generation.This is often useful for debug purposes, but also may not be considered "completely" random. After all, if you can repeatedly generate the same list of numbers - are they random?

This issue can be circumvented (as gkokovidis has done) by using the randomize() command. This controls the 'seed'  being used in all subsequent random number generation processes, and means that repeated executions of the code will generate a diffferent list of random numbers each time

restart:
with(RandomTools):
randomize():
r:=Generate(float(range=-0.5..0.5), makeproc=true):
randNums:=[seq(r(),i=1..100)];

 

For some reason, E8 is not evaluating in the same way as other execution groups (you selected inert input perhaps?). Hence you end up with a zero row in your matrix, hence the determinant is zero, and so on.

If I select the E8 execution group, and use "Convert to 2D Math Input", then everything seems to work. (I did comment out your Digits:=200 requirement, just to make the output easier to read - set it back anything if you need/want.

See the attached

detProb.mw

I'd be a little nervous about using names such as _C1, _C2, in a system of differential equations, I plan to solve - and this is essentially what you are doing at the second stage of yor description

So far as I am aware, there is no way to change how Maple names constants when using dsolve/pdsolve

However it is relatively easy to rename all such constants.

Given a system of differential equations and a set of solutions, any 'name' which occurs in the latter but not in the former, must be a constant which occurred during the solution process. It is therefore relatively easy to substitute for them. Consider the "toy" example

   sys1 := [diff(x(t),t) = y(t), diff(y(t),t) = -x(t)];
   sol1 := dsolve(sys1);
#
# Get all 'names' which appear in the solution
# but don't appear in the ODE system - in the
# absence of arbitrary functions, these will
# be 'constants'
#
   cts:=indets(sol1,name) minus indets(sys1, name);
#
# Substitute a new name for each of the constants

# in the solution obtained
#
  subs( seq( cts[j]=cat(K,j), j=1..numelems(cts)), sol1);

Generally speaking the cts command above will return "constants" in lexicographic order, with integration constants, preceding variable separation constants - so {_C1, _C2,...._c1, _c2}. These will be replaced by {K1, K2, K3.....}, and the distinction between the two 'types' of constant will be lost

 

is to specify the plot range, as in

f:= x-> 2*sin(0.5e-1*Pi*x+(-1)*Pi*.5)+2:
plot(f, 0 .. 40);

Otherwise, Maple just "guesses" a horizontal range

 

  1. So, since you post pictures rather than plaintext/code, I have to retype everything. NOT GOOD! The more I have to retype, the more likely I am to get something wrong:-(
  2. You have "downloaded" a "package" which converts your "data" into a plot. But you do not specify what this package is, where it comes from, what code it contains, or what calculations it performs on your "data" (or indeed anything useful at all). So I actually have to GUESS the calculations which are performed to produce the plot. you want. Again NOT A GOOD IDEA, because I am not psychic
  3. Having said the above, the attached may provide what you want - just bear in mind that to produce it, I had to make a lot of GUESSES, and any one of these might be wrong

pwlProb.mw

The backslash '\' within a string is interpreted as an escape character.

So, for example if you wanted the string containing the double-quote character, you would use "\"".

Similarly if you want a string containing a single backslash character, then you need "\\"

Running 64-bit Maple 2017.1 on 64-bit Windows 7 Home Premium,

  1. CTRL+F4 does what I would expect
  2. ALT+F4 does what I would expect
  3. Desktop icons don't move

 :-(

There is no way to do this.
It is however relatively simple to check how well the data fits a given distribution. A simple example is given in the attached.

dataFit.mw

It would be reasonably simple to extend this to use several different pdfs. You could then pick the one with the smallest residual error

First 160 161 162 163 164 165 166 Last Page 162 of 207