Maple 18 Questions and Posts

These are Posts and Questions associated with the product, Maple 18

Say the values of i^2 are being calculated from within a procedure,

 

mytest:=proc(n)

local ans;

    ans:=0;

    for i from 1 to n do

   ans:=ans+i^2;

   end do;

   return ans;

end proc;

 

Could I have a (time series) plot of i^2, while the values are being calculated?

The above is a toy example. What I want to archieve is to track a particular intermidiate values while the procedure is running.

 

Thanks,

 

casper

Hi Maple friends.

x(x+y)^4 = y(3*x-y)^2

When I differentiate implicitly by hand, I get:

-5*x^4-4*x^3*y+3*y^2/x^4-6*x*y+3*y^2 (my lecturer also got this solution)

Maple gives the result as: 

(-2*x(x+y)^3*(D(x))(x+y)+3*y(3*x-y)*(D(y))(3*x-y))/(2*x(x+y)^3*(D(x))(x+y)+y(3*x-y)*(D(y))(3*x-y))

Maybe I am doing something wrong in Maple? From the context menu, I choose implicit differentiation, and then select y as the dependent variable. How can I get Maple to give the same solution?

Thanks in advance.

Phil Yasskin (Texas A&M) has prepared a maplet for the Maplets for Calculus proiect. While this maplet works, in Malmem 18 it sometimes does NOT display the plot. We don't see this behavior in Maple 17, The maplet is attached for your convenience, if you are interested in seeing if it works for you.

HorAsymp-KD-ms-PY3.mw

The problem is difficult to describe. Basically, at the end of the problem, users can elect to see a plot of the function with(some) asymptotes. The code creates the plot when the problem is created, and displays this plot in the worksheet. But, when the plot is requested within the mapmlet, it sometimes does not show in the empty plot window.

Any explanations (or followup quesitons) will be greatly appreciated.

Doug

---------------------------------------------------------------------
Douglas B. Meade  <><
Math, USC, Columbia, SC 29208  E-mail: mailto:meade@math.sc.edu
Phone:  (803) 777-6183         URL:    http://www.math.sc.edu

Hi,

I read this thread, but it didnt really help.

test.mw (i noticed an error in the expression pj, now fixed!)

See this file above.

The function needs to be maximized is "loglik", with constraints,

f0>0, sigma>0 and mu is FREE. Only three variables.

 

Using some calculus and by changing variables, I was able to use Gauss–Hermite quadrature, and do some approximation, to get the values:

f0=105.9535

mu=-2.1587

sigma=3.5156

 

I am wondering if Maple can do this straight away. By that, I mean, without doing much further,  how could I get the values? (most efficiently and quickly)

 

Thanks,

 

casper

 

http://www.mapleprimes.com/questions/122813-Is-It-Possible-To-Optimize-This-Kind-Of-Integral

Hi,

This maybe a really simple question, I remember this is doable but couldnt find where the answer is.

Say I write a function to sum up all values in the list,

mysum:=proc(data::list)

return printf("The sum is %3.3f. ", sum(data[i],i=1..numelems(data)));

end proc;

 

and I use it like,

mysum(listA);

mysum(listB);

 

How would I print out a more informative string, like this:

"The sum of listA is %3.3f. "

"The sum of listB is %3.3f. "

 

Use "data", the input, as a string argument.

 

Thanks,

 

casper

I want to write an equation in the text portion of my document.  I do not need it evaluated. I just want to write formulas, like I do in LaTeX. 

Hello!

I would like to start with the following set of 9 elements,
A = { E11, E12, E21, E22, E11+E12, E11+E21, E12+E22, E21+E22, E11+E12+E21+E22 }.

I need a procedure that takes each of those elements and creates 3 new ones in the following way: Eij becomes Eij1, Eij2, Eij1+Eij2. So for example, E11 will become: E111, E112, and E111+E112. And for example the fifth element in A (i.e. E11+E12) will become the 3 new elements: E111+E121, E112+E122, and E111+E121 + E112+E122.

Since each of the 9 elements gets triplicated, there will be a new set, call it B, with 27 elements.

B = {E111, E112, E111+E112, E121, E122, E121+E122, ... }

Now I want to repeat this process of triplicating again so that, for example, E111 becomes: E1111, E1112, and E1111+E1112. And so on. This new set C will have 81 elements. Now I want to repeat this one last time. The final set, D, will have 243 (3^5) elements. 

Step 2: 

For every pair of elements x and y in D, I want to compute z:=(x+y)mod2. If z already belongs to D, discard it, otherwise, place z in the set D2. Do this until there are no more elements to add together (note that if x+y is computed then I don't want y+x to be computed also--that's inefficient). Maybe the most efficient way is to perform all possibly combinations of x+y mod 2 to create the set D2 and then just go: D2 setminus D.

Step 3: For x in D and y in D2 perform all possible combinations of z:=(x+y)mod2 and place these in D3 then perform set subtraction again: D3 minus D2 minus D.

