Preben Alsholm

13743 Reputation

22 Badges

20 years, 338 days

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Markiyan Hirnyk Thanks for your confidence in my abilities. But the problem you refer to was a simple logical error anybody would do on occasion. Too bad it wasn't caught in testing.

Getting solve to return correct solutions for equations with assumptions is clearly a hard task. So no wonder that incomplete solutions are returned as in my example with cos(x)=1/2. But see below for more on that.

The same solutions are returned in Kitonum's example if sin(2*x)/cos(x+3*Pi/2)=1 is replaced by simplify(sin(2*x)/cos(x+3*Pi/2))=1. No error.

I tried the following:
#####
restart;
res:=solve([simplify(sin(2*x)/sin(x))=1,x>-4*Pi,x<-5*Pi/2], x, allsolutions);
about(_Z1);
about(_B1);
##So since  _B1 and _Z1 are integers we have
_B1-3*_Z1<=6 , _B1-3*_Z1>4;
isolve({_B1-3*_Z1<=6 , _B1-3*_Z1>4,_B1>=0,_B1<=1}); #A warning issued
eval(res,%); ##The correct unique solution
#####################################################
##Now without simplify; cos(x+3*Pi/2) is simplified just by evaluation to sin(x), so I use that.
restart;
res:=solve([sin(2*x)/sin(x)=1,x>-4*Pi,x<-5*Pi/2], x, allsolutions); ##The error reported by Kitonum
about(_Z1);
        Originally _Z1, renamed _Z1~:
  is assumed to be: -2
### Remarkable: that was what we found that the _Z1 in the preveious session should be

about(_B1);
_B1:
  nothing known about this object


@law47 

L:='L': #If L is previously assigned

Q(L)(x,y,y1);
      (D[1](L))(x, y, y1)+y1*(D[2](L))(x, y, y1)+y*y1*(D[3](L))(x, y, y1)/x

No problem.

As the one who supplied the code for Q, I would like you to clarify what you want. After all even if L is not defined to be anything, this works:

Q(L)(x,y,y1);
    (D[1](L))(x, y, y1)+y1*(D[2](L))(x, y, y1)+y*y1*(D[3](L))(x, y, y1)/x

In the question in

http://mapleprimes.com/questions/207524-Writing-An-Operator

you asked

"I am trying to write 

D= d/dx + y1*d/dy + y*y1/x*d/dy1 

So that I can apply D to some function L(x,y)."

I think I answered that.
But did you really mean something else?
Or did you want to make a more general (higher level) procedure taking in a particular expression a(x,y,y1)*d/dx +b(x,y,y1)*d/dy+c(x,y,y1)*d/dy1 and as output having a procedure like Q  working on functions?
In our particular case a(x,y,y1)=1, b(x,y,y1)=y1, c(x,y,y1)=y*y1/x.
If so that should be pretty easy.

Yes, this is a mess:

solve([cos(x)=1/2, x>0, x<2*Pi], x, allsolutions, explicit); #OK
      {x = (1/3)*Pi}, {x = (5/3)*Pi}
solve([cos(x)=1/2,  x>-4*Pi, x<-5*Pi/2], x, allsolutions, explicit); #Ignoring the inequalities
      {x = -(2/3)*Pi*_B2+(1/3)*Pi+2*Pi*_Z2}

@Dmitry I'm not about to speculate on this. I'd like to see an example of what you mean by really different?

@Dmitry The only difference between the 2 regimes is the appearance/disappearance of upsilon in the K-equation. That is handled by piecewise. Thus there is only one system.

Notice now that dsolve/bvp works with the change from psi[S] to psi[s] as mentioned in my answer above.

You want to apply this D to a function L of 2 variables (x and y). So what is d/dy1 supposed to mean?

@Carl Love Thanks for calling my attention to frem.

I suppose something like
mp:=(x,p)->frem(x+p/2,p)+p/2;

might work OK in the present context (if 2*Pi is replaced by evalf(2*Pi)).

That mp(8,2) returns 2. and not 0. seems to be irrelevant here.

@GeorgeReynolds It seems that you misunderstood my latest reply.
My example was intended to show that an error (a strange one) results when using D-format, i.e. when pdeD is used, whereas pde (in diff-format) gives an answer.

@leosh The variable _Z appears in the RootOf expressions in answer

indets([answer],RootOf);
     {RootOf(-L^2*cos(xi)^2+_Z^2+w^2), RootOf(_Z^2-2), RootOf(-L^2+_Z^2+w^2), RootOf(-L^2+_Z^2+2*w^2)}

RootOf(_Z^2-2) (as an example) stands for the roots of the polynomial _Z^2-2, thus stands for sqrt(2) and -sqrt(2).

Use allvalues to get all the roots:

map(allvalues,{answer});

You can avoid the RooOfs by using
answer := solve({equ1, equ2, equ3, equ4, equ5, equ6}, {alpha, sigma, xi, lambda__1, lambda__2, beta__f},explicit=true);

Notice that the two variable arctan is used:  arctan(y,x)
In the help page for arctan you find this:
"For real arguments x, y, the two-argument function arctan(y, x), computes the principal value of the argument of the complex number x + I y , so -Pi < arctan(y, x) and arctan(y, x) <= Pi. "






I had problems with equ6. When I copied your input line to a 1D math line I got the following weird stuff (well, I hate 2D math input with a passion):
`#mi("equ6")` := `#mi("L")`*`#mi("sin",fontstyle = "normal")`(sigma)*cos(xi)-w*alpha*v^2*sin(sigma)/(g*l*cos(xi)^2)

After having corrected that I could concentrate on the problem.
The answer is that solve simply doesn't find any solution, therefore it returns NULL (i.e. nothing).

Could you edit this so we only get the input? As it is now it is unreadable.

In Maple go to Edit/Remove Output/From Worksheet

After that copy all the lines and paste them into the MaplePrimes editor.

@Rouben Rostamian  And the logarithmic plot:

plots:-logplot(abs(myx1(t) - myx2(t)), t=0..4*Pi);


First 96 97 98 99 100 101 102 Last Page 98 of 231