MaplePrimes Questions

Hello, 

I have come across a problem in Maple, when I try plotting af slope field from my differential equation. 

I have tried different ways of defining the ODE, but when I use it in the command of "linjeelementer" (Danish for line elements - It's a command that's part of a package called "With (Gym)" in Maple, it gives me the error: Error, (in DEtools/DEplot/CheckDE) - Derivatives must be given explicitly. 

I don't understand what derivatives I must "give explicitly"?

Translation of the relevant sentences if anyone needs it when looking at the screenshot:

"I need to draw a slope field for the differential equation along with the solution curve for the population growth in India after 1960.

I define the differential equation:
ODE := -0.000032229*y^2 + 0.065843*y - 15.103"

"I am drawing the slope field for the differential equation along with the solution curve for the population growth in India after 1960, i.e., the solution curve that passes through the point (0,449):I am drawing a slope field for the differential equation along with the solution curve for the population growth in India after 1960, i.e., the solution curve that passes through the point (0,449):
linjeelementer(ODE, y(t), t = 0 .. 350, y = 0 .. 2000)"

Is there a way to change the font on the help pages?               

restart;
with(geometry);
with(plots);
_EnvHorizomtalName = 'x';
_EnvVerticalName = 'y';
_local(D);
line(delta, y = 1/3*x - 2, [x, y]);
line(deltap, y = (-1)/4*x + 1, [x, y]);
line(D, y = 3*x - 5, [x, y]);
point(S, 3, 0);
omega := Pi/3;
intersection(P, delta, D);
intersection(Pp, deltap, D);
projection(H, S, delta);
projection(K, S, deltap);
projection(M, S, D);
circle(c1, [H, K, M], 'centername' = O1);
display*[textplot*([[coordinates(S)[], "S"], [coordinates(P)[], "P"], [coordinates(H)[], "H"], [coordinates(K)[], "K"], [coordinates(M)[], "M"]], font = [times, bold, 16], align = [above, right]), draw*([delta(color = blue), deltap(color = blue), D(color = red), c1(color = black), S(color = black, symbol = solidcircle, symbolsize = 16), P(color = black, symbol = solidcircle, symbolsize = 16)], scaling = constrained, axes = none, view = [-15 .. 15, -15 .. 15])];
               [                /[             [9  -13     ]  
plots:-display [plots:-textplot |[[3, 0, "S"], [-, ---, "P"], 
               [                \[             [8   8      ]  

  [33  -9     ]  [52  4      ]  [9  2     ]]  
  [--, --, "H"], [--, --, "K"], [-, -, "M"]], 
  [10  10     ]  [17  17     ]  [5  5     ]]  

                                                  \              
  font = [times, bold, 16], align = [above, right]|, geometry:-d\
                                                  /              

  raw ([delta(color = blue), deltap(color = blue), 

  D(color = red), c1(color = black), 

  S(color = black, symbol = solidcircle, symbolsize = 16), 

  P(color = black, symbol = solidcircle, symbolsize = 16)], 

  scaling = constrained, axes = none, view = [-15 .. 15, -15 .. 15])];
  display*[textplot*([[3, 0, "S"], [9/8, -13/8, "P"], [33/10, -9/10, "H"], [52/17, 4/17, "K"], [9/5, 2/5, "M"]], font = [times, bold, 16], align = [above, right]), draw*([delta(color = blue), deltap(color = blue), D(color = red), c1(color = black), S(color = black, symbol = solidcircle, symbolsize = 16), P(color = black, symbol = solidcircle, symbolsize = 16)], scaling = constrained, axes = none, view = [-15 .. 15, -15 .. 15])]
Why the program will not run; Thank tou.

Hello, 

This morning when i tried to open my Maple file, it didn't work and instead wrote "There were problems during the loading process. Your worksheet may be incomplete". Is there anyone that can help me save the document? 

I read in here that i may be due to something in the file but i do not know how to remove it? 

I caught aome serious errors with Maple 22 calculating the Ricci tensor not only wrong for known metrics, but also producing garbage entries in the Ricci tensor e.g. bare thetas where only trigonometric functions of angles are expected. Completely wrong.

That aside,

I need to replace the built in Ricci tensor calculation in Maple and therefore need maple to contract the Christoffel Symbols.

d_[alpha](Christoffel[~alpha, mu, nu]) - d_[nu](Christoffel[~alpha, mu, alpha]) + Christoffel[~beta, mu, nu]*Christoffel[~alpha, beta, alpha] - Christoffel[~beta, mu, alpha]*Christoffel[~alpha, nu, beta]

How do I tell Maple to contract thae alpha and beta indices in above expression, without crudely having to set up Summing.?

Hi,

I'm trying out the 2024 version of Maple and I'm getting the following warning message:

Warning, not a built-in function (`rtable_alias`)

which I didn´t get for the 2023 version. I have no clue where it is coming from since it happens even when I start a new worksheet:

 

 

I've also attached print outs of the same worksheets (from Maple help examples and from Maple Portal), one using Maple 2023 version and the other one using Maple 2024 version so youcould see the warning and some other problems.

I really appreciate if someone would have an idea of what is going on here. Thanks very much in advance.

interpolation_2023.pdf

interpolation_2024.pdf

optimization_2023.pdf

optimization_2024.pdf

Download Ode_New_TWO_phase.mw

I want like this plots here two phase are there boundary is -2 to0 and 0 to 2

f(±2)=0,g(±2)=0,f(0)=1,h(±2)=1,H(±2)=1

This is perhaps a stupid question. It is quite easy to add a vector with minutes to 60 minutes. However, when I try to do this stating 1 hour instead of 60 minutes it does no longer do the calculation. Why is this? Thank you for any explanation.

QuestionMP.mw

In the example below, the second call to simplify is ineffective

eq := (a*x + b)/(c*x + d) = 1;

`simplify/nodenom`:= x -> (numer@(lhs - rhs) = 0)(x);                       
                      
`simplify/nodenom`(eq);
simplify(eq, nodenom);

Why is that?
Convert, for example, works

`convert/nodenom`:= x -> (numer@(lhs - rhs) = 0)(x);

`convert/nodenom`(eq);
               
convert(eq, nodenom);

 

Let M a matrix of zeros and ones for instance.

N := 10^5:  # This is the order of magnitude I have to consider (10^4 may be enough if L is "small")
L := 5:     # L is between 3 and 8 in practice (see context at the end of this post)
M := LinearAlgebra:-RandomMatrix(N, L, generator=0..1):

Let C a set of colums of M and |C| the number of elements of C.
Let P a list of length |C| of  zeros and ones.

I want to count al the rows in M such that 

`and`( seq( M[n, C[k]] = P[k], k = 1.. |C| ) )

For instance

pattern := n -> `if`(evalb(`and`(seq(S[n, C[k]]=P[k], k=1..3))), 1, 0):
t0 := time():
add(pattern(n), n=1..N);
time()-t0
                             12351
                             0.431  # seconds

This code appears to be quite slow when one consider that I have to run it for all the possible choices of C and P (the contect is detailed below).

Do you have any some ideas to improve the efficiency (in terms of computational time) of this counting operation?
Thanks in advance





The context:
Let A = {1, 2, .., L} and P(A) the power set of A.
I set Q(A) = P(A) \ ( { } union A}.
Let C and C'  two disjoint subsets of Q(A).
Example

# With L=3

Q(A) = { {1},  {2},  {3},  {1, 2},  {1, 3},  {2, 3} }

# if A chose C = 
C = {2}

# Then C' is member of 
C' in { {1}, {3}, {1, 3}

For any couple (C, C')  I want to do this

  1. Let |C| (|C'|) cardinal of C (resp C').
     
  2. Let us consider that members of C (resp C') "point to" the corresponding columns of M.
    for instance C = {2, 3} refers to columns 2 and 3 of M.
    As C and C' are ordered iI will write them indistinctely as lists (for instance C = [2, 3] in example above) when necessary.
     
  3. To a given |C| (|C'|) one may associate 2|C| (resp 2|C'|) sequences of 0 and 1.
    For instance,  to C = {2, 3} are associated sequences [0, 0], [0, 1], [1, 0], [1, 1].
    Let s(C) (s(C')) the list, or set, of 0-1 sequences associated to C (resp C')..
     
  4. For any couple (C, C') and any of the 2|C|+|C'| combinations (p, p') where p belongs to s(C) and p' belongs to s(C') I want to count the number of occurrences defined by: 
    seq( M[n, C[k]] = p[k], k=1..|C|) and seq( M[n, C'[k]] = p'[k], k=1..|C'|) 

    For instance, if C={2} and C={1, 3} I want to count the number M rows M such that 

    p = [0], p'=[1, 0]
    M[n, 2]=0 and M[n, 1]=1 and M[n, 3]=0;
    
    p = [1], p'=[1, 1] 
    M[n, 2]=1 and M[n, 1]=1 and M[n, 3]=1
    
    ... and so on

The computational time may ne quite large because of the number of possible couples (C, C') when L is large ( there exists  Stirling2(L+1, 3) such couples: already 90 couples for L=5  ... and 28501 for L=10).

Hi,

I hope everyone is fine here. I want to write the following nested loop in my code

restart; TOL := 10^(-3); v[i] := 10^(-4); u[i] := 10^(-4);
if abs(v[i]-1)<=TOL then    if abs(u[i])<=TOL then break    else t[i+1]:=t[i]+alpha; else; fi; fi;

it is not working. If the first condition (v[i]-1)<=TOL is fulfilled, then we have to check the second condition, u[i]<=TOL. That’s why I don’t use “and” here. If both conditions are fulfilled, then stop the loop and if second the condition not fulfilled (but first fulfill) then t[j+1]=t[j]+alpha. 

I shall be waiting for your positive response.

How to solve a ODE system using Newton's finite difference method?
How to plot f', theta and phi functions for various alpha values.

Difference.mw

Dear All,

I want all calculations in Maple code to be done with double precision. Using Digits:=18 and evalf greatly affects the calculation speed. But using the evalhf performs calculations much faster. The problem is that the evalhf cannot work with expressions that contain symbolic terms. For example, the evalhf(1/3*x+1/5*exp(-x^2)) generates an error. How can I perform calculations on expression with double-precision floating point without significantly slowing down the calculation speed? Is there a method that can be used at the beginning of the code to use double precision (preferably hardware) in all computation steps without slowing down the computations, unlike software floating-point computations?
Best wishes
 

Digits:=18;
evalf(1/3.);
evalhf(1/3.);


str:=time[real]();
for i from 1 to 100000 do
evalf(sqrt(3)*i):
end do:
time[real]()-str;

 

str:=time[real]();
for i from 1 to 100000 do
evalhf(sqrt(3)*i):
end do:
time[real]()-str;

 

Dear All,

I have the following algebraic function. In vibrations, it is common to write the functions exp(alpha[i]*I*t) as separate terms of cos(alpha[i]*t) and sin(alpha[i]*t). While exp(-beta[i]*t) remains without converting to sinh and cosh. How can I find the solution given for T(t) as the sum of terms C1[i]*sin(alpha[i]*t)*exp(-beta[i]*t) and C2[i]*cos(alpha[i]*t)*exp(-beta[i]*t) with non-complex (real) coefficients C1[i] and C2[i].

Can anyone help me to achieve my goal in the following expression?

 

T(t):=(1.450761945*10^(-11) + (3.836655196*10^(-14))*I)*exp((-0.5000000000 + 222.6866468*I)*t) + (-3.770333746*10^(-9) + (2.179000257*10^(-6))*I)*exp((-0.5000000000 - 924.5904413*I)*t) + (-2.584086158*10^(-12) + (4.273321932*10^(-13))*I)*exp((-0.5000000000 + 326.7549627*I)*t) + (1.986287340*10^(-9) + (1.330623218*10^(-11))*I)*exp((-0.5000000000 - 74.63720909*I)*t) + (-5.980910367*10^(-12) + (5.816480027*10^(-11))*I)*exp((-0.5000000000 - 453.7574402*I)*t) + (1.450761945*10^(-11) - (3.836655196*10^(-14))*I)*exp((-0.5000000000 - 222.6866468*I)*t) + (8.923968224*10^(-10) - (8.844466162*10^(-9))*I)*exp((-0.5000000000 + 637.9999953*I)*t) - (1.217986141*10^(-10) + (4.431771836*10^(-13))*I)*exp((-0.5000000000 - 138.7904660*I)*t) + (-1.217986141*10^(-10) + (4.431771836*10^(-13))*I)*exp((-0.5000000000 + 138.7904660*I)*t) + (0.0002537882980 + 0.00002277791755*I)*exp((-0.5000000000 - 5.570928456*I)*t) - (3.770333746*10^(-9) + (2.179000257*10^(-6))*I)*exp((-0.5000000000 + 924.5904413*I)*t) + (-0.0001618723219 + 0.01288449595*I)*exp((-0.5000000000 - 1638.001654*I)*t) + (8.923968224*10^(-10) + (8.844466162*10^(-9))*I)*exp((-0.5000000000 - 637.9999953*I)*t) + (-1.153529195*10^(-7) + (1.908444485*10^(-9))*I)*exp((-0.5000000000 + 30.22171212*I)*t) - (1.153529195*10^(-7) + (1.908444485*10^(-9))*I)*exp((-0.5000000000 - 30.22171212*I)*t) - (0.0001618723219 + 0.01288449595*I)*exp((-0.5000000000 + 1638.001654*I)*t) + (1.986287340*10^(-9) - (1.330623218*10^(-11))*I)*exp((-0.5000000000 + 74.63720909*I)*t) + (0.0002537882980 - 0.00002277791755*I)*exp((-0.5000000000 + 5.570928456*I)*t) - (5.980910367*10^(-12) + (5.816480027*10^(-11))*I)*exp((-0.5000000000 + 453.7574402*I)*t) - (2.584086158*10^(-12) + (4.273321932*10^(-13))*I)*exp((-0.5000000000 - 326.7549627*I)*t);

Dear All,

I have the given expression f as follows. I want to extract terms with sin, sinh, and exp in this expression. For example, for sin, cos, sinh and exp, I want the outputs to be -4*sin(x), -5*cos(x^3)*sin(y^2), 5*sinh(x^2) and 2*exp(y^2), respectively. Also, if I want to get terms having sin(x) and sin(y^2), I like to receive -4*sin(x) and -5*cos(x^3)*sin(y^2), respectively. And also, for terms including sinh(x^3), I want to get Void output. The above goals cannot be achieved with the following commands. Can anyone help me?

f := -4*sin(x) + 2*exp(y^2) + 5 - 5*cos(x^3)*sin(y^2) + 5*sinh(x^2);

indets(f, trig);

selectfun(f, exp);

selectremove(has, f, trig);

First 6 7 8 9 10 11 12 Last Page 8 of 2329