MaplePrimes Questions

@ecterrab

Fetching package "Physics Updates" from MapleCloud...

ID: 5137472255164416
Version: 1713
URL: https://maple.cloud

An error occurred, the package was not installed:
Could not open workbook: /tmp/cloudDownload3108059082303936092/Physics Updates_1712064079729.maple

 

Same problem on Maple 2024 for Windows and Linux!!!

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

 

I am unable to change the font on the Palette menus or the pop up context boxes.

It is very frustrating, as I can hardly read them.

I am not sure if it is a computer setting or a Maple setting.

Any help would be appreciated

The following is a simple example of what I would like to do: 

M := Array(1 .. 10, 1 .. 2);

for i to 10 do
    M[i, 1] := i;
    M[i, 2] := 3*i;
end do;

Mt := Interpolation:-LinearInterpolation(M);
E := t -> Mt(t);
diffeq := D(C)(t) = E(t);
dsolve({diffeq, C(0) = 0}, {C(t)}, numeric);
Error, (in dsolve/numeric/process_input) unknown Interpolation:-LinearInterpolation([Vector(10, [1.,2.,3.,4.,5.,6.,7.,8.,9.,10.], datatype = float[8], attributes = [source_rtable = (Vector(10, [1.,2.,3.,4.,5.,6.,7.,8.,9.,10.], datatype = float[8], attributes = [source_rtable = (Array(1..10, 1..2, [[1.,3.],[2.,6.],[3.,9.],[4.,12.],[5.,15.],[6.,18.],[7.,21.],[8.,24.],[9.,27.],[10.,30.]], datatype = float[8]))]))])],Vector(10, [3.,6.,9.,12.,15.,18.,21.,24.,27.,30.], datatype = float[8], attributes = [source_rtable = (Array(1..10, 1..2, [[1.,3.],[2.,6.],[3.,9.],[4.,12.],[5.,15.],[6.,18.],[7.,21.],[8.,24.],[9.,27.],[10.,30.]], datatype = float[8]))]),uniform = true,verify = false) present in ODE system is not a specified dependent variable or evaluatable procedure

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

I keep getting an error: invalid subscript selector on specifically this part of my code:

MuligIndgange := subsop(RemoveList\[i\]=NULL, MuligIndgange).
Whenever I comment out the MuligIndgange := part it works.

I can't for the life of me see why it's happening, and whenever I use this code outside my proc it works aswell.

Any help is appreciated, and if you need more context I'll be happy to give it.

for i to numelems(MuligIndgange) do
     if M1[MuligIndgange[i][1], MuligIndgange[i][2]] =/= 0 then
         RemoveList := [op(RemoveList), i];
      end if;
end do;
for i from numelems(RemoveList) by -1 to 1 do
    MuligIndgange := subsop(RemoveList[i] = NULL, MuligIndgange);
end do;

When I use evala(Minpoly(sqrt(3) + sqrt(2), x)), then I get a right answer: x^4 - 10*x^2 + 1

But when I want to get the minimal polynomial of cos((2*Pi)/7) by evala(Minpoly(cos((2*Pi)/7), x)), I will get a result:

x - cos((2*Pi)/7)

It clearly does not follow the definition of a minimal polynomial. Is it a bug of Minpoly or I have missed something?

Question 1
Let theta a real number in the range 0..2*Pi.
Is there a way to "convert" 

f := theta -> arccos(cos(theta))+arcsin(sin(theta))

into 

f1 := theta -> piecewise(theta < 0, 0, theta < (1/2)*Pi, 2*theta, theta < Pi, Pi, theta <= (3/2)*Pi, 3*Pi-2*theta, 0)


Question 2
As f1 is  2*Pi periodic, is there a way to convert f into a periodic function where the "pattern" is f1(theta)?
To be clearer I thought to something close to what we get when we do this

solve(cos(x)=1, allsolutions);
                            2 Pi _Z2 
about(_Z1);
Originally _Z1, renamed _Z1~:
  is assumed to be: integer

