Maple 2017 Questions and Posts

These are Posts and Questions associated with the product, Maple 2017

Hi,

I am trying to generate a plot using a procedure. A dummy code is as follows:

***

fun := piecewise(x+y > 1, (x+y)^2, x-y);

temp_proc := proc(x, y)
local out, ind:

ind := 9:

if x > y then ind := 1 else ind := 0 end if; 

if ind = 1 then out := eval(5*fun, {:-x=x, :-y=y}) else out := eval(-5*fun, {:-x=x, :-y=y}) end if:

return(out);
end proc:

xt := 5: yt := 2:
out1_fin := temp_proc(xt, yt);

plot(out1_fin, z=-2..3);
 

***

The issue is as follows:

1. I am getting an error message for the code above: "Error, (in temp_proc) cannot determine if this expression is true or false: 2 < z".

2. The entire procedure and the plot command work well for a fixed "z". However, it is not useful for me as I am looking for a plot for various values of z. 

3. I hope I don't have to run the procedure by manually creating a list of z and then plotting the lists of z and out1_fin. 

4. I am using the "ind" variable because it simplifies my actual code, which involves multiple conditions defining the function "fun" that I need to plot. 

I would appreciate your input on how to resolve the issue. 

Regards,

Omkar

 

Hi, 
I am struggling with the output of a procedure. A dummy code is as follows:

*****

fun := x^2+y^2;

temp_proc := proc(x, y)
local out1, out2, out3:

if x > 0 then out1 := fun; out2 := 2*fun; out3 := k*fun;
elif x <= 0 then out1 := fun; out2 := -2*fun; out3 := -k*fun;
end if:

return(out1, out2, out3);
end proc:

xt := -1: yt := 2:
out1_fin := temp_proc(xt, yt)[1];
out2_fin := temp_proc(xt, yt)[2];
out3_fin := temp_proc(xt, yt)[3];


*****

xt and yt are numerical input parameters. I expect to obtain "out1_fin" and "out2_fin" in numerical form and "out3_fin" in symbolic form. All three outputs should substitute xt and yt for x and y, respectively, wherever relevant. 

However, currently, the output I am getting is not after substituting the values of xy and yt. The output is as follows:

*****

out1_fin := x^2+y^2

out2_fin := -2*x^2-2*y^2          

out3_fin := -k*(x^2+y^2)

*****

May I get some help in resolving the issue? 

Also, would a procedure be a good idea for this task, or would a module be better? 

I would appreciate any guidance in this regard. Thank you. 

Regards,

Omkar

How can I draw Steiner trees of hypercubes in graph theory? 

hi

I have a linear system with varibles trying to plot 3d the solutions x, y, z

here is my code: linear_var.mw

please any comment might help.

*******************************

restart;

Omega:=10:N:=0.5:M:=sqrt(N(N+1)):

a11:=0.5*(1+2*N)+M*cos(phi):
a12:=-0.5*((1+theta)^3+(1-theta)^3):a13:=-0.5*(N+M*cos(phi))*((1+theta)^3-(1-theta)^3): a21:=M*sin(phi): a22:=(-(1+2*N)+0.5*M*cos(phi))*((1+theta)^3+(1-theta)^3): a23:=-(Omega+0.5*((1+theta)^3-(1-theta)^3)*M*sin(phi)): a31:=0.25*((1+theta)^3-(1-theta)^3): a32:=Omega: a33:=-0.5-(N+0.25)*((1+theta)^3+(1-theta)^3): b1:=-0.5*a31: b2:=0: b3:=0.25+((1+theta)^3+(1-theta)^3)/8:

