Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

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

 

 

The concept of “Maple Learn art” debuted on the MaplePrimes blog in December 2021.  Since then, we’ve come a long way with new Maple Learn features and ever-growing creative minds.  Creating art using mathematical expressions and shapes is a great way to hone both your mathematical skills and your creativity, and is the perfect break from a bout of studying or the like.

I started my own Maple Learn art journey over one year ago.  Let’s see how one’s art can improve over time using new and advanced features!

Art with Shapes, March 2022

This pi-themed pie is simple and cute, but could use some additional features:

Adding Shaded() around Maple Learn shape commands colors them in!

Fun fact: I hand-picked all of the coordinates for that pi symbol.  It was an arduous but rewarding process.  Nowadays, I recommend a new method.  When you create a table in Maple Learn with two number columns, the values are plotted as points.  These points can be clicked and dragged across the plot window, and the table updates automatically to display the new coordinates.  How can you use this to make art?

  1. Create a table as described above.
  2. Move the points with your mouse to create an outline of the desired shape.
  3. Use the coordinates from your table in your geometry command.

Let’s apply these techniques in a newer piece: a full recreation of the spaghetti emoji!

Art with Shapes, August 2023

Would you look at that?!  Fully-shaded colors, a background, and lines of spaghetti noodles that weren’t painstakingly guesstimated combine to create a wonderfully improved piece of art.

Art with Animation, March 2022

Visit the document to see its animation.  Animation is an invaluable feature in Maple Learn, frequently utilized to observe how changing variables affect functions or model a concept.  We’ve harnessed its power for animated artwork!  This animation is cute, using parametric functions and more to change the image as the animation variable changes.  Like the previous piece, it’s missing a background, and the leaves overlap the stem awkwardly in some places.

Art with Animation, August 2023

 

This piece has a simple background made with a large black square, but it enhances the overall effect.

The animation here comes from piecewise functions, which display different values based on a given criterion.  In this case, the criterion is the current value of the animation variable.

There are 32 individual polygons in this image (including 8 really tiny ones along the edges!) and 8 rainbow colors.  Each color is associated with a different piecewise function, and displays four random squares in that color in each frame of the animation.

This image isn’t that much more advanced than the animated flower, but I think the execution has vastly improved.

Whether you’ve been following these blog posts since December 2021 or are new to Maple Learn, we hope you give Maple Learn art a try.

And don’t forget that Maple is also a goldmine of artistic potential.  Maple’s bountiful collection of packages such as Fractals, ColorTools, plottools and more are great places to start for math that is as aesthetically pleasing as it is informative.

This week, our staff participated in a series of art challenges using either Maple Learn or Maple itself, each featuring a suggested theme and suggested mathematical content.  Check out the challenges and some of our employees’ entries below, and try out a challenge for yourself!

 

Tuesday’s Art Theme: Pasta

Mathematical Content: Shapes

Example: Lazar Paroski’s spiraling take on spaghetti

 

Wednesday’s Art Theme: Nature

Mathematical Content: Fractals

Example: John May’s Penrose tiling landscape (in Maple!)

 

Thursday’s Art Theme: Disco

Mathematical Content: Animation

Example: Paulina Chin’s disco ball (in Maple!)

 

Friday’s Art Theme: Space

Mathematical Content: Color

Example: that’s today!  Who knows what our staff will create…?

 

We hope these prompts have inspired you! If you create some art you’re really proud of, consider submitting it to be featured in the 2023 Maple Conference’s Creative Works Showcase.

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?

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

Hi,
I have a function "w" that the eval command does not gives the correct value of its first derivative at a fixed point. I guess the problem is due to sqrt() terms, but I can't fix it. 
eval.mw

Hello everyone! I have found this document from Maple 18 (2014) that will be very usefull for my school work, but when i copy it into Maple 2022 i get the error message, "action, does not evaluate to a module" Is there any way for me to fix this? What i have been able to read is that i have to go in and update the code, but i have absolute no idea on how to do it? 