and I imagined 

Some_Transformation(f(theta))
    f1(theta+2*Pi*_Z1~)
about(_Z1); 
Originally _Z1, renamed _Z1~: 
  is assumed to be: integer

For the moment I build the periodized f1 this way

f2 := (theta, K) -> int(f1(theta-z)*add(Dirac(z-2*Pi*k), k=-K..K), z=-infinity..+infinity);
# or
f2 := (theta, K) -> sum(int(f1(theta-z)*Dirac(z-2*Pi*k), z=-infinity..+infinity), k=-K..K);

Thanks in advance.

How do I solve the problem below using maple commands? I'm having trouble finding the commands and believe my answer is incorrect. I am currentley on maple 2022. 
How would I find an equation of the line tangent to the graph of f(x) when x =3?
f(x)= (1-kx)/(1+x^2)
f := x -> x^2 + 2*x + 1;

Thank you.

Hello,

I would like to generate a ColumnGraph such that the bars are centered over 1, 2, and 3. For example, I have a vector:

x:= Vector([1,2,3]);

When you execute ColumnGraph(x), you a get the first bar centered over 0.375, instead of 1, second bar centered over 1.375, instead of 2, and so on.

Thanks for your help.

I have seen this quite a bit in blocks of code. The `>` symbol seems to appear erratically. I don't know how to specifically reproduce this. Does it mean something? I would post the worksheet but it will not run without the package.

 

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"NULL

"maple.ini in users"

 

3

(1)

NULL#  plot  solutions to a system  of DEs

NULL

sys := {diff(x(t), t) = y(t), diff(y(t), t) = -x(t) - 1/2*y(t)}

{diff(x(t), t) = y(t), diff(y(t), t) = -x(t)-(1/2)*y(t)}

(2)

DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[x(0) = 1, y(0) = 0]])

 

;

This is not working, seems to be simple ...
Have made an attempt to create a procedure from these two commands, but no success
Apparently, I need to learn to use a debugger to determine what is wrong, then?

dv_systeemplot:= proc ( DV1,DV2 ,RV1,RV2 )
                 local t, sys,systeemplot;  
                 sys := {DV1 , DV2 }:
                 systeemplot:= DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1 , RV2]]);
                 return systeemplot;
end proc;

proc (DV1, DV2, RV1, RV2) local t, sys, systeemplot; sys := {DV1, DV2}; systeemplot := DEplot(sys, [x(t), y(t)], t = 0 .. 15, [[RV1, RV2]]); return systeemplot end proc

(3)

NULL

DV1 := diff(x(t), t) = y(t)

diff(x(t), t) = y(t)

(4)

DV2 := diff(y(t), t) = -x(t)-(1/2)*y(t)

diff(y(t), t) = -x(t)-(1/2)*y(t)

(5)

RV1 := x(0) = 1

x(0) = 1

(6)

RV2 := y(0) = 0

y(0) = 0

(7)

dv_systeemplot( DV1,DV2 ,RV1,RV2 );

 

Error, (in DEtools/DEplot/CheckDE) inputs must be ODEs

 

NULL

Ask AI to get some code: never i got the right Maple code ! :)

 

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"``
 

"maple.ini in users"

 

3

(8)

restart;

systeem := proc(eq1, eq2, beginwaarden)
  local x, y, oplossing;
  x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t);
  oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden);
  oplossing;
end proc;

# Definieer de differentiaalvergelijkingen
eq1 := diff(x(t), t) = y(t);
eq2 := diff(y(t), t) = -x(t);

# Geef de beginwaarden op
beginwaarden := [x(0) = 1, y(0) = 0];

# Roep de procedure aan met de differentiaalvergelijkingen en beginwaarden
systeem(eq1, eq2, beginwaarden);

"maple.ini in users"

 

proc (eq1, eq2, beginwaarden) local x, y, oplossing; x := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); y := unapply(rhs(dsolve({eq1, eq2, beginwaarden}, {x(t), y(t)})), t); oplossing := DEplot([x(t), y(t)], t = 0 .. 10, beginwaarden); oplossing end proc

 

