tomleslie

13876 Reputation

20 Badges

15 years, 176 days

MaplePrimes Activity


These are replies submitted by tomleslie

The interpretation of "implicit summing over repeated indices" is often referred to as the "Einstein summation convention". It is a notational convention most commonly used with tensor manipulations in certain areas of Physics (mainly General Relativity).

Note that it is a notational convention to avoid the writing of all the summation signs and index definitions, thus simplifying(?) the "appearance" of many expressions. Maple's Physics package does utilise this convention in certain places. The intro to the Physics package states that it facilitates

differentiation and simplification of tensorial expressions using the Einstein summation convention for repeated indices

Within the Physics package, the command sequence

with(Physics):
Setup(mathematicalnotation = true);
Define(A, B, C);
expr:=SumOverRepeatedIndices( A[i,j]*B[j,m]);
Check(expr, free);
Check(expr, repeated);

makes perfect sense (and will be correctly interpreted)

Rather obviously, it might be a little dangerous to enable this notational convention generally, since

A[i,j]*B[j,m]

would then have two possible interpretations: firstly the simple product of two elements; and secondly as a summation over the repeated index 'j'

 

In your statement

dy/dx=sqrt(1+(a*x)+(2*y)

there is one more '(' than there is ')': so this is syntactically incorrect - now where should I put the missing closing parenthesis. Should I just guess?

In the statements

k_1=hf(x_n,y_n)

 

k_2=hf(x_n+h,y_n+k_1)

should one assume that you mean

k_1=h*f(x_n,y_n)

 

k_2=h*f(x_n+h,y_n+k_1)

All of these problems would have become obvious if you had actually tried to write any Maple code. Any repost should contain executable Maple code - if only to demonstrate that you have at least tried to solve this problem

the equations are recursive, since, for example,  you have a name 'm' on the left hand side of the ':=' symbol which depends on the name 'm' on the right-hand side of the ':=' symbol.  Now which part of the word recursive do you not understand?

BTW you have reposted this question, with non-recursive equation definitions. VV has correctly pointed out that that the new integrals are identically zero, since the integrands are obviously odd. So I'm guessing that your question has been satisfactorily answered.

As a 'toy' example consider

restart;
A:=Array(1..2, 1..2):
A[1,1]:=plot(sin(x), x=-Pi..Pi, color=red):
A[1,2]:=plot(cos(x), x=-Pi..Pi, color=blue):
A[2,1]:=plot(-sin(x), x=-Pi..Pi, color=green):
A[2,2]:=plot(-cos(x), x=-Pi..Pi, color=orange):
plots:-display(A);

 

This is a minor extension on the question which was asked (and answered) at

http://www.mapleprimes.com/questions/221213-Plotting-A-Second-Derivative-Graph-

However, as currently posed, the question makes little sense

The snippet

pds:-value(f(x, y)))(x, yVal)[3]),

will return values for f(x,yVal) - but note that yVal is fixed, so differentiating (numerically or otherwise) with respect to 'y' is guaranteed to return zero. So, as posed, the question makes little sense

So what is the question - who can guess? Possibilities

  1. diff( f(x,y), x$2) versus 'y' for x=Xval and 'y'= (say) 0..20
  2. diff( f(x,y), x$2) versus 'x' for y=Yval, and 'x'= (say) 0..20
  3. diff( f(x,y), y$2) versus 'y' for x=Xval and 'y'= (say) 0..20
  4. diff( f(x,y), y$2) versus 'x' for y=Xval and 'x'= (say) 0..20
  5. Other possibilities are available

And until the requirement is clearly defined...........

 

My original code works in Maple 2016

In Maple18 you will have to modify the code to

restart;
DEtools[DEplot]
               ( diff(x(t),t)-x(t), # ODE
                  x(t),                # dependent variable
                  t=-1..1,           # range of indepenent variable
                  {x(0)=1}         # initial condition(s)
               );

This provides the same answer as I originally obtained - and I am still not sure that it is what you want!

 

Post the code (using the big green up-arrow in the MaplePrimes editor)

which you need to think about!

  1. Both of the expressions you present have a recursive assignmen. The first is recursiver wrt 'm' and the second wrt 'q'. Are these typos, or are you really doing some kind of recursive calculation?
  2. In order to obtain a numerical value for the integral, all parameters J, J__0 beta, m, q, will have to be assigned numerical values. What are they?

You can offset the 'top' of  the prism from the base by using the 'displacement' option. Consider the following which plots all prisms from triangular to dodecagonal, and whose 'top' is translated from its base by the displacement value [1,1].

restart;
with(plottools):
with(plots):
for n from 3 to 12 do
     display
     ( prism
       ( polygon
         ( [ seq
             ( [ cos(j*2*Pi/n),
                 sin(j*2*Pi/n)
               ],
               j=1..n+1
             )
           ]
         ),
         base=-1,
         height=2,
         displacement=[1,1]
       ),
       axes=none
     )
 od;

 

Well, I know why you are getting the output you describe. Consider the statement

if r=0 then i:=N; else i:=r; fi;

So if r=0, then i=N.

However you subsequently use the statement

if r=N+1 then i:=1; else i:=r; fi;

So when r=0, the 'else' section executes and sets i=r, and since r=0, then i=0.

