acer

32348 Reputation

29 Badges

19 years, 330 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

This is a very ambitious project for someone (ie. you) who is not well versed in how Maple's kernel and interfaces work and interoperate.

Since I am sure that you do not yet know how to properly and generally accomplish the described goal I've changed the parent from Post to Question. (I'm trying to be pragmatic here, and I truly intend no offense.)

This would be a good time to fully describe the requirements, e.g. what will the user see as input interface (the usual, or just a single reusable container)? Where will the output go? etc.

I have two prototypes of a general purpose Maple interface involving all input and output via 3 embedded components (input, output, and plotting). The purpose is to have something that works in the maplecloud or MaplePlayer. One of them also has a dynamic menu driven interface to the right click context menus.

Hence, if you tell me what user interface you're after then I may well be able to offer advice on the hurdles I know will appear. (Eg. managing the history of input and output assignments is desirable but heavy work.)

A more basic all round effect might be attainable, while keeping the usual worksheet flow, by replacing the kernel evaluator. I've had experience with that too.

But the detailed requirements are needed from you first.

@Adam Ledger This member (under one handle or another) has been posting here since long before your handle has actively posted here.

@asa12 Upload your complete code here if you expect us to work with it.

@Lali_miani See here for a list of books on Maple.

The first one listed, by Ian Thompson, is good and very reasonably priced.

An older book by Andre Heck is also good (it may not describe all modern features, but it laid out the basic concepts quite well).

Another good (but again slightly older) book is by Doug Meade et al.

 

 

Nobody wants to re-type your Matrices from images.

Upload a worsheet that contains the actual values for the Matrices or the complete code to reproduce them.

Code that contains, say,  close3(tt+Jesus[H][1,1]+i) without any code to evaluate that to a real constant value is of no use.

I had hoped to obtain the desired output display using a function call to Typesetting:-menclose with an argument something like notation="strikethrough", alongside other Typesetting calls.

But I have not been able to get a properly rendered display, with this approach.

@Christopher2222 If you upload it zipped somewhere then I would have a go with `vi`, a very strong editor.

I'm not sure that your editing methodology would be just the same as mine, wrt output removal.

If all else fails would you be ok with a version of the file that had all its output removed?

If so then you could upload it (here or somewhere), preferably zipped.

@vv  I stand by my comment.

The numeric  rank should enumerate how many singular values are greater than a tolerance times the largest singular value. That's not always equivalent to the number of nonzero singular values (including application of fnormal), which is generally not as adequate.

Btw, how does the computed result change for this example, as Digits gets gradually increased?

@dpaddy I agree -- the difficulties are not that hard to understand. The error message doesn't reveal the offending argument's value. The error message is also more generally incorrect because negative integers are in fact allowed.

A straightforword way to approach such problems is to apply the trace command to the problematic command name. Eg, trace(Bits:-GetBits) . That has the convenience of allowing you to toggle extra reporting on/off without having to rewrite your code or take a performance hit from the extra wrapping function call. However there seems to be a technical obstacle to this approach. Upon first execution the Bits:-GetBits command replaces itself with a procedure that calls external compiled code. The replacement procedure has option call_external, and apparently option trace doesn't work for a procedure which also has option call_external. So only the first call gets its details reported.

@assma Does this work for you in Maple 18?

restart;

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

f := proc(x, y) options operator, arrow; sin(x)*cos(y) end proc:

Psurf:=plot3d(f, -Pi..Pi, -Pi..Pi, style=surface,

              colorscheme=["zgradient", ["Orange","Blue"]]):

Pcont2D_1:=plots:-contourplot(f, -Pi..Pi, -Pi..Pi,

                              coloring=["Orange","Blue"],
                              style=line):

Proj:=plottools:-transform((a,b)->[a,b,-1]):

plots:-display(

  Psurf,

  Proj(Pcont2D_1)

);

 

Download surf_proj_contours_M1802.mw

@deniscr 

Do you mean that the elements of C and M are not numeric? If so then perhaps could you generate a Matrix U with names in it (using the symbol option to the Matrix constructor), then Equate U^%T.C.U to M, and call eliminate (or maybe solve)?

Providing us with the full example might help.

Here's a simple example. Note that the [2,2] entry of solutions for U may be free (arbitrary) for this particular example, but U[2,2] appears in the formulas for the other elements of U.

restart;

C:=Matrix([[t^2,t^3],[t^3,sin(t)]]);

_rtable[18446884112552558710]

M:=Matrix([[a,b],[c,d]]);

_rtable[18446884112552562550]

U:=Matrix(2,symbol=u);

_rtable[18446884112434897974]

eqns:=Equate(U^%T . C . U, M);

