MaplePrimes Questions

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.

 

Just wanted to ask, what the issue here is:

restart;
Int(1/(1 - x*ln(x)), x);
IntegrationTools:-Change(%,u=1-x*ln(x),u);

doesn't give the proper transformation. It gives

Int(1/u,u)

Solving for x and writing the transformation in terms of LambertW gives something else, if I'm not mistaken.

Dear Users!

I hope everyone is fine here. I wrote the following statements with the print command:

restart; NN := [4, 6, 8]; a := 0; b := 2; n := 4;
h := evalf((b-a)/n); print("The domain of intergation is [a,b] = ", [a, b]);
f := exp(x); print("The given function is ", f);
Exact := evalf(int(f, x = a .. b)); print("The exact integration in [a,b] is ", Exact);
print("The value of h to divide the domain [a,b] into n subintervals is ", h);
print("Numerical integration in [a,b] is going to perform when h via RECTANGULAR METHOD for n = ", n);

The output is:

                          0.5000000000
        "The domain of integration is [a,b] = ", [0, 2]
                "The given function is ", exp(x)
       "The exact integration in [a,b] is ", 6.389056099
"The value of h to divide the domain [a,b] into n subintervals is ", 0.5000000000
"Numerical integration in [a,b] is going to perform when h via RECTANGULAR METHOD for n = ", 4

I want the actual values of a,b, n and h highlighted in above as:

                            0.5000000000
        "The domain of integration is [a,b] = ", [0, 2]
                "The given function is ", exp(x)
       "The exact integration in [0,2] is ", 6.389056099
"The value of h to divide the domain [0,2] into 4 subintervals is ", 0.5000000000
"Numerical integration in [0,2] is going to perform when 0.5 via RECTANGULAR METHOD for n = ", 4

The code below runs as expected up through the 4th line. At that point ans_all should contain all the multipule ansers to the equation being looked at. I want to look at just the first solution and I would expect the way to do this would be ans_all[1]. However the command ans_all[999999999] is valid, which indicates to me that that's not how you do that. So.... how do I get just the first answer?

equ := sqrt(1 + (-4 + 4*sqrt(2))*x + (16 - 12*sqrt(2))*x^2 + (-24 + 16*sqrt(2))*x^3 + (15 - 8*sqrt(2))*x^4)/(1 + (-4 + 4*sqrt(2))*x + (22 - 12*sqrt(2))*x^2 + (-36 + 28*sqrt(2))*x^3 + (33 - 20*sqrt(2))*x^4):
anit_dev_equ := int(equ,x):
ans_root := eval(anit_dev_equ, [x = 1]) - eval(anit_dev_equ, [x = 0]):
ans_all := allvalues(ans_root):
ans_all[999999999]

could any one help  to plot this.

Here is my code.

PWS.mw

I need to make the graph i have attached match the image below.

Is there any wrong with unknown parameter i found?How to solve this.Please Help.

Dear Maple professionals

I have written two procedures in Maple that are run flawlessly. But when I wrote a simple third procedure that calls those two, I face an error. Can you guide me if I am missing anything? The code is attached. Thank you in advance!
 

``

restart

with(plots)

c := 1; cr := 0.3e-1*c; u := 1; sExp := 0.6e-1*c; s := .65*c

v := 3*c

NULL

FirmModelPP := proc (alpha, delta) local p0, xi0, q0, Firmpf0, G0, Recpf0, Unsold0, Environ0; option remember; xi0 := 1; p0 := min(s+sqrt((v-s)*(c-s)), delta*v+sExp); q0 := u*(v-p0)/(v-s); f(N) := 1/u; F(N) := N/u; G0 := int(F(N), N = 0 .. q0); Firmpf0 := (p0-c)*q0-(p0-s)*G0; Recpf0 := (sExp-cr)*xi0*q0; Environ0 := q0+G0; Unsold0 := G0; return p0, q0, Firmpf0, Recpf0, Unsold0, Environ0 end proc

FirmModelFC := proc (alpha, beta, delta) local p00, xi00, q00, Firmpf00, G00, Recpf00, Unsold00, Environ00, pr00; option remember; xi00 := 1; p00 := s+sqrt((v-s)*(c-s)); if p00 < delta*v+sExp then q00 := u*(v-p00)/(v-s); f(N) := 1/u; F(N) := N/u; G00 := int(F(N), N = 0 .. q00); Firmpf00 := (p00-c)*q00-(p00-s)*G00; Recpf00 := `&xi;00*q00*`(sExp-cr); Unsold00 := G00; Environ00 := q00+Unsold00 else q00 := alpha*u*(v-p00)/(v-s); f(N) := 1/u; F(N) := N/u; G00 := int(F(N), N = 0 .. q00/alpha); pr00 := p00-delta*v; Firmpf00 := (p00-c)*q00-alpha*(p00-s)*G00; Recpf00 := (beta*(pr00-sExp)+sExp-cr)*xi00*q00-(1/2)*(pr00-sExp)*beta^2*xi00^2*q00^2/(u*(1-alpha)); Unsold00 := G00; Environ00 := q00+Unsold00 end if; return p00, q00, Firmpf00, Recpf00, Unsold00, Environ00 end proc