The combination of these two statements means that when r=0, tnen 'i' is assigned to 'N', but 'i' is then reassigned to 'r' (which is 0)

Now I cannot work out what you actually want from this process, since in the code you posted, x, y, and N are not assigned. Maybe you wnat something on along the lines of

N:=123
for q from1 to N do
      for x from q-1 to q+1 do
           for y from q-1 to q+1 do

or maybe something else - I'm generally pretty good at guessing, but not this time :-(

Well I've had a quick try to solve your revised problem analytically - so far no luck. Not saying it can't be done - maybe it can.

However  if (as you say) the problem is "concave", then it *ought* to be trivial to set up a worksheet to find numeric solution(s), for any given set of numeric values for the parameters A, a, b, c, f, nNLOS - can you supply these?

Consider the expression

eqn := (A./(1+a*exp(-b*(((atan(h/R))*(180/pi))-a)))) +10*log10(h^2+R.^2)+20*log10(f)+20*log10(4*pi/c)+nNLOS = 110;

In particular, consider the parts which I have highlighted in red

  1. What is meant be the operator(?) './' ? This is a simple syntax error. You get nowhere until this is fixed
  2. What is meant by the operator(?) '.^' ? This is a simple syntax error. You get nowhere until this is fixed
  3. What is meant by 'pi' ? As written this is a simple symbol with no particular meaning. If you intend to refer to the quantity which relates the circumference of a circle to its diameter, then you need 'Pi' not 'pi'. So which is it?

Once you have fixed the 'simple' problems listed above, we move on to the (slightly) more interesting ones. Given the statement that "The rest of variables, A,c,f,a,b,NLOS are known. ", implies that 'R' and 'h' are unknown. Now this has a couple of possible of ramifications

  1. If 'R' and 'h' are independent, then you have one equation in two unknowms - not solvable. One equation in two unknowns is never explicitly solvable. However you then make the statement
  2. " I need to find solution such that derivate of R w.r.t h = 0 " - so you mean that actually 'R' is a function of 'h' and you want a solution of the initial expression subject to the condition diff(R(h), h)=0???
  3. Furthermore you state "I want to maximize R" so maybe that means that not only do you want diff(R(h), h)=0, but also require that diff(R(h), h,h)<0?

Once you supply answers to the above, someone here may be able to help. Until then, there are simply too many uncertainties for anyone to get interested.

Wilst working on your problem, I (more or less accidentally) generated the animatiom in the the attached file. I found this fascinating, so I decided to share it - no reason other than the fact that it is great to look at.

You shou;d be aware that this worksheet takes about 30secs to execute on my machine. Depending on the spece for your machine, it may be either be faster or considerably slower - so just wait!!!

Once it has executed, either

  1. left-click on the displayed plot.Grab a corner to make the plot nice and big.
  2. This should aslo bring up the the animation toolbar - so just hit  the paly button (and admire)
  3. Alternatively, right-click on the plot which will bring up a context menu, and select animatiom ->play
  4. Even better if you select the continuous option in either of the above!

duffing4.mw

For the unforced Duffing oscillator witth the supplied parameters/initial conditions, it is never true that u(t)=v(t), other than when t= 0. You can convince youself of tis by examing plots of (t, u(t)) and (t, v(t)) on the same graph - they never cross. See the first calculation in the attached

When you say

So, what I want to plot is actually the points that are both contained in the matrix [u(t),v(t)] and on the line, u(t)=v(t).

this doesn't make much sense. The Array defines the absolute times at which the solution is to be calculated - so in the code above, the option

output=Array([seq(i,i=500..1500)])

means calculate the output at t=500, 501, 502,....1500. You are unlikely to "land" on any points where u(t)=v(t).!!!1

However it is possible to use the 'events' to dsolve to output all times/values when u(t)=v(t). This is done in the second part of the attached  - but I have no idea what you plan to do with these!

 

duffing3.mw

You original request was

I would like to know if I can modify the code for the autonomous system.

The worksheet I posted computes the response for the "autonomous system" (as defined by Wikipedia) which apparently you are now ignoring - maybe it wasn't what you wanted? I have no idea!

You post another worksheet with unclear code and unclear questions. I have tidied up the unclear code - mainly removing DEplot() commands whihc you don't need to use and which only confuse things, because everything you want can be achieved with dsolve() and pointplot()

The last execution group makes little sense to me.

  1. You define a 'new' ODE system called 'Duffing3d', but then you do not use it. Why?
  2. In Duffing3d, you introduce a new dependent variable 'theta(t)', which requires an initial condition, but this is not provided.
  3. Even if I utilise 'Duffing3d', and guess an initial condition for 'theta(t)', I have no idea what you want to plot. Think very simply: you have access to four quantitites, which are 't', 'theta(t)', 'u(t)', 'v(t)'. Now I can generate pretty much any combination of these quantities against any other combination of these quantities. You just have to be able to specify what the combinations are in mathematical terms.
  4. Don't use "smart" phrases like "Poincare sections" or "trajectories crossing the line u=v transversely". You have four quantities - 't', 'theta(t)', 'u(t)', 'v(t)' - expressed in simple mathematics, what combination of these quantities do you want? Becuase if you don't know, then I have no chance

See the attached

Duffing2.mw

 

First 127 128 129 130 131 132 133 Last Page 129 of 207