[(t^3*u[2, 1]+t^2*u[1, 1])*u[1, 1]+(u[1, 1]*t^3+u[2, 1]*sin(t))*u[2, 1] = a, (t^3*u[2, 1]+t^2*u[1, 1])*u[1, 2]+(u[1, 1]*t^3+u[2, 1]*sin(t))*u[2, 2] = b, (t^3*u[2, 2]+t^2*u[1, 2])*u[1, 1]+(u[1, 2]*t^3+u[2, 2]*sin(t))*u[2, 1] = c, (t^3*u[2, 2]+t^2*u[1, 2])*u[1, 2]+(u[1, 2]*t^3+u[2, 2]*sin(t))*u[2, 2] = d]

sol:=simplify([eliminate(eqns, indets(U,name))]):

nops(sol);

4

for i from 1 to nops(sol) do
  print(i);
  Usol[i]:=eval(U,sol[i,1]);
  res:=simplify( Usol[i]^%T . C . Usol[i] - M );
  conditions[i]:=remove(u->is(rhs(u)=lhs(u)),
                        simplify({Equate(res,Matrix(2))[]})
                        union map(`=`,sol[i,2],0));
  print(sprintf("conditions on Usol[%a]",i),conditions[i]);
end do:

1

"conditions on Usol[1]", {b-c = 0}

2

"conditions on Usol[2]", {b-c = 0}

3

"conditions on Usol[3]", {b-c = 0}

4

"conditions on Usol[4]", {b-c = 0}

Usol[1], conditions[1];

Matrix(2, 2, {(1, 1) = ((-sqrt(t^4*u[2, 2]^2-sin(t)*u[2, 2]^2+d)*t^2+u[2, 2]*(t^4-sin(t)))*sqrt(-(a*d-b^2)*((-2*t^4*u[2, 2]^2-d)*sin(t)-cos(t)^2*u[2, 2]^2+(t^8+1)*u[2, 2]^2+d*t^4))+(-t^2*u[2, 2]*(t^4-sin(t))*sqrt(t^4*u[2, 2]^2-sin(t)*u[2, 2]^2+d)+(-2*t^4*u[2, 2]^2-d)*sin(t)+t^8*u[2, 2]^2+d*t^4-cos(t)^2*u[2, 2]^2+u[2, 2]^2)*b)/(sqrt(t^4*u[2, 2]^2-sin(t)*u[2, 2]^2+d)*d*t*(t^4-sin(t))), (1, 2) = (-t^2*u[2, 2]+sqrt(t^4*u[2, 2]^2-sin(t)*u[2, 2]^2+d))/t, (2, 1) = (b*t^4*u[2, 2]-b*sin(t)*u[2, 2]+sqrt(-(a*d-b^2)*((-2*t^4*u[2, 2]^2-d)*sin(t)-cos(t)^2*u[2, 2]^2+(t^8+1)*u[2, 2]^2+d*t^4)))/(d*(t^4-sin(t))), (2, 2) = u[2, 2]}), {b-c = 0}

simplify( Usol[1]^%T . C . Usol[1] - M );

_rtable[18446884112179336006]

 

Download mateqnsolve.mw

@K SIVA THEJA 

I'm not sure what you mean.

Maple doesn't interpret a column Vector the same as an n-by-1 Matrix, nor a row Vector the same as a 1-by-n Matrix. In part this makes a mathematical distinction between members of Vector spaces and mappings between them.

And it distinguishes even between a single-element row Vector and a single-element column Vector. The default is a column Vector.

(You can argue that such behavior is not the best design, if you want. Other products may behave differently.)

And I wouldn't be surprised if there are buggy cases too.

Note the distinction of using OuterProductMatrix.

I can also mention that you didn't state what you meant by Vector-Vector multiplication. And the title of your Question is "VECTOR/MATRIX MULTIPLICATION" but your example contains just two Vectors and no Matrix. And it's not clear if you are looking for an inner product or an outer product.

B := Vector[column]([2,3]);

_rtable[18446884287804698982]

Bm := Matrix([[2],[3]]);

_rtable[18446884287804700542]

C := Vector[column]([4]);

_rtable[18446884287804701622]

B . C;

Error, (in LinearAlgebra:-DotProduct) vectors must have the same dimension

Bm . C;

_rtable[18446884287804702462]

 

Download MV.mw

@das1404 All Comments, Questions, and Posts on this site are public. You don't have to log in to view them.

Putting in a token link such as @das1404  into a response merely lets the reader know which previous Comment/Question you're addressing, and which member wrote it. Doing that doesn't cause the system to send a private message or email. (This site has a separate mechanism for sending a private message. And members get email notifications when threads in which they are active get additional content, but only if they set a Preference on their account.)

I'll try and check out your latest attachment, if nobody else fixes it up for you. But likely not before the weekend, sorry, I'm just too busy right now.

First 256 257 258 259 260 261 262 Last Page 258 of 592