MaplePrimes Questions

This is perhaps a stupid question, when I use the ScientificConstant package and call a constant e.g. R this works smoothly. But when I assign the value to a variable to use it in a calculation Maple complains about the units. However, if I assign the constant manually (without using GetConstant) Maple has no issues in solving. Is there a trick to use such a constant in a calculation? I have attached a worksheet to illustrate my question better. Thank you in advance for helping me out.GetConstantQuestion.mw

Hi guys,

I've got problem with integrating terms consisting complex values, I would like to use principle value (1/x+ie = P(1/x) -i pi \delta(x)) to make integration process easier but dont know how to do it with maple . without using that maple gives very long answer.

Thanks for your help

ex.mw

Best

Hello Maple gurus!

I have two questions related to working with operands:

Question 1

I often find myself in a situation where I have a non-trivial expression for instance containing double integrals with complex exponentials, and want to perform some operation on a heavily nested operand like the exponent to a specific exponential inside the double integral. Usually what I do is use a list argument with the op() or subsop() to operate on the nested operator by finding specific operand numbers.

However, the problem with this is that I am hard-coding the operand number(s) for the operator, and this expression can be located in the middle of a large worksheet. If something above these op() or subop() calls changes and the changes trickle down, the operands might change number and the commands are no longer valid.

Does Maple have any commands that will let me 'find' an operand like one does in by-hand calculations? For example, there might be an exponent nested in a double integral that has 'a*b' in it. What I want is to operate on the operand containing 'a*b' rather than specifying the actual operand number. Is there anything like this?

Question 2

Somewhat related to the above, I sometimes want to do a single function on multiple operands. I tried applyop but that seems to apply a function to each operand individually. What if, for example, I want to run combine() on 2 specific operands, assuming these operands are heavily nested, to combine just those two operands.

Thank you!

Dear community,

this is a related questio to "Determine zeros, indifference curve of two levels, numerical approximation".

I am  trying to model the advantage of corporate taxation (final asset value: V_TEV) over partnership taxation (final asset value: V_P).
I would like to plot the absolute advantage of corporate taxation (VT=V_TEV-V_P) as a function of income (E) and retention period (T). Here x=E, Y=T. I alread plotted the VT. However, Id like to have the graph differently:
I would like to construct the graph in such a way that the absolute wealth advantage VT can be read from the ordinate. Can someone please help me with that?

Here are the formulars, the study is based on:

E := 'E'
h := 4                     
m := 0.035
g:= h*m            
k := 0.15
a := 0.25;
F_ANR := 4*m;
r:= 0.1;
T := 'T';
ESt := piecewise
(E < 9984, 0,
E < 14926, (1008.7*(E - 9984)/10000 + 1400)*(E - 9984)/10000,
E < 58596, (206.43*(E - 14926)/10000 + 2397)*(E - 14926)/10000 + 938.24,
E < 277826, 0.42*E - 9267.53,
0.45*E - 17602.28);

GewSt := piecewise(E < 24500, 0, (E - 24500)*g)

stev := EStk/K

K := 0.6*E*(1 - k - g)*(1 + r*(1 - k - g))^T

EStk := piecewise(K < 9984, 0,
K < 14926, (1008.7*(K - 9984)/10000 + 1400)*(K - 9984)/10000,
K < 58596, (206.43*(K - 14926)/10000 + 2397)*(K - 14926)/10000 + 938.24,
K < 277826, 0.42*K - 9267.53,
0.45*K - 17602.28)

V_TEV := E*(1 + (-k - g))*(1 + r*(1 - k - g))^T*(1 - 0.6*stev)

Er := E + (E - ESt)*r

EStr := piecewise(Er < 9984, 0,
Er < 14926, (1008.7*(Er - 9984)/10000 + 1400)*(Er - 9984)/10000,
Er < 58596, (206.43*(Er - 14926)/10000 + 2397)*(Er - 14926)/10000 + 938.24,
Er < 277826, 0.42*Er - 9267.53,
0.45*Er - 17602.28);

srp := EStr/E

r_p := r*(1 - srp)

V_P := (E - ESt + GewSt - min(ESt, GewSt, E*F_ANR))*(1 + r_p)^T

VT := V_TEV - V_P

plot3d(VT, E = 0 .. 500000, T = 1 .. 15, axes = boxed)

