MaplePrimes Questions

I wanted to change  eq:= 1/2 * sqrt(-2*lambda)  to 1/2 %* sqrt(-2*lambda)  using a rule.

It works outside of rule ofcourse. But when I put %* in the RHS of the rule, maple hangs. It seems it is going into infinite loop.

I tried the trick of using '%*' but this gives syntax error.

Same problem happens when using %. and not just %*

Is there a workaround?

Attached worksheet. Make sure to save all work before trying it.
 

interface(version);

`Standard Worksheet Interface, Maple 2024.1, Windows 10, June 25 2024 Build ID 1835466`

Physics:-Version()

`The "Physics Updates" version in the MapleCloud is 1804. The version installed in this computer is 1802 created 2024, September 3, 11:35 hours Pacific Time, found in the directory C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib\`

libname;

"C:\Users\Owner\maple\toolbox\2024\Physics Updates\lib", "C:\Program Files\Maple 2024\lib"

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

eq:= 1/2 %. sqrt(-2*lambda); #no problem

`%.`(1/2, (-2*lambda)^(1/2))

eq:= 1/2 %* sqrt(-2*lambda); #no problem

`%*`(1/2, (-2*lambda)^(1/2))

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

applyrule(sqrt(x::anything)/y::anything = 1/y %. sqrt(x),eq); #why this hangs?

 

restart;

eq:= 1/2 * sqrt(-2*lambda)

(1/2)*(-2*lambda)^(1/2)

applyrule(sqrt(x::anything)/y::anything = 1/y %* sqrt(x),eq); #why this hangs?

 


 

Download maples_hangs_applyrule_sept_10_2024.mw

I cannot find anything in the documentation that could explain the below.

NULL

According to ?name  the character ? can be used in a name with the exception of beeing the first character.
Example:

abc?:=2;
abc?

2

 

2

(1)


Reentering the name in 2D

"abc"?""

abc

(2)

In 2D the nane "abc"?"" does not seem to exist.

Trying now as above

"abc"?:=a:"  abc"?""

abc^2

(3)

returns an unexpected output.
Trying

"ab"?c:=b;"  "

ab

(4)

"a"?b:=c""

a

(5)

seems to cut of everything that follows the question mark (including the question mark).
This could explain the output (3) as having been parsed as abc*abc.

``


The variable palette only lists the name entered in 1D.

What could explain the difference between 1D and 2D when "?" is used in a name.

Download Questionmark_in_2D_names.mw

how we can make pretty of changing equation or case in maple to latex but be more readble and be simplify and the scientific referee don't reject the writting for example in this picture when i do convert i get something like that

 

if you watch the result 1 it is better denomenator which is 2 come out will be better and then times multiply by radical so how we do something like that?

latex2.mw

Hello,

Please help me solve this type of equations, I have more of them, but there is only one in the attached file. fsolve does not work. Please help.

Best regards!

tg_Test.mw

The help page of interface('longdelim') states: 

If true, Maple control structures such as if, do, proc, and so on are displayed with the newer-style long ending delimiters such as end if, end do, end proc, and so on. If false, ending delimiters are displayed as fi, od, end, and so on

If I set interface('longdelim' = false):, the Maple Input

try f:=0 catch:end try;

can be converted into 

via , but why is

use f=0 in f+1 end use;

still converted into

 instead of “use f = 0 in f + 1 end”? 

According to the documentation, 

the depends modifier can be used in declaration to indicate that a parameter's type depends on the value of another parameter, the seq modifier declares that multiple arguments of a specific type within a procedure invocation will be assigned to a single parameter, and if the depends modifier is used together with the seq modifier, the declaration must be written: . 

So the code below works as expected: 

f0 := proc(x::Not(2), y::2) [[x], [y]] end:
f0(1, 2);
                           [[1], [2]]

f0(2, 2);
Error, invalid input: f0 expects its 1st argument, x, to be of type Not(2), but received 2

The code below also works as expected: 

f1 := proc(x::depends(Not(y)), y::2) [[x], [y]] end:
f1(1, 2);
                           [[1], [2]]

f1(2, 2);
Error, invalid input: f1 expects its 1st argument, x, to be of type Not(2), but received 2

The code below works as desired as well: 

f2 := proc(x::seq(Not(2)), y::2) [[x], [y]] end:
f2(0, 1, 2);
                         [[0, 1], [2]]

f2(2, 1, 2);
                           [[], [2]]

However, the following code does not work: 

f3 := proc(x::seq(depends(Not(y))), y::2) [[x], [y]] end:
f3(0, 1, 2);
Error, invalid input: NULL uses a 2nd argument, y (of type 2), which is missing
f3(2, 1, 2);
Error, invalid input: NULL uses a 2nd argument, y (of type 2), which is missing

I believe that the output of  and  should be the same as that of  and  respectively. Did I miss something? 

Hi everyone! I meet some code issue when editing a easy sum of geometric sequence as belows, I can write another procedure sum total, it can run. But I wanna also try the sequence (the middle code) but failed, and why nops can not work? Thanks!

NULL

myfac := proc (n::nonnegint) local out, i, a, q; a := [3]; q := 2; out := a[1]; for i from 0 to n do out := out*q^i end do; out end proc; myfac(4)

3072

(1)

sum(myfac[i], i = 0 .. nops(myfac))

myfac[0]+myfac[1]

(2)

sum(myfac[i], i = 0 .. 4)

myfac[0]+myfac[1]+myfac[2]+myfac[3]+myfac[4]

(3)

values := [seq(myfac(i), i = 0 .. nops(myfac))]; sum_values := sum(myfac(i), i = 0 .. nops(myfac)); values; sum_values

[3, 6]

 

Error, invalid input: myfac expects its 1st argument, n, to be of type nonnegint, but received i

 

[3, 6]

 

sum_values

(4)

sum_myfac := proc (n::nonnegint) local i, total; total := 0; for i from 0 to n do total := total+myfac(i) end do; total end proc; sum_myfac(3)

225

(5)

NULL

Download sum_of_geometric_sequence.mw

Hello everyone 

Any one can help to plot a figure as follows 

" A cross section of three colored basins of attraction on an (x, y)

plane at z = 0 and w = 0 for a = 2.48 and b = 0.5. Basins in green, red, and cyan leads to a strange attractor, a limit cycle, and a line equilibrium, 

respectively. The yellow leads to unbounded orbits. " Where the system 

xdot=y 

ydot=z

zdot=w

wdot=-az-bw-y-xy. 

and range of x=[-6,6] and y=[-3,6]. 

With the attached task I would like to learn how Maple handles polynomials and plots. For this I have chosen a task with an interesting history from 1593. Adriaan van Roomen posed it to F. Vieta, who solved it after a short consideration.

My questions are:
1.) How are very long terms entered and displayed in Maple in an appropriate manner?
2.) How are the graphs of several functions displayed in the same coordinate system?
3.) Which graphics settings must be selected for differentiable functions in order to obtain nice, rounded curves rather than angular ones from the numerical result?
4.) Can the apparently random oscillations of the curve at the end of the interval be suppressed?
5.) The curves for p(x) and sinnx(x) are theoretically identical, since p(x) is the trigonometric expansion of sinnx(x). Their graphs must therefore be identical. How can this be displayed?
6.) The polynomial has many real zeros. How can the zeros be clearly presented in a table?

AF_20240909.mw

This is an excersise in one of Mathematica's tutorials. The problem is to find from all persumtations of [1,2,3,4] those lists which has 2 in them before 3.

But the idea is that 2 can be anywhere before the 3, with possibly zero or more numbers between.

Will show how to do this in that other software, and ask if there is a way using Maple pattern matching or better way to do this in Maple better than what I did.

L=Permutations[{1,2,3,4}]
Cases[L,{___,2,___,3,___}]

gives

{{1, 2, 3, 4}, {1, 2, 4, 3}, {1, 4, 2, 3}, {2, 1, 3, 4}, 
{2, 1, 4,  3}, {2, 3, 1, 4}, {2, 3, 4, 1}, {2, 4, 1, 3}, 
{2, 4, 3, 1}, {4, 1,  2, 3}, {4, 2, 1, 3}, {4, 2, 3, 1}}

We see in all of the above, 2 is before 3.

In that other software, the ___ means there is zero or more things.  I could not find how to do this in Maple's pattern matching. So had to use has and then find the index of 2 and 3 in each list and check if the index of 2 is smaller than the index of 3. Which is kinda awakard and not as elegent as using a pattern, but it gives same result.

L:=combinat:-permute([1,2,3,4]);
map(X->`if`(has(X,2) and has(X,3) and ListTools:-Search(2,X)<ListTools:-Search(3,X),X,NULL) ,L);

Gives

[[1, 2, 3, 4], [1, 2, 4, 3], [1, 4, 2, 3], [2, 1, 3, 4], 
[2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], 
[2, 4, 3, 1], [4, 1, 2, 3], [4, 2, 1, 3], [4, 2, 3, 1]]

Can you suggest a way using either patmatch or applyrules in Maple to do the same?  

Could this be done easier than what I did using evalindents without the need for pattern?

I find patterns easier to work with myself.

ps. converting each list to string, and then using regular expression or string matching, is not what I am looking for. 

ps. the check in Maple code of has(X,2) and has(X,3) is not really needed here, since we know each list will have 2 and 3 in them. But I kept these to make it more general for other type of problems where these extra checks might be needed.

Hi everyone, is there any source of Maple competitions? Or related questions? I have a hard time finding books on this subject. I am very interested in Maple and hope to improve my Maple programming skills. In addition to frequently browsing this website, I encounter problems on the Internet sporadically, so I think starting with competition questions will be a quick way to improve.

Hi,

just a simple question: Is it possible to write if statments in Mapleflow, like (this is just a simple example, not what I would like to code!):

a:= 2

b:=5

if ( a > b ) then c:=a else c:=b end if

and, if so, how to do it? I've tried the above code but got the error

"internal error: unhandled case IF in subsindents"

Good morning, please, could you tell me how to graph this solid of revolution using implicitplot and shade the intersection zone as seen in the graph.

x=y-y^2

x=y^2-3

Around x=2

can someone help me curve fitting these parameeters...i only got 1 for all of this 90As4.mw

restart

with(Statistics)with(plots)with(Optimization)with(LinearAlgebra)

E[1] := 126*10^9E[2] := 11*10^9G[12] := 6.6*10^9G_0__12 := 10.1*10^9nu[12] := .28E_0__2 := 15.5*10^9

true_strain := [0, .406915, .710106, .989362, 1.28457, 1.53989, 1.86702, 2.21011, 2.625, 2.99202]; true_stress := [0, 46.0227*10^6, 81.8182*10^6, 109.091*10^6, 138.068*10^6, 163.636*10^6, 194.318*10^6, 219.886*10^6, 248.864*10^6, 267.614*10^6]; epsilon_dot := 10^(-4)

sigma_t := map(proc (epsilon) options operator, arrow; E[instantaneous]*(1-lambda[90*deg]*epsilon*(sum(P[i], i = 1 .. 10)-(sum(P[i]*exp(lambda[i]*epsilon/epsilon_dot), i = 1 .. 10)))/epsilon_dot)*epsilon end proc, true_strain)

``

obj := sum((sigma_t[i]-true_stress[i])^2, i = 1 .. 10)

indets(obj, name)

{E[instantaneous], P[1], P[2], P[3], P[4], P[5], P[6], P[7], P[8], P[9], P[10], lambda[1], lambda[2], lambda[3], lambda[4], lambda[5], lambda[6], lambda[7], lambda[8], lambda[9], lambda[10], lambda[90*deg]}

(1)

Optimization[Interactive](obj)

The solution was obtained with the following warning:
  no iterations performed as initial point satisfies first-order conditions

 

[Float(infinity), [E[instantaneous] = HFloat(1.0), P[1] = HFloat(1.0), P[2] = HFloat(1.0), P[3] = HFloat(1.0), P[4] = HFloat(1.0), P[5] = HFloat(1.0), P[6] = HFloat(1.0), P[7] = HFloat(1.0), P[8] = HFloat(1.0), P[9] = HFloat(1.0), P[10] = HFloat(1.0), lambda[1] = HFloat(1.0), lambda[2] = HFloat(1.0), lambda[3] = HFloat(1.0), lambda[4] = HFloat(1.0), lambda[5] = HFloat(1.0), lambda[6] = HFloat(1.0), lambda[7] = HFloat(1.0), lambda[8] = HFloat(1.0), lambda[9] = HFloat(1.0), lambda[10] = HFloat(1.0), lambda[90*deg] = HFloat(1.0)]]

(2)
 

NULL

Download 90As4.mw

I apologize for putting the equations in image format, but I thought that this way the community could better understand how to interpret the equations.

Below are 6 letters whose solution must be developed step by step so that the periodic extension of each one can then be done. I can solve all the letters by hand (solving in the notebook), but my big question is, how can I do the commands in Maple step by step so that I can solve them as if I were doing them by hand (look like in my notebool)? I need to check step by step. I would be extremely grateful for the help of any of you.

second part

First 20 21 22 23 24 25 26 Last Page 22 of 2374