MaplePrimes Questions

Hello,

 Can you tell me how I can create the variation tab of a function with Maple 2022?

Thanking you,
 
,DAVID CRESPIL

I have only seen big O show up in series solutions, as in 

series(sin(x),x)

I've never seen it before show up in result of solve

restart;
eq:=x=p*(a*ln(p+sqrt(p^2-2))+2*_C1)/(2*sqrt(p^2-2));
sol:=solve(eq,p);

What does it actually mean when the solution has  O(RootOf(....))?  

Should not result of solve be exact? isn't having big O means an approximation?

Maple 2022.2 on windows 10

Q1: Is it possible to find out where a warning was generated (i.e. which procedure issued the warning)?

Q2: Is a command specific warning suppression possible? Something like that for example: infolevel[int] := 0

Q3: Can warnings be removed form a document before printing it?

Typical warnings I want to suppress are attached
 

Download warnings_to_suppress.mw

Update: for the attached warnings Typesetting:-Settings(parserwarnings = false) is effective, which does not work for warnings discussed bellow.

 

So for my project, I need to be able to do this integral for different values of "l". Here is the integral I need to evaluate:

Where "R", "Xi", and "l" are all constant. When I try to do it, it gives back an imaginary number. The absolute value of this imaginary number seems to be correct but I'm not sure why it's imaginary. This is a plot of what it should give for various values of "l":

Here is my maple code copy-pasted from the application (I'm new to Maple and this forum and cannot figure out how to attach the file version of my code sorry):

Digits := 30;
E := 3.83*10^14;
                                            14
                  E := 3.8300000000000000 10  

R := 0.1*E;
                                            13
                  R := 3.8300000000000000 10  

l := 0.01*R;
                                            11
                  l := 3.8300000000000000 10  

A := int((-4*E^2 + r^2)^(1/2)*(R^2 - l^2 + r^2)/((R^2 - (l - r)^2)^(1/2)*((l + r)^2 - R^2)^(1/2)), r = abs(l - R) .. l + R)/(Pi*R^2);
             A := 19.9744824651978825998722703010 I

Max := (1 + 4*(E/R)^2)^(1/2);
             Max := 20.0249843945007857276972121483

NULL;

Here is the code when I exported as maple input:

NULL;
Digits := 30;
E := 3.83*10^14;
R := 0.1*E;
l := 0.01*R;
A := int((-4*E^2 + r^2)^(1/2)*(R^2 - l^2 + r^2)/((R^2 - (l - r)^2)^(1/2)*((l + r)^2 - R^2)^(1/2)), r = abs(l - R) .. l + R)/(Pi*R^2);
Max := (1 + 4*(E/R)^2)^(1/2);
NULL;

Thank you in advance!

Having  Matrix say A of dimensions n×m

Writing a function that 

Will choose k  columns of the matrix at 

At random where one of the column that is column m is the last column of output matrix that is after choosing k columns from the first m-1 column

We append the column m as last column to the new random matrix and the function returns the new matrix M

Kind help

k can be any big number less than m-1

When exporting a maple file containing

pH = 1/2*(pKa - log[10](c)),

I could see that the minus was transformed into a K

Any idea for solving this problem ?

Cheers for Maple anyway

There are two issues I am having with images in Maple Flow 2022.

1. When I need to move an image up or down in the document it instantly flies to the top or off in to the vast corner of the document with the tiniest motion of the mouse. It's utterly ridiculous. Is there a setting to change this behaviour in Maple Flow? I have changed settings on my desktop with no change, so I believe it is Maple Flow's behavior.

2. When I do put an image somewhere and save the document and open it some time later, the images are moved in position on top of text. No amount of moving them and saving them ever changes this and I can't export a document that I need to submit for calculations on a report because of this.

 

Any help would be appreciated.

Could you suggest a more elegent way to remove any entry in piecewise which has undefined in it?

expr:=(s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2));
inttrans:-invlaplace(expr,s,t);
Y:=convert(%,piecewise);
#remove all entries in piecwise which has undefined

To obtain this

I can;t just apply select on piecewise. So currently I convert piecwise to list of lists, each sublist has the 2 entries you see above in each row.