NULL

NULL

"CurrentMetrics:= proc(alpha,beta,delta) option remember;  local  p, q, Firmpf,Recpf,Unsold,Environ; "

Error, unterminated procedure

"CurrentMetrics:= proc(alpha,beta,delta) option remember;  local p, q, Firmpf,Recpf,Unsold,Environ; "

 

"if (FirmModelFC(alpha,beta,delta)[3]>=FirmModelPP(alpha,delta)[3]) then    p:=FirmModelFC(alpha,beta,delta)[1]:  q:=FirmModelFC(alpha,beta,delta)[2]:   Firmpf:=FirmModelFC(alpha,beta,delta)[3]:  Recpf:=FirmModelFC(alpha,beta,delta)[4]:  Unsold:=FirmModelFC(alpha,beta,delta)[5]:   Environ:=FirmModelFC(alpha,beta,delta)[6]:     else   p:=FirmModelPP(alpha,delta)[1]:  q:=FirmModelPP(alpha,delta)[2]:   Firmpf:=FirmModelPP(alpha,delta)[3]:   Recpf:=FirmModelPP(alpha,delta)[4]:  Unsold:=FirmModelPP(alpha,delta)[5]:   Environ:=FirmModelPP(alpha,delta)[6]:    end if :  return p,q,Firmpf,Recpf, Unsold,Environ;  end proc: "

Error, unable to parse

"if (FirmModelFC(alpha,beta,delta)[3]>=FirmModelPP(alpha,delta)[3]) then p:=FirmModelFC(alpha,beta,delta)[1]:  q:=FirmModelFC(alpha,beta,delta)[2]:   Firmpf:=FirmModelFC(alpha,beta,delta)[3]: Recpf:=FirmModelFC(alpha,beta,delta)[4]:  Unsold:=FirmModelFC(alpha,beta,delta)[5]: Environ:=FirmModelFC(alpha,beta,delta)[6]:    else p:=FirmModelPP(alpha,delta)[1]:  q:=FirmModelPP(alpha,delta)[2]:   Firmpf:=FirmModelPP(alpha,delta)[3]: Recpf:=FirmModelPP(alpha,delta)[4]:  Unsold:=FirmModelPP(alpha,delta)[5]: Environ:=FirmModelPP(alpha,delta)[6]:   end if :  return p,q,Firmpf,Recpf, Unsold,Environ;  end proc: "

 

NULL

plot(['CurrentMetrics(alpha, .2, .2)[3]'], alpha = 0. .. 1.0, linestyle = [solid], legend = ["Firm's profit with delta=0.2"], labels = [alpha, "Firm profit"], labeldirections = ["horizontal", "vertical"], color = [blue], axes = boxed)

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

 

 

NULL

NULL

NULL

NULL

NULL

NULL


 

Download Call_two_procedures_in_another_one.mw

 

How does a user retain existing inline output (for example, computational output or inline plots) when re-executing an execution group in recent versions of Maple?  The "Replace existing output when re-executing groups" option is not available in Maple 2023 or in Maple 2020.

For example, I want to execute the same execution group 2 times to generate 2 different inline plots as the output. I want to retain the first inline plot when I generate the second inline plot.  However, the default Maple 2023 behavior is to overwrite the first inline plot with the second inline plot.

Several Maple versions ago (for example, Maple 18), there was the Tools > Option > Display > "Replace existing output when re-executing groups" option. When that option is checked, the second plot overwrites the first plot. In contrast, when that option is unchecked, the second plot appears after the retained first plot.

Where is the "Replace existing output when re-executing groups" option in recent Maple versions? Or do recent versions, like Maple 2023, use a different method to retain existing output when re-executing an execution group?

I think that the following worksheet is self-explaining: 
 

restartNULL

interface(version)

`Standard Worksheet Interface, Maple 2023.1, Windows 10, July 7 2023 Build ID 1723669`

(1)

evalf(LinearAlgebra:-MatrixFunction(`<|>`(`<,>`(1, 0, 0), `<,>`(1, 1, I), `<,>`(3, 0, 2)), 'x'/(exp('x')-1), 'x'))

Matrix(%id = 36893489913840207380)

(2)

(* Yet in many cases, the input may be inexact, for we need to speed up computations and decrease memory usage. *)

m := Matrix([[1, 1, 3], [0, 1, 0], [0, I, 2]], datatype = complex(sfloat)):
Digits := 10:
do
    print(CodeTools:-Usage(LinearAlgebra:-MatrixFunction(m, 'x'/(exp('x') - 1), 'x'), quiet), Digits++)
until Digits > 20:

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.3333333333+.1931757357*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 10

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.33333333332+.19317573586*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 11

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.333333333321+.193175735853*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 12

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.3333333333209+.1931757358526*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 13

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.33333333332087+.19317573585263*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 14

 

Matrix(3, 3, {(1, 1) = .5819767069, (1, 2) = -.333333333320870+.193175735852624*I, (1, 3) = -.8068242642, (2, 1) = 0., (2, 2) = .5819767069, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352855}), 15

 