diff(x(t), t) = y(t)

 

diff(y(t), t) = -x(t)

 

[x(0) = 1, y(0) = 0]

 

Error, (in dsolve) invalid input: PDEtools/sdsolve expects its 1st argument, SYS, to be of type Or(set({`<>`, `=`, algebraic}),list({`<>`, `=`, algebraic}),`casesplit/ans`(list,list)), but received {diff(x(t),t) = y(t), diff(y(t),t) = -x(t), [x(0) = 1, y(0) = 0]}

 

Probably i do need to work with a debugger here?


Download dv_systeem_via_mapleprimes_.mw

If we write

restart: alias(po=pochhammer):

assume(abs(z)<1);  F:=z->sum(po(1,n)^2/po(1/2,n)^2*z^n/(n+1),n=1..infinity);

Then the output of F(z) is a hypergeometric series, and

A=subs(z=4, F(z);

evalf(A)

gives the correct output. But, why do we need to assume that abs(z)<1 if we are evaluating at abs(z)>1?. Observe that if we do not assume it, then the output we get is wrong, why?

I recently watched a video in which the speaker asked the following question: "How many seconds are there in 42 days?".
I think I've done what anyone would do: trying to quickly find an order of magnitude for this number.
But the speaker's answer was both remarkable and obvious when you think of it: "Exactly 10! seconds".

So my question: Given the number 3628800, is there a way to identify it (in the  identify's sense) to 10!  ?
Or maybe some trick to force identify to answer 10! ?

Thanks in advance

Well , honestly I can't make sense of how to do this.

Interactive can be done step by step , but now generalize via a procedure , but can't get a handle on it
How to get the right procedure ?

"maple.ini in users"

(1)

NULL

" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"

 

3

(2)

DV := y(x)*(diff(y(x), x)) = exp(x)

y(x)*(diff(y(x), x)) = exp(x)

(3)

opl_1 := dsolve({DV, RV1}, y(x))

y(x) = (1-2*exp(1)+2*exp(x))^(1/2)

(4)

opl_2 := dsolve({DV, RV2}, y(x))

y(x) = -(1-2*exp(1)+2*exp(x))^(1/2)

(5)

opl := plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3)

lijnelement := dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met intergaalkromme door (1,1)(1,-1)")

display({opl, lijnelement})

 

NULL

" restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ;"

"maple.ini in users"

 

3

(6)

NULL

DV, RV1, RV2

y(x)*(diff(y(x), x)) = exp(x), y(1) = 1, y(1) = -1

(7)

``

NULL

NULL

"restart: with(plots):with(DEtools):with(Student[ODEs]):infolevel[Student]:=3 ; "

"maple.ini in users"

 

3

(8)

DVplot:=proc(DVA,RV1A,RV2A)
          local DV;RV1;RV2;opl_1;opl_2;opl;lijnelement;
          DV:
          RV1:
          RV2:
          opl_1 := dsolve({DV, RV1}, y(x)):
          opl_2 := dsolve({DV, RV2}, y(x)):
          opl:= plot({rhs(opl_1), rhs(opl_2)}, x = 0 .. 5, y = -10 .. 10, thickness = 3):
          lijnelement:=dfieldplot(DV, y(x), x = 0 .. 5, y = -10 .. 10, title = "lijnelementveld met                intergaalkromme door (1,1)(1,-1)"):
          display({opl, lijnelement});
end proc:

NULL

DVA := y(x)*(diff(y(x), x)) = exp(x)

y(x)*(diff(y(x), x)) = exp(x)

(9)

RV1A := y(1) = 1

y(1) = 1

(10)

RV2A := y(1) = -1

y(1) = -1

(11)

DVplot(DVA, RV1A, RV2A)

Error, (in dsolve) not a system with respect to the unknowns [y(x)]

 
 

NULL

Download DV_plotten-_procedure.mw

First 116 117 118 119 120 121 122 Last Page 118 of 2426