Next apply select. Then use piecewise again on the result. This works, but wondering if there is a better way.

Attached worksheet.

interface(version);

`Standard Worksheet Interface, Maple 2022.2, Windows 10, October 23 2022 Build ID 1657361`

restart;
expr:=(s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2));
inttrans:-invlaplace(expr,s,t);
Y:=convert(%,piecewise);
#remove all entries in piecwise which has undefined

expr := (s+exp(-Pi*s)-exp(-2*Pi*s))/(s*(s^2+2*s+2))

exp(-t)*sin(t)+(1/2)*(-1+exp(-t+2*Pi)*(cos(t)+sin(t)))*Heaviside(t-2*Pi)+(1/2)*(1+exp(-t+Pi)*(cos(t)+sin(t)))*Heaviside(t-Pi)

piecewise(t < Pi, exp(-t)*sin(t), t = Pi, undefined, t < 2*Pi, exp(-t)*sin(t)+1/2+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)), t = 2*Pi, undefined+(1/2)*exp(-Pi), 2*Pi < t, exp(-t)*sin(t)+(1/2)*exp(-t+2*Pi)*(cos(t)+sin(t))+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)))

Y:=[op(Y)]:
Y:=seq([Y[n],Y[n+1]],n=1..nops(Y)-1,2):
ListTools:-Flatten(select(not has,[Y],'undefined')):
piecewise(op(%))

piecewise(t < Pi, exp(-t)*sin(t), t < 2*Pi, exp(-t)*sin(t)+1/2+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)), 2*Pi < t, exp(-t)*sin(t)+(1/2)*exp(-t+2*Pi)*(cos(t)+sin(t))+(1/2)*exp(-t+Pi)*(cos(t)+sin(t)))


Download remove_undefined.mw

Another very strange result from simplify.  Consider

simplify(a*f(x) + b*f(x) + a*g(x))

Which is what is expected. Now 

expr := a*f(x) + b*f(x) + a*g(x) + 1/(a*f(x) + b*f(x) + a*g(x));
simplify(expr)

gives

why?  I expected (a+b)*f(x) also in the first expression. Compare for reference the same thing in Mathematica where it does them both the same way:

You see it simplified it to (a+b)*f(x)+a*g(x) in both places as expected.

I tried using size option for simplify, but it had no effect.

How can one obtain same result shown above using Maple? And why it does not automatically produce this result?

Maple 2022.2

 

I give up.

Why 

restart;
the_rule:=A::anything+B::anything=A*B;
applyrule(the_rule,a+b);

returns 0?

I was expecting a*b

No clue from help what I am doing wrong.

Maple 2022.2

trace gives this

restart;
the_rule:=A::anything+B::anything=A*B;
trace(applyrule);
applyrule(the_rule,a+b);


