tomleslie

13876 Reputation

20 Badges

15 years, 178 days

MaplePrimes Activity


These are answers submitted by tomleslie

if I enter

solve({a <> 0, b>0});

then Maple correctly returns the answer

{0 < a, 0 < b}, {0 < b, a < 0}

So I assume that you must have the quantities 'a' and 'b' defined elsewhere in your worksheet, and think that someone here can diagnose your problem without knowing these definitions????

after fixing a few syntax problems, I can get close to the plots you want - but not the same. Can only suggest that you examine the following for further possible errors

restart:
h:=z->1-(delta2/2)*(1 + cos(2*(Pi/L1)*(z - d1 - L1))):
K1:=((4/h(z)^4)-(sin(alpha)/F)-h(z)^2+Nb*h(z)^4):
lambda:=Int(K1,z=0..1):
F:=0.3:
L1:=0.2:
d1:=0.2:
alpha:=Pi/6:
plot( [seq(eval(lambda, Nb=j), j in [0.1,0.2,0.3])], delta2=0.02..0.1);

 

When using 2D input mode, Maple will interpret the fist parenthesis group in (x-1)(1+x) as two function (think 'f' and 'g'), which it therefore 'simplifies' to two distinct function applications, as in x(1+x)-1(1+x). This is the function 'x' evaluated at the argument x+1, minus the function '1' evaluated at the argument x+1. Now since the function '1' is actually the constant 1, for all arguments, this is further simplified to x(1+x)-1.

If you wish to continue using 2D input mode you have to be careful about the distinction between "implied multiplication" and 'function application'. For example, in

f(x+1)
f (x+1)

the first is a function application, and the second is simple multiplication: the 'space' makes all the difference

You have a choice

  1. Use 1D input mode (can be set in preferences), where you have to be pretty explicit about everything you want to do: probably slightly more typing and the input doesn't look as pretty
  2. Be very careful in 2D input mode, because (you have found) the extra level of parsing may make interpretations which you did not intend

irem() if you want the remainder generated by the division of two integers

frem() if one or both of the arguments is a 'float'

it is probably a good idea to try running Maple with administrator privileges:

right click Maple icon/executable and select "Run as Administrator".

As always when giving any piece of software "administrator" privileges, - be careful!

for indexable quantities such as lists, vectors, matrices etc. Consider the difference between

numelems(<1,2,3;4,5,6>);
nops(<1,2,3;4,5,6>);

Both are technically correct, according to their definitions - but did you expect what was returned by nops() ?

See the comments on your code

restart;
R0 := exp((2*Pi*I)*n^2*z);
R1 := sum(R0, n = -infinity .. infinity);
R1 := abs(R1)^2;
R2 := exp((2*Pi*I)*(n+1/2)^2*z);
R2 := evalf(sum(R2, n = -infinity .. infinity));
R2 := abs(R2)^2;
R := evalf(sqrt(Im(d))*(R1+R2)); # what is 'd' - where is it defined?
plot(R, k = 1 .. 10); # what is 'k' - where is it defined?

You have a mixture of logical and syntax errors. If I attempt to follow your original procedure, one would get something roughly(!!) like

restart;
number := proc(n)
                  local sum:=1, nn:=n;
                  while floor((1/10)*nn) > 0 do
                           sum:= sum+1;
                           nn:=floor((1/10)*nn);
                  end do;
                 return sum;
                 end proc:
number(236417);

However it would be much simpler just to use length(236417).

plot(sin(x), x=-2..2, style=point, symbol=solidcircle, numpoints=40);

The tickmarks option allows you to supply a list of equations of the form v=t, where 'v' specifies the location and 't' specifies the label to be placed at that location. So a trivial example would be

restart;
plot( sin(x),
         x=0..2*Pi,
         tickmarks=[ [ seq(i*Pi=180*i, i=0..2,0.25) ],
                              default
                           ]
     );

 

 

If you use the display() command with the option 'insequence=true', then the list of plots supplied to the former will be shown as an animation. In other words rather than all plots in the supplied list appearing simultaneously, they will be displayed one-after-another.

Check out the attached

animPlot.mw

In the 'failing' command, ie

CC:=Minimize(EQD, {subs(x = -1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0, subs(x = 1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0}, Conds, iterationlimit = 1000)

what is the interpretation of the various arguments?

My interpretation would be

EQD: function to be minimized

{subs(x = -1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0, subs(x = 1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0}: set of equality constraints

Conds: I'm not sure!!

Conds contains a set of equations which equate every parameter in the function EQD to zero. These cannot be further equality  'constraints', because setting all parameters to be zero as constraints would be a bit pointless. They might(?) have been intended as inequality constraints - for example by setting all parameters>0, in which case all '=' signs in Conds would have to be replaced with '>', or '>='. I haven't examined this possibility further. The only(?) other sensible interpretation I can come up with, is that the set Conds is intended to represent 'initial values'. However, if this is true, then the Minimize() command should be

CC := Minimize(EQD, {subs(x = -1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0, subs(x = 1, sum(c[i]*A[i], i = 1 .. NN+1)) = 0}, initialpoint = Conds, iterationlimit = 1000)

The above command 'works' in the OP's worksheet, in the sense that the 'unexpected parameters' error disappears - and (sometimes, for certain values of the loop variable 'j') answers are obtained.

Since the interpretation of the arguments to the Minimize() is command is uncertain I'm reluctant to investigate further: although I do think there are (possibly?) logical errors in the try->catch sequence, which might also cause issues.

  X:= r^2*(R + r*cos(v))^2;
  sqrt(X, symbolic);

I don't understand the problem!

looks like you are doing it the "hard" way!

The geometry() package is primarily intended for performing assorted geometric calculations. If you are only producing relatively simple plots, containing basic shapes, it is almost certainly "overkill".

The plottools() package contains sufficient capability to produce plots containing such shapes, using fairly intuitive commands. The attached shows my attempt to produce same plot as you have obtained (using a lot less code!).
 

plotProb.mw

 

to use the 'makeproc' option for this case?

ie


 

restart;
r := rsolve({u(n)=n*(u(n-1)+1), u(0)=0}, u, 'makeproc'):
r(100);
CodeTools:-Usage(r(7000)):

253686955560127297415270748212280220445147578566298142232775185987449253908386446518940485425152049793267407732328003493609513499849694176709764490323163992000

 

memory used=95.35MiB, alloc change=124.50MiB, cpu time=343.00ms, real time=340.00ms, gc time=62.40ms

 

 


 

Download recur.mw

 

 

 

 

First 146 147 148 149 150 151 152 Last Page 148 of 207