Thank you so much in advance!! Rebekka

When I convert Maple expression to Latex, before calling Latex, I replace some math names by strings in order to keep them as is in the generated Latex instead of using Maple own shortened name when conversion to latex().

Later on, in the Latex file, I add \DeclareMathOperator on each long name. This way the long math names remain and it is more clear.

This has been working well for years. Same code. No problems. All my Latex was generated this way.

Except just now, I hit a case where Maple's latex() gives an error when the math has WeierstrassP in it. latex() generates exception. 

I will email this also to Maplesoft. But thought to also post it here in case someone can see what the problem is.

interface(version);
Physics:-Version();

`Standard Worksheet Interface, Maple 2021.2, Windows 10, November 23 2021 Build ID 1576349`

`The "Physics Updates" version in the MapleCloud is 1165 and is the same as the version installed in this computer, created 2022, March 7, 23:42 hours Pacific Time.`

restart;

#interface(warnlevel=4);
#kernelopts('assertlevel'=2):
interface(typesetting=standard); #to prevent bug. see https://www.mapleprimes.com/questions/232450-Why-Maple-Writes-The-Equation-Like-This
 

extended

r:=11/("\\WeierstrassPPrime"(x,a,b)+"\\WeierstrassP"(x,a,b)^2)*"\\WeierstrassP"(x,a,b)*"\\WeierstrassPPrime"(x,a,b)-6/("\\WeierstrassPPrime"(x,a,b)+"\\WeierstrassP"(x,a,b)^2)*"\\WeierstrassP"(x,a,b)^2+1/2*a/("\\WeierstrassPPrime"(x,a,b)+"\\WeierstrassP"(x,a,b)^2)

11*("\WeierstrassP")(x, a, b)*("\WeierstrassPPrime")(x, a, b)/(("\WeierstrassPPrime")(x, a, b)+("\WeierstrassP")(x, a, b)^2)-6*("\WeierstrassP")(x, a, b)^2/(("\WeierstrassPPrime")(x, a, b)+("\WeierstrassP")(x, a, b)^2)+(1/2)*a/(("\WeierstrassPPrime")(x, a, b)+("\WeierstrassP")(x, a, b)^2)

latex(r)

Error, (in latex) unable to proceed; could you please report this problem at physics@maplesoft.com

interface(typesetting=extended);

standard

latex(r)

Error, (in TypeTools/nc_var_local) invalid input: member received MathematicalFunctionsNames, which is not valid for its 2nd argument, s

 

Download march_8_2021_latex.mw

Hi, this is a small problem in af greater one for me. I'm trying to test to bigger equations if they are the same, which i suspect, the thing is, that maple wont evalb it. When i try with this simple problem, it gives me false. Can someone explaine this to me? Thank you for you help.

I am getting an exception divide by zero using solve. The problem is that when using kernelopts('assertlevel'=2):  I am no longer able to catch the exception in a catch try.

Removing kernelopts('assertlevel'=2):  I can catch the exception.

But I need to use kernelopts('assertlevel'=2): in my program.   

Is there a way to keep kernelopts('assertlevel'=2): and still catch exception thrown by solve?

Is this a bug in solve? And why using kernelopts('assertlevel'=2): prevents catching the exception?

Using Maple 2021.2 on windows 10. Worksheet attached.

 exception generated

 

 

restart;

trial_solution_constants:=[A[1]];
eq:=-A[1]-exp(x^2)*exp(-x^2) = 0;
solve(identity(eq,x),trial_solution_constants)

[A[1]]

-A[1]-exp(x^2)*exp(-x^2) = 0

Error, (in unknown) numeric exception: division by zero

Using assertlevel, now unable to catch exception

 

restart;

interface(warnlevel=4);
kernelopts('assertlevel'=2):

3

try
   trial_solution_constants:=[A[1]];
   eq:=-A[1]-exp(x^2)*exp(-x^2) = 0;
   solve(identity(eq,x),trial_solution_constants)
catch:
   print("error happend ",lastexception);
end try;
print(" I am here");

[A[1]]

-A[1]-exp(x^2)*exp(-x^2) = 0

Error, (in unknown) assertion failed

" I am here"

Not Using assertlevel now can catch exception

 

restart;

interface(warnlevel=4);

3