slove([a11*x+a12*y+a13*z=b1,a21*x+a22*y+a23*z=b2,a31*x+a32*y+a33*z=b3[,[x,y,z]);
Error, unable to match delimiters
Typesetting:-mambiguous(Typesetting:-mambiguous(slovelparlsqba11

  sdotx + a12sdoty + a13sdotzequalsb1commaa21sdotx + a22sdoty + 

  a23sdotzequalsb2commaa31sdotx + a32sdoty + a33sdotzequalsb3lsqb

  comma(xyz)rparsemi, 

  Typesetting:-merror("unable to match delimiters")))

plot3d(x, theta = .1 .. 5, phi = 0 .. 2*Pi, axes = boxed);
plot3d(y, theta = .1 .. 5, phi = 0 .. 2*Pi, axes = boxed); plot3d(z, theta = .1 .. 5, phi = 0 .. 2*Pi, axes = boxed);

I have a guess about the set of the zeros of the following polynomial

y(1-x^{m+1}z)+(1-x^{n+1}z), (here m,n are positive integers and z is a primitive d-root of unity)

which are located on the complex 2-dimensional torus. The set of solutions is finite (I think the system is zero-dimensional). My goal is to verify my guess numerically using Maple for some small values of m and n and a fixed value of z. I think if (x,y) is a solution, then x is either a (n-m) root of unity or a (n-m) root of 1/z^2 (where n>m).

You can find my code for n=3 and m = 1 attached (I was not able to load the mw format so I put the zip version). I consider z to be a third root of unity but actually, I am interested in putting z= exp(2pi/3*i) and even the real third root z=1 is not interesting for me, but since the exponential representation led to an error, I changed it to z and mentioned that z^3=1. Still, it has an error and  I would be grateful if you could let me know how I can correct this code.  

Question.maple.zip

Is there a way to delete frames arround the legend in a plot?

Why does this not return a quick solution?

sol := solve(.2894606222 = .4090662520/((1+0.1481289280e-2*x)^5.034901366*(1/(1+0.1481289280e-2*x)^5.034901366)^.1986136226), x)

mw.mw

Are Maple settings responsible for this error:

HHow do i correct "error, illegal use of an object as a name"

Hello everyone,

I am trying to solve a system of 4 ODEs that describe a physical system, however, I get the message:

Error, (in dsolve/numeric/bvp) matrix is singular

Any help is much appreciated. The initial conditions are such that to find solution in steady state, that means, v(0)=v(period) and so on with all variables.

Download LLCcircuit_SteadyState_numerical.mw

Hello everyone,

I want to solve a simple ODE numerically having a piecewise periodic function in the ODE.

The periodic piecewise function definition is taken from this  post.

When solving using "dsolve" numerical, I get this error:

Error, (in f) unable to store '100000*square_wave_periodic' when datatype=float[8]

restart;
d := .5;
fs := 100*10^3;
Vin := 10;
C := 10*10^(-6);
R := 10;
L := 10*10^(-6);

DEFINE PERIODIC FUNCTION
square_wave := proc (t) options operator, arrow; piecewise(0 <= t and t <= d/fs, Vin, d/fs < t and t < 1/fs, 0) end proc

square_wave_periodic := proc (t) options operator, arrow; square_wave(t-floor(t*fs)/fs) end proc

ode1 := L*(diff(i(t), t))+v(t) = square_wave_periodic
ode2 := C*(diff(v(t), t))+v(t)/R = i(t)
IC := v(0) = 0, i(0) = 0
sol := dsolve({IC, ode1, ode2}, {i(t), v(t)}, numeric)

LCRcircuit_transient_numerical.mw

Any help is much appreciated ! Thank you !

I tryning to to plot 3d and then contour plot of the function N vs alpha

This is my try please any comments might help

N_vs_alpha.mw

Hello everyone,

I am trying to solve a simple nonlinear 4 variable function with NLPsolve giving real values ranges for the variables but the NLPsolve gives "non numerical" result. Find attached the worksheet.CoreOptimization.mw

Am I doing something wrong?

Regards,

Cata

Hhow can i solve R it says here root of

Calculate.mws

How do you stop Maple during this code execution:

proc()
x:
print(1);
goto(x);
end():

1 2 3 4 5 6 7 Last Page 1 of 40