acer

32405 Reputation

29 Badges

19 years, 345 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

If you want to see the module definition "shell" then you can still get that printed by querying for the 2nd operand of the module.

op(2,eval(sqrt));

      module() local ModuleApply, Nested, Product, Primes; end module

The above was done in Maple 2015.1, and is also what Maple 18.02's Standard GUI prints when eval(sqrt) is called.

acer

You seem to have used "basis" in two ways. At the end you mention a basis {C}, apparently in the mathematic sense. At the beginning you mentioned the A,B,C,D for a "basis" for your computations, apparently using the term in a non-technical sense. The inconsistency may confuse some people.

I'll use DD rather than D which is a protect Maple name with special meaning as the differential operator.

If you want to express the Matrix A+B in terms of the "basis" of Matrices {C,DD} then you can turn everything into column Vectors, concatenate the new column-Vector elements of your "basis" into a Matrix, and use LinearSolve.

Note that {C} or {C,DD} aren't enough to form a basis for the 4-dimensional space that spans the space. So for some candidate Matrix other that the Matrix A+B your set {C,DD} might not suffice.

Taking your trivial example,

restart:                                                       

DD:=Matrix(2,symbol=d):                                        
C:=Matrix([[i,i],[-i,i]]):                                     

A:=Matrix([[1,0],[0,1]]):                                      
B:=Matrix([[0,1],[-1,0]]):                                     

with(LinearAlgebra):                                           

f:=m->convert(m,Vector[column]):                               

sol:=LinearSolve(<f(C)|f(DD)>,f(A+B)):                         

A+B=add(`if`(sol[j]=0, 0, sol[j].[C,DD][j]), j=1..Dimension(sol));

                         [ 1    1]           [i     i]
                         [       ] = (1/i) . [       ]
                         [-1    1]           [-i    i]

In other words the problem solved above is to express A+B as a linear combination of the entries of {C,DD}. (...and the solution of that might be done using 4x1 column vectors rather than 2x2 Matrices.) Is that close to what you want? For other examples you might need to use values rather than just symbols for the entries of Matrix DD. In your trivial example is turns out not to have mattered...

You can change the above example to have C = Matrix([[0,i],[-i,0]]) instead, and then use f(A.B) instead of f(A+B) in the call to LinearSolve. The result of coefficients, sol, would happen to be the same.

acer

Fun := Diff(f(x), x):           

int(Fun, x = 2 .. 7, continuous);

                                 -f(2) + f(7)

acer

If you assign that expression to a name, say ee, then try,

simplify(ee, size)

acer

A call to fsolve with multivariate input returns unevaluated if it cannot find a solution. But as a numeric approach it may not be attempting to prove analytically that there is no solution, so the unevaluated return means only that it could not find one. In the general (including the nonpolynomial case) it may be that there is a solution which was not found, and thus it would be wrong for a routine that merely searches to return a result (such as NULL) and convey the impression that there definitely is no solution.

Checking whether the result is of type 'specfunc(anything,fsolve)' is an ok way to ascertain whether a solution was found. But note that if done at the top-level (outside of a procedure) then the assigned result should be wrapped in eval(...,1) as the first argument to type, if you wish to avoid a recomputation. See here for a post about that, and note Joe Riel's comment.

For such a system of polynomials with real, numeric coefficients you might consider using RootFinding:-Isolate if you wish to find all real roots and also to get an empty list in the case that it ascertains that none exist.

acer

If m1 is a Matrix then,

F,C := LinearAlgebra:-Dimensions(m1)

or,

F,C := op(1,m1)

acer

If I've understood you properly,

restart:
with(plots):
animate(plot3d,[sqrt(h),theta=-t..0,h=0..4,coords=cylindrical],t=0..2*Pi,
                orientation=[-63,-24,-51],style=surface,title="");

restart:
with(plots):
display(seq(plot3d(sqrt(h),theta=-t*2*Pi..0,h=0..4,coords=cylindrical),t=0..1,1/25),
        orientation=[-63,-24,-51],style=surface,insequence=true);

acer

Digits set to 4 means that floating-point computations are performed with 4 digits of working precision. It does not mean (either with or without rounding) that results in general will attain 4 correct places.

acer

T := table(["green" = "gruen", "red" = "rot", "blue" = "blau"]):

assigned(T["asdf"]);

                                    false

assigned(T["green"]);

                                    true

acer

If you have assigned your original inert integral of a piecewise to the name K, then you could do,

value(K) assuming continuous:
simplify(%) assuming T2>T1;

acer

Inspired by Rouben's very nice explanation, the result can be demonstrated via computation alone.

(The introduced values assigned to `a` and `bT` are inspired by RR's visual and verbal explanation, yet while not a recipe to solve all similar problems the following does comprise a fully computational result, FWIW.)


restart:

J := Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1);

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1)

s := solve(op(1,J));

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

# J = J1 + c