try
   trial_solution_constants:=[A[1]];
   eq:=-A[1]-exp(x^2)*exp(-x^2) = 0;
   solve(identity(eq,x),trial_solution_constants)
catch:
   print("error happend ",lastexception);
end try;
print(" I am here");

[A[1]]

-A[1]-exp(x^2)*exp(-x^2) = 0

"error happend ", unknown, "numeric exception: division by zero"

" I am here"

 

Download march_8_2021_solve.mw

Dear all 
I have a function defined over the closed interval [ x[k], x[k+2] ] and zero elsewhere 
I would like to plot this sequence of function and compute an integral. 

I need your help to finish the attahced code, something is wrong. I can't  use piecewise funciton in loop and plot all functions in the same graph

piecewise_funciton_and_integral.mw

thanks for your remaks and help

Hello, can someone explain why something like this fails? The help page for 'isolate' says the second argument can be 'any algebraic expression'. Thanks.

I have the following systems of ODE in hand and would like to solve them. It would be great if somebody could help me with it.

dudx := -415; dudy := 3901; dudz := -3365; dvdx := 23; dvdy := -1270; dvdz := 994; dwdx := 57; dwdy := -1665; dwdz := 1683; taup := 0.5390603100674905e-5

-415

 

3901

 

-3365

 

23

 

-1270

 

994

 

57

 

-1665

 

1683

 

0.5390603100674905e-5

(1)

u := .387; v := -.205; w := -.286; x0 := -0.979849e-2; y0 := -0.14583e-2; z0 := 0.623749e-1

.387

 

-.205

 

-.286

 

-0.979849e-2

 

-0.14583e-2

 

0.623749e-1

(2)

a__1 := dudx/taup; a__2 := dudy/taup; a__3 := dudz/taup; a__4 := 1/taup; a__5 := u/taup; b__1 := dvdx/taup; b__2 := dvdy/taup; b__3 := dvdz/taup; b__4 := 1/taup; b__5 := v/taup; c__1 := dwdx/taup; c__2 := dwdy/taup; c__3 := dwdz/taup; c__4 := 1/taup; c__5 := w/taup

-76985820.00

 

723666708.0

 

-624234420.0

 

185508.0000

 

71791.59600

 

4266684.000

 

-235595160.0

 

184394952.0

 

185508.0000

 

-38029.14000

 

10573956.00

 

-308870820.0

 

312209964.0

 

185508.0000

 

-53055.28800

(3)

sys := diff(x(t), t, t) = a__1*x(t)+a__2*y(t)+a__3*z(t)-a__4*(diff(x(t), t))+a__5, diff(y(t), t, t) = b__1*x(t)+b__2*y(t)+b__3*z(t)-b__4*(diff(y(t), t))+b__5, diff(z(t), t, t) = c__1*x(t)+c__2*y(t)+c__3*z(t)-c__4*(diff(z(t), t))+c__5

diff(diff(x(t), t), t) = -76985820.00*x(t)+723666708.0*y(t)-624234420.0*z(t)-185508.0000*(diff(x(t), t))+71791.59600, diff(diff(y(t), t), t) = 4266684.000*x(t)-235595160.0*y(t)+184394952.0*z(t)-185508.0000*(diff(y(t), t))-38029.14000, diff(diff(z(t), t), t) = 10573956.00*x(t)-308870820.0*y(t)+312209964.0*z(t)-185508.0000*(diff(z(t), t))-53055.28800

(4)

ics := x(0) = x0, y(0) = y0, z(0) = z0, (D(x))(0) = 0, (D(y))(0) = 0, (D(z))(0) = 0

x(0) = -0.979849e-2, y(0) = -0.14583e-2, z(0) = 0.623749e-1, (D(x))(0) = 0, (D(y))(0) = 0, (D(z))(0) = 0

(5)


Thank you very much!

Download m_solution.mw

Hi 

Warm greetings.

Is it possible to solve the numerical scheme present in the below paper.

Anita Chaturvedi, Kokila Ramesh, and Vatsala G A. (2017). “A MATHEMATICAL APPROACH TO STUDY THE EFFECT OF POLLUTANTS/TOXICANTS IN AQUATIC ENVIRONMENT.” International Journal of Research - Granthaalayah, 5(4) RAST, 33-38.

https://doi.org/10.5281/zenodo.803418

Thank you.

Could please help me solving the following problem?
Thank you a lot.