Kind Regards Samuel 

Regressionmodeller._Skal_laves_til_maple_22_og_23.mw

How can I plot stream lines between two concentric spheres?

Hi,

I am using Maple 2020 to numerically solve/generate numerical plots for my impulsive control problem.

The optimal control problem is:

T is time from0 to T where T is the terminal time

K(t), B(t) and M(t) are state variables

w(t) is a control variable

a(ti) is the impulsive control variable at time ti,

a(ti) \in [0,1] for i=1,2,…,N

ggamma, ttheta, ddelta1, ddelta 2, c1 and c2 are constants

K(T)=M(T)=0 B(T)>0

K'(t)=ggamma*K(t)*w(t)-ttheta*M(t)

B’(t)=ggamma*K(t)+ttheta*M(t)*B(t)

M’(t)=M(t)-ggamma*w(t)

M(ti)=M(ti-)+a(ti)M(ti)*ddelta1

K(ti)=K(ti-)-a(ti)K(ti)*ddelta2

Objective: maximize B(T)-integral from 0 to T of c1*(w(t))^2dt-sum i=1 to N of c2*a(ti)

Here is the code I enter to MAple:

restart;

# Define the constants
ggamma := 1.0;
ttheta := 2.0;
ddelta1 := 0.1;
ddelta2 := 0.2;
c1 := 0.5;
c2 := 0.3;
T := 5.0; # Terminal time

# Define the impulsive changes in M(t)
impulse_changes := proc (t)
    local ti_values, imp_values, result;
    ti_values := [1.0, 2.0, 3.0]; # Example impulsive time instants
    imp_values := [0.2, 0.1, 0.3]; # Corresponding impulsive control values
    result := 0;
    for i from 1 to nops(ti_values) do
        if t = ti_values[i] then
            result := result + imp_values[i]*M(ti_values[i])*(ddelta1 - ddelta2);
        end if;
    end do;
    return result;
end proc;

# Define the system of differential equations
diffeqs := {diff(K(t), t) = ggamma*K(t)*w(t) - ttheta*M(t),
            diff(B(t), t) = ggamma*K(t) + ttheta*M(t)*B(t),
            diff(M(t), t) = M(t) - ggamma*w(t)};

# Define the impulsive controls
impulse_controls := [1.0, 0.5, 0.8]; # Example impulsive control values

# Define the initial values and conditions
initial_values := [K(0) = 0, B(0) = 0, M(0) = 0];

# Define the final conditions
final_conditions := [K(T) = 0, M(T) = 0, B(T) > 0];

# Define the objective function to be maximized
objective := B(T) - int(c1*w(t)^2, t = 0 .. T) - add(c2*impulse_changes(ti), ti = 1.0 .. 3.0);

# Solve the system of differential equations numerically
sol := dsolve({diffeqs, initial_values, final_conditions}, numeric, output = listprocedure);

# Find the optimal control trajectory w(t) using optimization
w_optimal := optimize(objective, numeric, maximize);

# Evaluate the optimal control and state trajectories
optimal_controls := [seq(w_optimal(t), t = 0.0 .. T, 0.1)];
state_trajectories := [sol[2](t), sol[3](t), sol[4](t)];

optimal_controls, state_trajectories;

I am getting the error:

"Error, (in dsolve/numeric/process_input) system must be entered as a set/list of expressions/equations"

as soon I run after the sol:= function.

I would appreciate any help with fixing my code!

Thank you very much!

Hafiz_basin_of_attraction_.mw

[moderator: see also this earlier Question]

Hi Users!

I hope everyone is fine. I want to plot any function say
f := exp(cos(x)+sin(x)) for x=a..b for any n say 12 so that h := (b-a)/n. 

For a=0, b=3 and n=12 I got h=1/4 and plot of f is:

But I want the plotting as given bellow where the value of f(x) is mentioned and girds line.

I am waiting for your answer. Thanks in advance.

 

First 57 58 59 60 61 62 63 Last Page 59 of 2097