tomleslie

13876 Reputation

20 Badges

15 years, 165 days

MaplePrimes Activity


These are replies submitted by tomleslie

@acer 

At least according to emacs (and notepad++)

@yellowcanary 

You have to decide what makes a particular plot clear. This is a question of aesthetics - you and I may differ on what we thimk makes a plot clear and informative

I suggest you type

?Maple Plotting Guide

at the command prompt, for an overview of basic plot types available and

?plot3D/options

for a list of the options which might be applied: this is a very long list, but make sure you don't miss lot3d/colorfunc)

 

@acer 

and that is upposed to quick/efficient?? As in people actually do this?

@Kitonum 

Lots of list/set conversion - why?

with(LinearAlgebra):
M:=RandomMatrix(8,12);
MM:=M[..,[1..2, 4..6, 8..12]]

will generate a matrix conataining colums 1,2,4,5,6,6,9,10,11,12.

Another required column sequence is rather obvious from the above

Like much modern software Maple comes with something caled a help facility. Seaching for trapezoidal or simpson took me all of 5seconds before I came up with a very useful help page which you can obtain by pasting

?Student[Calculus1][ApproximateInt];

at a Maple prompt.

On this help page, note carefully the method option, which you can specify to be either trapezoid or Simpson, or a few other interesting alternatives.

The examples in this help page can be cut/pasted to your own worksheet - all you really have to do is enter your own integrand

@Boby 

The Maple code you supply is working correctly: in other words it is producing the correct answers for the questions you are asking. The only conclusion I can draw is that you are asking the wrong questions!!

It is often difficult to come up with answers to posted questions, but even more difficult when the questions are incorrect - becuase then I have to guess whaat you might want, and I'm really bad at guessing.

See the attached for some indication on what still looks a bit weird about your code (not necessarily wrong, just weird). Please read the comments carefully

HPM_4corr2.mw

@EugeneKalentev 

The OP's original question was solved by my original response (a solution which you have reproduced). I have no doubt at all that if I had chosen to writw the code in 2-D math input then I would have achieved an identical solution.

However the OP's remaining question appears to be how to enter the original equation in an efficient method, using 2-D math, palettes, keyboard shortcuts etc.

Since I only ever use 1D-input I was unable to help. Perhaps you could clarify the "efficient" method of entering the original equation using 2D-input and explain why it is better/faster/whatever than my original 1D input repeated here as

eq:=m*diff(x(t),t,t)=-k*x(t)-b*diff(x(t),t);
dsolve(eq, x(t));

which is succinct, efficient (count the keystrokes) and works

@Edo Karura 

I never use 2D math input, and I never use palettes - too slow, too error-prone

But - even in 2-D math input, you can just type diff(x(t), t, t). The input won't "prettyprint", but it will work as you expect (and is probably quicker than using palettes)

I sort of assume that there are keyboard shortcuts somewhere for palette entries??

@Mac Dude 

Sometimes I attempt to produce code "as close as possible" to the OP's original, whether or not I think the original code is neat/tidy/efficient whatever. My reasoning is that the OP will then more readily appreciate/understand the result.

If I were doing this problem from scratch, then my solution would look like

restart;
dA:= n -> Array( 1..n,
                          1..n,
                          1..n,
                          (i, j, s) -> sum( alpha*gamma[i,j]^t*d[s,t]
                                                  -
                                                  beta*d[t,i]*gamma[t,j]^s
                                                  -
                                                  gamma*d[t,j]*gamma[i,t]^s,
                                                  t=1..n
                                               )
                      ):


followed by

eqs:=dA(2);

or

eqs:=dA(3)

depending on the "order" of the system I wished to produce.

In fact I probably wouldn't do it quite this way, because the existence of the name gamma as both an indexed and an unindexed variable in the defining equations makes me nervous (as I stated in my original post)

@Mac Dude 

Whilst you are correct that D is a protected name, the assignment in my original code works, because D is declared to be local - however I accept it is "bad practice" ever to assign to D. My only excuse was that I was focussed on transcribing the OP's original code and overlooked this issue

Since OP wants three indices, I think (s)he is stuck with using a table

 

OP

I have modified the original code to

  1. change the assignment to D for the above reason, and
  2. by declaring the table as a global have made accessing its entries somewhat easier

I have tried to make the equations correspond to those in your original post, but I am not prepared to guarantee it, too much typing, so you will have to check!

See the attached.

eqTable.mw

 

@yellowcanary 

Don't understand this question at all

I have so many problems with the syntax of your code that I think a sensible response is not possible. Since you do not post code, but rather a picture of code, you are making it difficult to figure out what you might want. To give an example of things whihc just "look" seriously wrong -

you have an indexexed variable gamma[i,j] whihc is multiplied by the unindexed gamma - so you are multiplying a matrix(?), by one of its entries - right??? So this term in your expression will be a matrix(?). Which I guess would be fine if alpha and beta are commensurate matrices - are they???

On a purely formal basis, if you want to generate a set of (probably meaningless) expressions, then the following ought to work

DerA:= proc(n)
            local D, i, j, t, s:
            for i from 1 by 1 to n do
                for j from 1 by 1 to n do
                    for s from 1 by 1 to n do
                        D[i,j,s]:= sum( alpha*gamma[i,j]^t*d[s,t]
                                        -
                                        beta*d[t,i]*gamma[t,j]^s
                                        -
                                        gamma*d[t,j]*gamma[i,t]^s,
                                        t=1..n
                                      );
                    od:
                od:
            od:
            return D:
       end proc:

Then Dera(3) will return a table of 27 expressions: but beware, alpha, beta, gamma, d are unknown variables of unknown types, so whether or not these expressions are meaningful is rather moot

The official (long-winded) way to do it

restart:
with(LinearAlgebra):
M:=RandomMatrix(5,7);
Dimension(M); # return dimensions
Column(M,3); #return column 3
Row(M,2); # return row 2

The shorthand way to do it

restart:
with(LinearAlgebra):
M:=RandomMatrix(5,7);
op(1,M); # return dimensions
M[..,3]; # return column 3
M[3,..];# return row 3

The cardiod which you specify is a 2-dimensional entity - which you can plot using

plots[polarplot](1-cos(theta), theta=0..2*Pi);

I have no idea what you want to happen in the third dimension - only you know and you have to specify

As presented, f1 is a list and the required substitutions can be performed using

f1 := [x2^3-3*x1+x2, -x2-x3+u, x2-2*x3];
subs( [x1=2*x1, x2=2*x2, x3=5*x3],f1);

Now if you want f1 to be a vector you can use

f1 := Vector([x2^3-3*x1+x2, -x2-x3+u, x2-2*x3]);
subs( [x1=2*x1, x2=2*x2, x3=5*x3],f1);

I do not understand the last part of your question at all, but if (in some sense??) you wish to repeat these substitutions, then something like

f1 := Vector([x2^3-3*x1+x2, -x2-x3+u, x2-2*x3]);
for j from 1 by 1 to 5 do
    f1:=subs( [x1=2*x1, x2=2*x2, x3=5*x3],f1);
od;

will work. (note that the loop end value is arbitrary)

First 180 181 182 183 184 185 186 Last Page 182 of 207