The question https://www.mapleprimes.com/questions/233780-Plot-Absolute-Advantage-Of-Option-A disappeared (I know since I answered today).

Why?

I simplified a vector column using side relations. Then I wanted to evaluate using

eval( equation,  [x1=3,  x2=5......})

But side relations uses the reverse order i.e. after evaluation

[3=x1, 5=x2......]

So then the internals of the list need to be swaped tto work with eval.That is easy. I am just wondering is there a neater way to achieve this?

restart

NULL

P1 := Vector(3, {(1) = -(y[1]-y[3])*(y[2]-y[3])*((x[2]^2-x[2]*x[3]+x[3]^2)*x[1]^2-x[2]*x[3]*(x[2]+x[3])*x[1]+x[2]^2*x[3]^2)*(y[1]-y[2]), (2) = -(x[1]-x[3])*(x[2]-x[3])*(x[1]-x[2])*((y[2]^2-y[2]*y[3]+y[3]^2)*y[1]^2-y[2]*y[3]*(y[2]+y[3])*y[1]+y[2]^2*y[3]^2), (3) = ((-y[1]^2*y[2]+(3*y[2]*y[3]-y[3]^2)*y[1]-y[2]^2*y[3])*x[2]+x[3]*(y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2))*x[1]^2+((y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2)*x[2]^2+3*x[3]*(y[2]-y[3])*(y[1]-y[3])*(y[1]-y[2])*x[2]-x[3]^2*(y[1]^2*y[2]+(-3*y[2]*y[3]+y[3]^2)*y[1]+y[2]^2*y[3]))*x[1]-x[3]*((y[1]^2*y[2]+(-3*y[2]*y[3]+y[3]^2)*y[1]+y[2]^2*y[3])*x[2]-x[3]*(y[1]^2*y[3]+y[2]*(y[2]-3*y[3])*y[1]+y[2]*y[3]^2))*x[2]})

eqns := {(x[1]-x[2])*(x[2]-x[3])*(x[3]-x[1]) = R, (y[1]-y[2])*(y[2]-y[3])*(y[3]-y[1]) = S, x[1]^2*x[2]^2-x[1]^2*x[2]*x[3]+x[1]^2*x[3]^2-x[1]*x[2]^2*x[3]-x[1]*x[2]*x[3]^2+x[2]^2*x[3]^2 = Y, y[1]^2*y[2]^2-y[1]^2*y[2]*y[3]+y[1]^2*y[3]^2-y[1]*y[2]^2*y[3]-y[1]*y[2]*y[3]^2+y[2]^2*y[3]^2 = X, x[1]^2*x[2]+x[1]^2*x[3]+x[1]*x[2]^2-6*x[1]*x[2]*x[3]+x[1]*x[3]^2+x[2]^2*x[3]+x[2]*x[3]^2 = Z, y[1]^2*y[2]+y[1]^2*y[3]+y[1]*y[2]^2-6*y[1]*y[2]*y[3]+y[1]*y[3]^2+y[2]^2*y[3]+y[2]*y[3]^2 = W}

P1new := simplify(P1, eqns)

Vector[column](%id = 36893490132854572084)

(1)

values := {x[1] = 3, x[2] = 5, x[3] = 7, y[1] = 2, y[2] = -11, y[3] = 13}

{x[1] = 3, x[2] = 5, x[3] = 7, y[1] = 2, y[2] = -11, y[3] = 13}

(2)

vals1 := eval(eqns, values)

{-3432 = S, 16 = R, 120 = Z, 316 = Y, 2018 = W, 22753 = X}

(3)

eval(P1new, vals1)

Vector[column](%id = 36893490132854572084)

(4)

vals1swap := [seq(rhs(vals1[i]) = lhs(vals1[i]), i = 1 .. nops(vals1))]

[S = -3432, R = 16, Z = 120, Y = 316, W = 2018, X = 22753]

(5)

eval(P1new, vals1swap)

Vector[column](%id = 36893490132849052116)

(6)

eval(P1, values)

Vector[column](%id = 36893490132871267020)

(7)

``

NULL

``

Download Q_6-03-2022_side_rels_and_eval.mw

Need help to plot a graph along x-axis  in attached worksheet. 

help_graph.mw

First 20 21 22 23 24 25 26 Last Page 22 of 2119