{--> enter applyrule, args = A::anything+B::anything = A*B, a+b
                        answer := a + b

                             i := 

                           i := a + b

                          answer := b

                             i := b

                          answer := 0

                             i := 0

                          answer := 0

I am not sure why it is doing the above still. 

I think I will stick to evalindents and subsindets as I do not understand applyrule very well.

restart;

OdeSys := diff(U(Y), Y, Y)+Theta(Y)+N*(Theta(Y)*Theta(Y))-(M*M)*U(Y) = 0, diff(Theta(Y), Y, Y)+E*(diff(U(Y), Y))^2 = 0;

Cond := U(0) = lambda*(D(U))(0), Theta(0) = A+g*(D(Theta))(0), U(1) = 0, Theta(1) = B; sys := [OdeSys, Cond];
Ans := dsolve(sys);

I'm new to maple and I dont know how to solve this equation for k=1 to 4 and finding the roots. If anyone can help with this.

Equation  "cos(k).cosh(k)-1=0"

B := ((cos(k)) . (cosh(k))) - 1 = 0;
               B := (cos(k)) . (cosh(k)) - 1 = 0

solve(B, k);
               RootOf((cos(_Z)) . (cosh(_Z)) - 1)

solve(B, k);
 = 
               RootOf((cos(_Z)) . (cosh(_Z)) - 1)

plot(((cos(l)) . (cosh(l))) - 1, l = 5*_8);
Error, (in plot) unexpected option: l = 5*_8
solve(B, k = 1 .. 4);
Error, invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is k = 1 .. 4
solve(B, k, k = 1 .. 4);
Error, invalid input: too many and/or wrong type of arguments passed to solve; first unused argument is k = 1 .. 4
solve({B}, {k = 1 .. 4});
Warning, solving for expressions other than names or functions is not recommended.
NULL;

One might be flabbergasted by the following

with(ColorTools):

Colors dosn't appear to match values given from this wavelength to rgb converter from here https://www.johndcook.com/wavelength_to_RGB.html

Although the color is in agreement when converting the value given back into a color value.

So in maple WavelengthToColor(622) does not match the color above however (heads up using the method="linear" option makes it closer) if we go through the paces and convert #ff6f00 to a color, it comes out properly.  One might think is something wrong with the WavelengthToColor command?

HexToRGB24("#ff6f00")
              

RGB24ToRGB([255,111,0])
                 

Color([1,.43529412,0])

                

Ok the color seems right but that's not what WavelengthToColor(622) gives

WavelengthToColor(622)
        

So as it turns out using method=linear makes it closer.

Time is short I haven't time to compose the question properly but likely has something to do with the HSV Colorspaces.  It's confusing.

Does Maple Flow support unit prefixes?

Can I "cast" units from one prefixed form to another? For example show 1000ohm as 1Kohm?

Given an expression, I want to do an operation each time the pattern  f(arg1)+f(arg2) is found by replacing it by f(arg1+arg2). Regadless of how many there are. For example

f(A)+f(B) -> f(A+B) and  f(A)+f(B)+f(C) -> f(A+B+C)  and so on. But here is the catch, there could be anything else in the expressions. These will be left unchanged. 

So f(A)+f(B)+x -> f(A+B)+x

I can do it in Maple only when the input is exactly f(A)+f(B)  when the input is f(A)+f(B)+f(C) and so on.

But this is not practical as I need to make new type for each case.

I need a general way that will work for any expression like in the above example.

I am now using evalindets, but I do not know how to tell it the type for the general pattern of  f(n1)+f(n2)+.....+f(nn) to replace these with f(n1+n2+....nn).

For reference, this is code in Mathematica I am trying to translate to maple.

expr = Sin[x] + f[A] + f[B] + 10*Exp[x]/13 + Cos[x] + f[c] + f[10*c];
expr //. f[a_] + f[b_] :> f[a + b]

In the above //. means repeated replacement. So it will keep replacing the same pattern over and over and this works regardless of where f(a)+f(b) show up. They can be anywhere in the sum.

I wish I can the same in Maple using evalindets. I tried patmatch also, and same problem. Which is how to make it general. This is what I tried

expr:=f(A)+f(B);
evalindets(expr,`&+`('specfunc(f)','specfunc(f)'),F->f( op([1,1],F) + op([2,1],F) ) );

Which works

But to detect expr:=f(A)+f(B)+f(C) it would need new code

expr:=f(A)+f(B)+f(C);
evalindets(expr,`&+`('specfunc(f)','specfunc(f)','specfunc(f)'),F->f( op([1,1],F) + op([2,1],F) + op([3,1],F) ) );

Obviously this approach will not work. It will also fail once a new term is added in between. 

But how to extend this to the general case of

expr:=sin(x)+f(A)+f(B)+10*exp(x)/13+cos(x)+f(C)+f(10*C);

Is there a way to tell Maple to apply the pattern over and over like with Mathematica so it works for general case? I need to try to do this using either patmatch or evalindets. Ofcourse I can do it the hard way, by iterating over the expression and collecting all the f() and add their arguments one by one each `+` subtype. But that is now what I looking for.  

There should be something similar to how it is done in Mathematica, but using Maple command. Notice that the Mathematica example will work regadless of where the f(a)+f(b) shows up.

expr = Sin[x] + f[A] + f[B] + 10*Exp[x]/13 + Cos[x] + f[c] + 1/(f[10*c] + x + f[99])
expr //. f[a_] + f[b_] :> f[a + b]

ps. may be I need to use subsindets['nocache'] need to look more into it.

First 227 228 229 230 231 232 233 Last Page 229 of 2425