J1,c := op(simplify(IntegrationTools:-Split(J,s))):
J = J1 + c;

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = Int(-x+(-x^5+1)^(1/5), x = 0 .. (1/2)*2^(4/5))+Int(x-(-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

a := Int(s-x,x=0..s):

# J1 = a + b , hence J = a + b + c

b := IntegrationTools:-Combine(J1-a):
J1 = a + b;

Int(-x+(-x^5+1)^(1/5), x = 0 .. (1/2)*2^(4/5)) = Int((1/2)*2^(4/5)-x, x = 0 .. (1/2)*2^(4/5))+(1/2)*(Int(2*(-x^5+1)^(1/5)-2^(4/5), x = 0 .. (1/2)*2^(4/5)))

bT := Int((-x^5+1)^(1/5),x = 1/2*2^(4/5) .. 1);

# Demonstrate that bT = b , hence J = a + bT + c
# This shows that bT = b, though it might also serve
# to obtain bT from b, via a change of variables.

value(combine(bT-student[changevar](x=y^(1/5),

                   (student[changevar](y=(1-x^5),b,y)),x)));

Int((-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

0

# Transform aT = a , hence J = aT + bT + c

aT := student[changevar](x=y,student[changevar](y=s-x,a,y),x);

Int(x, x = 0 .. (1/2)*2^(4/5))

J = aT + bT + c;
value(combine(%));

Int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = Int(x, x = 0 .. (1/2)*2^(4/5))+Int((-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)+Int(x-(-x^5+1)^(1/5), x = (1/2)*2^(4/5) .. 1)

int(abs(x-(-x^5+1)^(1/5)), x = 0 .. 1) = 1/2

 


Download rr.mw

acer

Using Maple 2015.1 and its Import command, letters can be imported from the STL 3D format.

restart:

#
# One (of many) STL format collections of the English alphabet:
#     http://www.stlfinder.com/model/all-alphabet-letters-a-z
#
basedir:=cat(kernelopts(homedir), "/My Documents/stl/All_Alphabet_Letters_A-Z"):

getletter:=L->Import(cat(basedir, "/Letter_", L, ".stl"),
                     orientation=[-90,0,0],title=""):

letters := [m,a,p,l,e]:

for letter in letters do
  if not assigned(AZ[letter]) then
    AZ[letter]:=getletter(letter);
  end if;
end do:

with(plottools): with(plots):

Rplot:=display(AZ[letters[1]],
               seq(translate(AZ[letters[i]], 40*(i-1)+15, 0, 0),
                   i=2..nops(letters))):

Rplot:=transform((x,y,z)->[z,x,y])(scale(Rplot, 5/6*2*Pi/200, 1/5, 1/20, [0,0,10])):

display(changecoords(Rplot,cylindrical), scaling=constrained, axes=none,
        orientation=[0,90,0], viewpoint=[circleright], frames=50);

acer

The first variant given on your cited link, with the writing on an opaque surface, is demonstrated below.

restart:
with(plots): with(ImageTools):
fn:=cat(kernelopts(homedir),"/mma.bmp"):
p:=display(textplot([0,1,"Mathematica",font=["times","roman",50]]),
           axes=none,scaling=constrained):
plotsetup(bmp,plotoutput=fn);
display(p);
plotsetup(default);
img:=Scale(Read(fn),1..250,1..250):
P3D:=plot3d(1, theta=0..2*Pi, h=0..Pi, image=img, coords=cylindrical,
            view=1.2..1.9, orientation=[0,90,0], axes=none,
            viewpoint=["circleright", frames=30]):
P3D;

Just like a usual animated Maple plot, you can single left-click on the plot, and then from the main menubar you could bump up the frame rate, and toggle loop, and play it.

If a non-rectilinear 3D projection effect is desired then a custom viewpoint formula or (more likely) a sequence of orientations is possible, instead of the simple circleright viewpoint.

acer

If the x and y (ie, the x_i) only appear in that way (as polynomial coefficients, say) then could you not simply evaluate the Matrix at [x_1=1,...x_n=1]?

M:=Matrix([[a*x, -b*y],[c*x^2, -d*y]]);

                                   [a x   -b y]
                                   [          ]
                              M := [   2      ]
                                   [c x   -d y]

eval(M, [x=1,y=1]);

                                   [a  -b]
                                   [     ]
                                   [c  -d]

acer

Use add rather than sum for such finite, definite summation. 

The problem you saw is that V[i] with an unassigned symbolic index i is not allowed for the kind of data structure associated with a DataTable.

For the sum command Maple evaluates the first argument up front, and baulks as V[i]. The add command has special evaluation rules (to delay the evaluation) and so Maple doesn't then evaluate V[i] until i gets a value.

Another way is to use unevaluation single right quotes, to delay the evaluation. Eg,

sum('V[i]', i=1..10);

acer

First 225 226 227 228 229 230 231 Last Page 227 of 336