MaplePrimes Questions

While Maple itself is a pleasure to work with, the multitude and persistance of bugs in the Units package doesn't stop to surprise.

Especially as the same bugs come up again and again, after having been fixed i older versions.

In general, working with units and 0 is a pain in the ass. And this one doesn't even need a unit to compare with.

This one works in Maple 2022 - does not work in Maple 2023.

with(Units[Simple]);
min(0, 0);

Hi, 

Im trying to solve a system of 4 non-linear equations using the fsolve function. When i compute the command i seemingly dont get an answer to the system. Maple only prompts the command itself, can any of you locate my mistake or give any input on how to solve the issue. 

My code is as follows: 

restart;
r__C := 400;
r__D := 600;
r__E := 800;
a := 100;
p := 0.7;
q := Pi*a^2*p;
h__eq := 0.9*h__1*(E__1/E__2)^(1/3);
R__Ceq := sqrt(h__eq^2 + r__C^2);
R__C := sqrt(r__C^2 + h__1);
R__Deq := sqrt(h__eq^2 + r__D^2);
R__D := sqrt(r__D^2 + h__1);
R__Eeq := sqrt(h__eq^2 + r__E^2);
R__E := sqrt(r__C^2 + h__1);


eqC := 174.5*10^(-3) = q*(1 + nu)/(2*Pi*E__2*R__Ceq)*(2*(1 - nu) + h__eq^2/R__Ceq^2) + q*(1 + nu)/(2*Pi*E__1*r__C)*(2*(1 - nu) + 0) - q*(1 + nu)/(2*Pi*E__1*R__C)*(2*(1 - nu) + h__1^2/R__C^2);
eqD := 151.7*10^(-3) = q*(1 + nu)/(2*Pi*E__2*R__Deq)*(2*(1 - nu) + h__eq^2/R__Deq^2) + q*(1 + nu)/(2*Pi*E__1*r__D)*(2*(1 - nu) + 0) - q*(1 + nu)/(2*Pi*E__1*R__D)*(2*(1 - nu) + h__1^2/R__D^2);
eqE := 133.2*10^(-3) = q*(1 + nu)/(2*Pi*E__2*R__Eeq)*(2*(1 - nu) + h__eq^2/R__Eeq^2) + q*(1 + nu)/(2*Pi*E__1*r__E)*(2*(1 - nu) + 0) - q*(1 + nu)/(2*Pi*E__1*R__E)*(2*(1 - nu) + h__1^2/R__E^2);
eqA := 401.7*10^(-3) = 2*q*a*(-nu^2 + 1)*(sqrt(1 + (h__eq/a)^2) - h__eq/a)/E__2 + 2*(-nu^2 + 1)*q*a/E__1 - 2*q*a*(-nu^2 + 1)*(sqrt(1 + (h__1/a)^2) - h__1/a)/E__1;


fsolve({eqA, eqC, eqD, eqE}, {E__1, E__2, h__1, nu}, {E__1 = 0 .. 5000, E__2 = 0 .. 5000, h__1 = 0 .. 1000, nu = 0 .. 0.5});
 

 

Picture for refference: 

Hi,

I am using A:=LinearAlgebra:-RandomMatrix(10,10,generator=-10..10) to generate a random matrix. How may I specify that every row of A has at least three non-zero entries? 

Thanks!

The attached worksheet shows a simple operator to calculaute the cartesian product of a set. The code is executed in both 1D and 2D notation in the worksheet.  The code is also placed in a code edit region and in the startup code area if the worksheet.  When entered into a worksheet is either notation, it produces an error message,  Without the local designation, it executes with a warning message. When entered into a code edit region it executes without error or warning.

I assume that this behavior reflects a limitation of the 2d notation or is there a workaround to the problem?

error4.mw

For instance, given nine integer x1, x2, …, x9 satisfying x1, x2, …, x9 ≥ -5 and x13x23+…+x93=0, the goal is to maximize x1 + x2 + … + x9. However, according to Optimization/Options,  is not accepted by the Optimization:-Maximize command. A probable method is applying floor into the optimization variables; unfortunately, I can only get: Error, (in Optimization:-NLPSolve) no improved point could be found

(*restart;*)
vars := [x || (1 .. 9)]:
Optimization:-Maximize(`?()`(`+`, floor~(expr)), [add(floor~(expr) ^~ 3) = 0, expr[] >=~ -5], initialpoint = (unapply~(expr) =~ rand(-5 .. 10))()); # Alternatives to exhaustive search?
Error, (in Optimization:-NLPSolve) no improved point could be found

Is there any workaround to solve this problem? 