Repeat this process again: x in D and y in D3 to create new elements in D4. Repeat again until Dm is empty (that is, D(m-1) will be the last set that contains new elements). I'm expecting around 12 sets... 

The issue with this whole algorithm is that I often run out of memory so I need a clever way to do this, since this algorithm is essentially classifying 2^32 elements into disjoint sets. Thank you! 

When the loop variable can be written as a unit step sequence, I never really distinguish between using

seq( f(i), i=m..n ), and

f(i) $ i=m..n

However I recent came across a case where the 'seq' construct ran about 2.5x faster. Is using 'seq' always faster? Does it depend on the function being evaluated? Why is there such a large difference in execution time

The original example which exhibited the problem is shown below, although after some experimentation, I have found other cases where 'seq' is faster (and plenty where it doesn't seem to make any difference!)

Example code for implementation using '$' is

restart:
ulim:=1000000:
t1:=time():
ans:= max
          ( { iquo(3*d, 7)/d $ d = 1..ulim }
             minus
            {3/7}
         ):
t2:= time()-t1;


Example code for for implementation using 'seq' is

restart:
ulim:=1000000:
t1:= time():
ans:= max
        ( { seq
            ( iquo(3*d, 7)/d, d=1..ulim )
          }
          minus
          {3/7}
        ):
t2:= time()-t1;

On my machine, the version using the 'seq' construct runs 2.5x faster

 

How does one adjust the aspect ratio for Maple plot? I actually searched for aspect ratio for Maple on google and not able to find much of anything. Help does not have such phrase. May be it called something else in Maple? The reason I ask, is that when I change the size of bode plot, the aspect ratio become bad. So I need a way to adjust that. Here is an example

restart:
alias(DS=DynamicSystems):
sys:=DS:-TransferFunction(5*s/(s^2+4*s+25)):
DS:-BodePlot(sys,range=0.1..100);

Now if I do

DS:-BodePlot(sys,range=0.1..100,size=[300,"default"]);

I am finding so many problems with Bodeplot in Maple, but this is for another time. I think it needs much more polishing

Maple 18, windows 7

with(LinearAlgebra):
a:=Vector([1,2]);
b:=Matrix([[1,2],[1,2]]);

Say if I need a^T * b * a, I will do this:

VectorMatrixMultiply(Transpose(a), b);
VectorMatrixMultiply(%, a);

But this seems too long for such a simple matrix (and vector) computation. I am sure there must be an short way.

What if I need more computation, like

 

a^T * b * c*d*f*g* a, where c,d,f,g are other 2x2 matrices.
 If I were to use the above command, that'll take a long time to input.

Thanks,

f:=x+y+y;

diff(f,x);
diff(f,y);
diff(f,z);

What I hope to get is a vector with i-th entry being the dervative of f, differentiated w.r.s.t the i-th parameter, like this

Vector([1,1,1]);

 

Is there a more efficient (built-in) command to do this?

 

VectorCalculus[diff] does not do what I want.

 

Thanks,

 

casper

 

Hi Maple friends.

I have a plot. I click on the plot, and the blue border appears the around the plot. I press the delete key on my keyboard, and the plot is not deleted. Not deleted when I press the backspace key either. I can right-click on the plot and choose 'cut', but that just copies the plot to the clipboard.

So how can I delete a plot from the worksheet, without deleting anything else?

Thanks in advance.

Hi Maple friends.

I am trying to differentiate these:

1. csc(x)/x

2. 3*x^2*cot(x)

From doing it by hand, I am getting:

1. -cosec(x)*(xcot(x) + 1)

2. 6x*cot(x) - 3x^2*cosec^2(x)

But Maple is giving the answer:

1. diff(csc(x)/x, x);

-csc(x)*cot(x)/x-csc(x)/x^2

2. diff(3*x^2*cot(x), x);

6*x*cot(x)+3*x^2*(-1-cot(x)^2)

My answers don't look like Maple's answers. Are they actually the same?

Thanks in advance.

 

Whenever i open Maple 18, some symbols are missing including the arrows. I use Maple 18 to do math assingments, and the arrows are useful. It seems like a lot of other content is missing in Maple 18 as well. Below is a picture of the missing symbols, or there should be one. Any help on how i get the arrows back, would be amazing.

Symbols missing

Here is my code & the error mesage.  What's wrong?

 

with(Statistics);
X := Vector*([0, 5, 10, 15, 20, 25, 30], datatype = float);
Y := Vector*([38.8, 53.8, 82.4, 107.6, 130.7, 152.4, 173.2], datatype = float);
NonlinearFit(av^2+bv+c, X, Y, v);
Error, (in Statistics:-NonlinearFit) invalid input: PostProcessData expects its 1st argument, x, to be of type {array, list, rtable}, but received w

First 78 79 80 81 82 83 84 Page 80 of 87