MaplePrimes Questions

Given list L:=[3,4,x,x^2,x^3]; return list of all exponents of x (other than 1). So result should be [2,3]

But this has to be done using patmatch, as this is what I am learning. Not using other means. This is my current code that does this.

restart;
L:=[3,4,x,x^2,x^3];
f:=proc(X::anything,x::symbol)
 local la,n;
 if patmatch(X,x^n::nonunit(anything),'la') then
    assign(la);
    RETURN(n);
 else
    RETURN(NULL);
 fi;
end proc;

map(X->f(X,x),L);

Returns [2,3]

I wanted to shorten it using `if` so that no need to call external function f() as shown. So I wrote

L:=[3,4,x,x^2,x^3];
map(X->`if`( patmatch(X,x^n::anything,'la'),[assign(la), n],NULL),L);

But the problem is that on first entry, the assign(la) now assigns value to and hence it is no longer a name for the next element in the list L. This gives error

Error, (in PatternMatching:-AlgStruct:-Match) first operand of `::' must be a name
So I added  unassign('n') like this

restart;
L:=[3,4,x,x^2,x^3];
map(X->[unassign('n'),`if`( patmatch(X,x^n::nonunit(anything),'la'),[assign(la), n],NULL)][],L);

And now this returns 

            [[2], [3]]

How to make it return [2,3]? Why did it add extra []? How can the above be shortened more? and still return [2,3]

edit: I found how to get rid of the extra [], like this

restart;
L:=[3,4,x,x^2,x^3];
map(X->[unassign('n'),`if`( patmatch(X,x^n::nonunit(anything),'la'),[assign(la), n][],NULL)][],L);

Now it returns [2,3] , needed to add extra [] after each closing [.....]

In another system, the code is 

Cases[{3, 4, x, x^2, x^3}, x^n_ -> n]

    {2, 3}
   

I was trying to make the Maple code as short as possible. I know it will not be as short as the above.

The question is: Can above code be made shorter but still use patmatch?

Again, I am looking for only solution using patmatch. I know I can use select and types in Maple to do this also.

Maple 2024.2

How to insert a file inside another file, creating a session, without equations with the same name conflicting?

Is there another way to change the x-axis values other than tickmarks? For example on an interval [0,4*Pi]

restart; with(plots); with(DEtools)

Ode1 := diff(y(t), t, t) = cos(t)

diff(diff(y(t), t), t) = cos(t)

(1)

IC := (D(y))(0) = 0, y(0) = 1

(D(y))(0) = 0, y(0) = 1

(2)

gsol := dsolve(Ode1, y(t))

y(t) = -cos(t)+c__1*t+c__2

(3)

exactsol := dsolve({IC, Ode1}, y(t), numeric, output = listprocedure)

odeplot(exactsol, [t, y(t)], 0 .. 4*Pi, color = blue, title = "Solution to the Differential Equation", labels = ["t", "y(t)"])

 

Download directly_integrable.mw

Hi every one, i want to identify the Chaotic behavior for the system :

at : w = 1, delta = 0:8,
k = 0:2, m = 2, epsilon = 1, n = 2, f0 = 0:6; mu = 2,1    and initial condition (0:1; 0:05).

A farmer has exactly 100m of wire mesh fence available to enclose a pasture. The fence must begin and end at his large oak tree. To do this, imagine the usual "north-south/west-east" cross of the cardinal directions in the drawing plane. The oak tree is at the center of this.

1. All land that lies west of the imaginary axis is not worth a cent.

2. All land that lies east of the oak tree becomes continuously more expensive the further it is from the north-south axis. The property value is based on the function y = k · x, where y represents the price per square meter and x represents the distance in meters to the north-south axis. k is a proportionality factor, which for the task is k = 1 euro/m^3.

a) On which curve must the fence run so that the enclosed pasture area has the greatest possible value?

b) On which curve must the fence run if instead of the distance x from the north-south axis the distance r from the oak tree is decisive with the same factor k?

I was watching Maple's video for conference 2024. In one of the presentation, this example is given

But in my Mapple 2024.2 I get an error typing the same command:

interface(version);

`Standard Worksheet Interface, Maple 2024.2, Windows 10, October 29 2024 Build ID 1872373`

restart;

my_ode:={diff(x(t),t$2)-t^2*x(t)=0, x(0)=1,D(x)(0)=1}:
MultivariatePowerSeries:-PowerSeries(my_ode,t,x);

Error, invalid input: too many and/or wrong type of arguments passed to MultivariatePowerSeries:-PowerSeries; first unused argument is t

 

 

Download powerSeries_nov_14_2024.mw

Link to the video is here  it is around 39:00 in time. 

Any one knows why I get an error using same command shown in the video?

I have solved a simultaneeous equation for a variiable s. I have used command solve. Can i see what happens in background, Each step by which the equations are solved.

I got answer s=j. But how i got it can i see

attaching the sheet: Q_3.mw

This system is from the last century. This one has already appeared several times on the forum.
It is clear that nowadays it is not difficult to find several of its solutions, especially with the help of Maple. But in this case we are talking about a complete solution in real numbers. Of course, there are techniques that practically allow us to talk about such a solution, only without theoretical justification. 
The simple idea of ​​transforming it from transcendental to polynomial and getting a complete solution on a theoretical basis did not lead to a good result: it turned out that this is too complicated work for the  Isolate procedure. Perhaps I made a mistake somewhere, or (and) my old PC is too weak.
(The values ​​of the constants are not very important.)

restart; with(RootFinding):
 b1 := 114.069^2; b2 := 109.2389^2; b3 := 103.892^2; b4 := 99.76348^2; b5 := 97.24296^2; 
f1 := x1^2+x2^2+x3^2+2*(x1*x2*cos(x4)+x2*x3*cos(x5)+x1*x3*cos(x4+x5))-b1; 
f2 := x1^2+x2^2+x3^2+2*(x1*x2*cos(2*x4)+x2*x3*cos(2*x5)+x1*x3*cos(2*(x4+x5)))-b2; 
f3 := x1^2+x2^2+x3^2+2*(x1*x2*cos(3*x4)+x2*x3*cos(3*x5)+x1*x3*cos(3*(x4+x5)))-b3; 
f4 := x1^2+x2^2+x3^2+2*(x1*x2*cos(4*x4)+x2*x3*cos(4*x5)+x1*x3*cos(4*(x4+x5)))-b4; 
f5 := x1^2+x2^2+x3^2+2*(x1*x2*cos(5*x4)+x2*x3*cos(5*x5)+x1*x3*cos(5*(x4+x5)))-b5; 
f := seq(cat(f, i), i = 1 .. 5):
# fsolve([seq(f[i], i = 1 .. 5)]);
for i to 5 do 
F[i] := expand(f[i]);
F[i] := subs(cos(x4) = x4, cos(x5) = x5, F[i]); 
F[i] := subs(sin(x4) = sqrt(-x4^2+1), sin(x5) = sqrt(-x5^2+1), F[i]);
F[i] := subs(sqrt(-x4^2+1) = y4, sqrt(-x5^2+1) = y5, F[i]); 
F[i] := collect(F[i], [y4, y5]); 
F[i] := subs(y4 = sqrt(-x4^2+1), y5 = sqrt(-x5^2+1), F[i]); 
F[i] := op(1, F[i])^2-(sum(op(k, F[i]), k = 2 .. nops(F[i])))^2 
end do:
for i to 5 do 
F[i] 
end do;
#fsolve([seq(F[i], i = 1 .. 5)]);
#T := Isolate([seq(F[i], i = 1 .. 5)], [x1, x2, x3, x4, x5]): j := nops(T);
# T;

Edited: "+" to "-".

I tried connecting Maple to Jupyter Notebook, but it seems that it is not keen on outputting everything within the for loop; it only outputs the last item.

for i from 1 to 24 do
    print(i);
end do;

I've noticed that the Maple interface is always white, and after a long time, it causes eye strain. I wonder if it's possible to adjust the interface color, similar to Mathematica. My system is Windows 11.

Currently, I often use VSCode as an alternative, but some mathematical symbols don't display very clearly.

I have noticed similar discussions, such as this one, but I don’t know how to do it

In the attachment are three plotting issues that might be (partially) related.

 
Jagged shading     

 

 

Loss of color and incomplete clipping

The last one is the most severe because it takes color away when a plotobject is inside another object.

 

How can this be fixed? Explanations always welcome.

Shading_artefacs_and_lost_labels_and_color.mw

 I don't know how to solve with maple the following inequality with respect to the real variable x, n being an integer
Please tell me the procedure.

(f(x,n)>0 and (f(x,n)<0

f := (x, n) -> 2^n/(1 + n*2^n*x^2) - 2*x^2*(2^n)^2*n/(1 + n*2^n*x^2)^2

I have been working on solving a system of PDEs and plotting the results. However I've been encountered issues with setting the spacestep and timestep parameters.

First of all, i attempted to plot graphs t=0..2 using the animate command,

with spacestep = 5*10-4 x 1/151,          timestep=1/1000

However, as shown in the image, an error ocurred indicating that calculations could not proceed after 1.57 sec.

Secondly, i kept the same spacestep but changed the timestep to 1/100 for plotting graphs 
t=0..2. This time, the graphs were plotted without any issues.

I initially beleved that larger spacesteps or timesteps would produce more accurate data. However, in my case, simply increasing these parameters did not work.

I would greatly appreciate if you could provide guidance on what factors should be considered when setting timestep and spacestep parameters, or any experiences in resolving similar issues.

So recently I noticed Youtube (owned by Google) has slowly been chipping away at what you could have for free in the past (1080p vidoes easily downloadable) to 720p then recently removed for pro users only at a monthly price. 

Now I noticed all the maple video content can be watched on youtube.  I no longer see links to download the video for offline viewing later from maplesoft (I think they used to be there) they just seem only available on youtube - and now since youtube is becoming less easily available as saveable videos offline it's almost impossible to save a maplesoft video for offline.  I have a question that only recently just started pondering.  Since I can't download the video from maplesoft - there's no download link anymore- seems only available on youtube.  Have all the training videos, recorded webinars, etc..  become the property of youtube and then by parent company become also property rights of google?

Just wondering, since the digital universe in the last couple of years is changing so rapidly, and google / youtube basically becoming a monopolizing giant, dictating the way videos can be watched.  I mean are maplesoft videos on maplesoft servers, or youtube servers? 

Thought I'd throw this out there for thoughts and discussion. 

Looks like this

From: dsolve_numeric_output_with_extra_brackets.mw

which was derived from a 2d document where I removed all unnecessary overhead.

When the option output=listprocedure is removed, this extra argument is not shown any more.

With that extra argument substitution of a solution into the corresponding ode(s) is not possible.

Any idea why that is? How to avoid or remove it?

First 54 55 56 57 58 59 60 Last Page 56 of 2425