Matrix(3, 3, {(1, 1) = .5819767068693265, (1, 2) = .9999999999999999-3.806824264*I, (1, 3) = -.8068242641099854, (2, 1) = 0., (2, 2) = .5819767068693265, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352854993314}), 16

 

Matrix(3, 3, {(1, 1) = .58197670686932644, (1, 2) = .99999999999999997-3.806824264*I, (1, 3) = -.80682426410998598, (2, 1) = 0., (2, 2) = .58197670686932644, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .31303528549933112}), 17

 

Matrix(3, 3, {(1, 1) = .581976706869326423, (1, 2) = -.999999999999999997+2.19317573589001464*I, (1, 3) = -.806824264109985348, (2, 1) = 0., (2, 2) = .581976706869326423, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .313035285499331308}), 18

 

Matrix(3, 3, {(1, 1) = .5819767068693264245, (1, 2) = -.2500000000000000000-0.5682426411e-1*I, (1, 3) = -.8068242641099853627, (2, 1) = 0., (2, 2) = .5819767068693264245, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414214*I, (3, 3) = .3130352854993313037}), 19

 

Matrix(%id = 36893489913905117652), 20

(3)

# Is `linalg:-matfunc` better than `LinearAlgebra:-MatrixFunction`?!
Digits := 10:
linalg:-matfunc(m, 'x'/(exp('x') - 1), 'x');

Matrix(3, 3, {(1, 1) = .5819767070, (1, 2) = -.3386968877+.2092663986*I, (1, 3) = -.8068242645, (2, 1) = 0., (2, 2) = .5819767070, (2, 3) = 0., (3, 1) = 0., (3, 2) = -.2689414215*I, (3, 3) = .3130352855})

(4)

(*
Even for a 3×3 matrix, the number of digits has to be set to 20.
So … how can you certify that the following output is validated?
*)
_seed := 1234:

LinearAlgebra:-MatrixFunction(LinearAlgebra:-RandomMatrix(50, density = .5, generator = -2*Pi .. 2*Pi, datatype = complex[8]), 'x'/(exp('x')-1), 'x')

Warning, the use of _seed is deprecated.  Please consider using one of the alternatives listed on the _seed help page.

 

Matrix(%id = 36893490216779135924)

(5)


 

Download funm.mws

How do you confirm the validity of the last output? 

> op(3, eval(LinearAlgebra:-MatrixFunction));
 = 
  Copyright (c) 2002 Waterloo Maple Inc. All rights reserved.

And does this mean that LinearAlgebra['MatrixFunction'] is so out-dated that the return value is less effective in certain cases?

I'm presently checking the ability of inttrans:-laplace to give results one can find in the literature.
Unfortunately the inttrans:-laplace's  answers are sometimes more complex than those published in the literature and I'm not capable to simplify the output.

For instance

f := (t+1)/sqrt(t^2+2*t);
L := laplace((t+1)/sqrt(t^2+2*t), t, p);

expresses L in terms of WhittakerW and BesselK(0, p) functions as the answer simply is

exp(p)*BesselK(1, p)

Laplace.mw

How can I get this result with Maple?

TIA

By default, CodeGeneration generates temporary names during optimize of t####. For compatibility with other code, I would like to have flexibility in choosing the preamble to the temporary variable name ("t" is default). Is there a way to do this?

I don't see anything in the documentation, but it seems like something one should be able to do.

(My target language is Python - although I'm not really using Python, the syntax is compatible).

I came across what looks to me like an error in Maple 2023.  If it stands alone, Maple evaluates z^0/0! to 1, but inside the sum command it appears to evaluate the same expression to 0.

Download Weird_sum_behaviour.mw

I've tried some simple uses of solve in MapleFlow without success. For example

solve(f=ma,a)

does not return

f/m

Does solve work in MapleFlow? Is there a problem with this Maple syntax in MapleFlow?

Hi,

I am trying to combine two simple plots of spacecurve and surface but can't manage. Asking for help because I know it doable, it is too simple not to be...

So I need something like this:

trying tirh spacecurve and surface and in general it appears together but cannot align axes so both are wrongly rotataed. Is there any simple and elegant way (without Maple programming language, I am not using it yet) in Maple document with few commands?

Thanks in advance

Marcin

I have a PDE

eq1 := du/dx+dv/dy = 0; eq2 := du/dt+u*du/dx+v*du/dy-nu*d^2*u/dy^2 = 0

where u(x, y, t), v(x, y, t) and

eta(x, y, t):=y/((nu*t*cos(alpha)+(nu*x)/(U[w])*sin(alpha))^(1/(2)));

psi(x, y, t):=U[w]*(nu*t*cos(alpha)+(nu*x)/(U[w])*sin(alpha))^(1/(2))*f(eta(x,y,t));

u = diff(psi, y); v= -diff(psi, x).

How to substitiute u = diff(psi, y); v= -diff(psi, x) in eq1 and eq2, Also find the value of nu.

First 179 180 181 182 183 184 185 Last Page 181 of 2428