I am trying to find a polygon that its graph take this four points as extra point. 
I tried
f := x -> a*x^7 + b*x^6 + c*x^5 + d*x^4 + k*x^3 + l*x^2 + m*x + n;
solve([f(-2) = -5, f(5) = -6, f(6) = 1, f(-1) = 2, eval(diff(f(x), x), x = -2) = 0, eval(diff(f(x), x), x = 5) = 0, eval(diff(f(x), x), x = 6) = 0, eval(diff(f(x), x), x = -1) = 0], [a, b, c, d, k, l, m, n]);


I get. Is there a polymial with lower degree take this four point as extra points?

how I can plot phi[2] as a contour like attached figure?

tez-1.mw


 

restart

``

beta := 2.5; lambda := 0.1e-1; b := Pi; a := Pi; alpha := 1; y[1] := 1.5; y[2] := 1.5; x[1] := -1; x[2] := 1; Q[1] := 40; Q[2] := 35

2.5

 

0.1e-1

 

Pi

 

Pi

 

1

 

1.5

 

1.5

 

-1

 

1

 

40

 

35

(1)

NULL

NULL

v := (2*n-1)*Pi/(2*b)

n-1/2

(2)

Delta := exp(2*v*a)*(alpha*v+beta)*(1+lambda)-(1-lambda)*(alpha*v-beta)

1.01*exp(2*(n-1/2)*Pi)*(n+2.000000000)-.99*n+2.970000000

(3)

g[22] := ((alpha*v+beta)*((1+lambda)*exp(-v*abs(x-xi))+(-1+lambda)*exp(-v*(x+xi)))*exp(2*v*a)+(alpha*v-beta)*((1+lambda)*exp(-v*(x+xi))+(-1+lambda)*exp(-v*abs(x-xi))))/(2*v*Delta)

g[21] := ((alpha*v+beta)*exp(v*(2*a+xi))+(alpha*v-beta)*exp(-v*xi))*exp(-v*x)/(v*Delta)

NULL

u[2] := int(2*g[21]*Q[1]*Dirac(xi-x[1])*sin(n*Pi*y[1]/b)/b, xi = -a .. 0)+int(2*g[22]*Q[2]*Dirac(xi-x[2])*sin(n*Pi*y[2]/b)/b, xi = 0 .. infinity)

NULL

phi[2] := sum(u[2](x)*sin(v*y), n = 1 .. 30)

NULL

``

plot3d(phi[2], x = 0 .. 5, y = 0 .. b)

 

NULL


 

Download tez-1.mw


 

restart

``

beta := 2.5; lambda := 0.1e-1; b := Pi; a := Pi; alpha := 1; y[1] := 1.5; y[2] := 1.5; x[1] := -1; x[2] := 1; Q[1] := 40; Q[2] := 35

2.5

 

0.1e-1

 

Pi

 

Pi

 

1

 

1.5

 

1.5

 

-1

 

1

 

40

 

35

(1)

NULL

NULL

v := (2*n-1)*Pi/(2*b)

n-1/2

(2)

Delta := exp(2*v*a)*(alpha*v+beta)*(1+lambda)-(1-lambda)*(alpha*v-beta)

1.01*exp(2*(n-1/2)*Pi)*(n+2.000000000)-.99*n+2.970000000

(3)

g[22] := ((alpha*v+beta)*((1+lambda)*exp(-v*abs(x-xi))+(-1+lambda)*exp(-v*(x+xi)))*exp(2*v*a)+(alpha*v-beta)*((1+lambda)*exp(-v*(x+xi))+(-1+lambda)*exp(-v*abs(x-xi))))/(2*v*Delta)

g[21] := ((alpha*v+beta)*exp(v*(2*a+xi))+(alpha*v-beta)*exp(-v*xi))*exp(-v*x)/(v*Delta)

NULL

u[2] := int(2*g[21]*Q[1]*Dirac(xi-x[1])*sin(n*Pi*y[1]/b)/b, xi = -a .. 0)+int(2*g[22]*Q[2]*Dirac(xi-x[2])*sin(n*Pi*y[2]/b)/b, xi = 0 .. infinity)

NULL

phi[2] := sum(u[2](x)*sin(v*y), n = 1 .. 30)

NULL

``

plot3d(phi[2], x = 0 .. 5, y = 0 .. b)

 

NULL


 

Download tez-1.mw

 

 

Please, is there anyway I can solve below problem without replacing the Alpha with value? The error I got is "Error, (in fracdiff) Unable to determine ceiling of alpha"

>

>

>-fracdiff(U1, t, alpha)+U1/M-U1^2/(M*K)+diff(U1, t)-(diff(U1, t))/epsilon

>int(%, t)

Dear all
Warm Greetings.

I want to display a solution (only numerical value) of the first derivative of the function for the values of x varies from 0 to 7 with step size 0.01.

I have attached the work file. 
ODE.mw

Please do the needful.

Thanks in advance.

Hi dear Users!

I hope everyone here is fine. I have a function like

f := exp(-t)*(x^2-5*x^3+10*x^5+x+3+.5*x^4)+(1/2)*x^2*(x-1)+2*sin(x);

I have to find the value of t at which the behavior of this function is constant for 6 decimal places against x from 0..1. This is my effort

restart;
N := 20; TOL := 10^(-6); Points := 100000;
f := exp(-t)*(x^2-5*x^3+10*x^5+x+3+.5*x^4)+(1/2)*x^2*(x-1)+2*sin(x);
for j from 0 while j <= 10 do print("\nWhen x = ", j/(10.));
for i from 0 while i <= Points do
g[i, j] := evalf(eval(f, [x = (1/10)*j, t = N*i/Points]));
if `and`(i >= 1, abs(g[i, j]-g[i-1, j]) < TOL) then print("Value of t = ", evalf(N*i/Points)); print("Value of f = ", g[i, j]); break else  
end if end do end do;


The same value is then verified by making graphs

plot([eval(f, t = 1), eval(f, t = 2), eval(f, t = 3), eval(f, t = 4), eval(f, t = 5), eval(f, t = 6), eval(f, t = 7)], x = 0 .. 1, color = [red, green, blue, cyan, yellow, black, purple]);
plot(eval(f, x = .8), t = 0.1e-1 .. N);

 

Here I want to know if is there any more effective maple command to find the value of t rather than using procedures (highlighted by red) or a graphical way.

I have been trying to to get a loop to sum the elements of a list of n size, and then take a certain element of summen list (which meets) a certain condition. And then print it out. 

What I can get it to do is printing the input list, and summing the elements in a new sister list sequence. And then if I for instance want its to print the element in testseq which is less than 15. Then it instead prints all elements less than 15 in testseq. What I would like to do is to move the index, so it only prints 10 and save it to a constant? 

So what am I missing?

test := [1, 2, 3, 4, 5, 6, 7, 10];
               test := [1, 2, 3, 4, 5, 6, 7, 10]


testseq := [seq(sum(test[i], i = 1 .. j), j = 1 .. numelems(test))];
            testseq := [1, 3, 6, 10, 15, 21, 28, 38]

for i to nops(test) while testseq[i] < 15 do
    testseq[i];
end do;
                               1

                               3

                               6

                               10

Is it possible to use the Maple command timelimit(time, procedure(.......)) inside a loop of the type "for j                     do        procedure(.......)                   end do" without getting the error 'time expired" that forgets that value of j and  continue with the next value of j. How?

Is it possible in Maple Flow to reference to another worksheet as you can in Maple? If so, how would you do that? Thanks in advance for your help.

I'm attempting to visualize temperature averages across a 2 dimentional space (e.g., a square plate) with fixed heat sources. The 3rd dimension (z axis) represents temperature.  I have created several visualizations but have questions about how these plots work.  The model is attached and the questions will make sense once you open the worksheet.

  1. Using the "colorscheme" option on a couple of matrixplots, I get the error "[Length of output exceeds limit of 1000000]" and the plot doesn't show.  However using the "display()" command on those same plots does render the plot.  Is there a way around this error (i.e., rendering the plot directly) or should I just suppress the error using a colon at the end of the plot statement and rely on display() to show the plot?
  2. I've created a heat map as one of the visualizations.  Is there a way to access the color values at each of the "cells" of the heat map? I would like to use these colors elsewhere in the model but I'm not sure if there is a way to access the color values.
  3. Using a 3D point plot as one of the visualization options, I use the colorschemes with options "xgradient", "ygradient", and "zgradient".  For some reason, "xgradient" and "ygradient" work as expected but "zgradient" looks the same as "ygradient".  How do I get the color transition to change along the z axis rather than only x and y axes?

Thank you for your help on these questions.

temperature_profile_(experimental)(v01).mw

According to Maple help, the plots:-display function can be called with parameter (P).

P - a set, list or Array (one- or two-dimensional) of plot structures, or an animation structure

Both in the last section of the help function, and code in this example (https://mapleprimes.com/questions/236270-Plot-Objects-Created-Created-With-Geometry), it apparently can be called differently.

  • display(A, B, view = [-3*Pi .. 3*Pi, -1 .. 1])
  • display(F, draw(B))

A, B or F, draw(B) er graphics objects, but the call format is neither a set, list or Array.

Is the explanation for plots:-display incorrect, or am I missing something here?

First 176 177 178 179 180 181 182 Last Page 178 of 2427