Items tagged with convert convert Tagged Items Feed

After days of fruitlessly searching the help files and the Internet for a means of converting a Dataseries of strings into numeric values in Maple I changed tack and determined how to do it myself.

I was surprised there was no built in Maple function to do this. From searching the Internet I can see I am not alone.
Since there are no other solutions on the net, here is mine:

toNumeric := (y) -> map(x->parse(x),y);

This creates the function toNumeric() that accepts a DataSeries of text values and returns it converted to a Dataseries of numeric values.

thing := DataSeries(["10", "20", "30", "55.9"], 'labels' = ["a", "b", "c", "d"]);
thing := toNumeric(thing); 

dataframething := DataFrame([["cow", "sheep", "goat", "alpaca"], ["10", "20", "30", "55.9"]], rows = ["a", "b", "c", "d"]);
dataframething[2] := toNumeric(dataframething[2]);


If you want to see this in Maple, try:
 typecastdataseries-maple




 

HI

HOW I convert root of in to another form

thanks

lorenz_5.mw

Hello everyone,

 

Is it normal that commands #1 and #2 below do not return the same thing ?

 

L := [`Norman.Mailer`, `Richard.Brautigan`]

#1

map(u -> convert(u, string), L);

["Norman.Mailer", "Richard.Brautigan"]


#2

`convert/string`~(L)

["`Norman.Mailer`", "`Richard.Brautigan`"]


Side question : I am not really familiar with the tilde operator and I often use map instead.
Does it exist a better practice in these matters ?

Thanks in advance

When I copy mathml into Maple it always pasted the subscipts as indexed.  How could I quickly convert the indexed subscripts into literal subscripts without having to right click and convert each variable?

Hi,

I'm currently writing my thesis and actually haven't used Maple before.

I've got the following problem with converting the results of a sequence:

seq(Optimization:-Maximize(function with 2 variables), parameter:0..1,0.1)

The results are ok, but I can't convert the values to a spreadsheet with 4 columns (parameter value, maximum value, value of variable 1, value of variable 2).

Thank you!

Best regards

I want to apologize if this being neither necessarily a minimal working example for one question nor just one question is uncomfortable. The "MWE" was created on and is designed for Linux machines including ImageMagick. The problem itself should be obvious to all users though, as the subfolder and creation of the gif are just conveniences. I have three sections concerning the different problems occuring in my attempts.

(which I was told is not doable in maple ... hence the gif)

link

The goal was to create an animation that zooms in on a function. As maple just wouldn't allow scaling of axis in animations I decided to export single frames and then convert those with ImageMagick. Maple offers ssystem(„...“) which allows for command line usage.

The problem (may as well be a bug) occurs when I try to export images in a for loop with exportplot(...). If the path as well as previously exported images exist, it won't output an error but still not export the desired images. Exporting frames separately works just fine, as well as doing the very same operation in a separate for loop.

(see the first red comment and export section)

After using the workaround in a second for loop. I couldn't figure out how to import the images and then create an animation from them. The main obstacle is the fact that the imported pictures are put into plot-functions.

(see the second red comment)

 

restart;

with(plottools):

f1 := s -> sin(2*s):

max_frame := 10: # = number of steps

for k from 0 to max_frame do
    pic[k] := plot(f1(x), x=-Pi*(1-k/max_frame)..Pi*(1-k/max_frame),
                    filled=true, #color = ["Orange"],
                    color = ColorTools:-Color([0,
                                              floor(128*k/max_frame),
                                              floor(255*k/max_frame)
                                              ]),
                    view=[-Pi*(1-k/max_frame)..Pi*(1-k/max_frame), -1..1]
                    ):
end do:

path := FileTools:-TemporaryDirectory();
path_list := ssystem("pwd");
path := path_list[2];
ssystem("mkdir ./pics"); # creates a subfolder
path := FileTools:-JoinPath([path, "pics"]); # need to change path to subfolder

plotsetup(window, plotoptions="width=480, height=600");
for k from 0 to max_frame do
    file[k] := FileTools:-JoinPath([path,
                                     MapleTA:-Builtin:-strcat("frame_",
                                                              convert(k, string),
                                                              ".jpg")
                                    ]);
    # exportplot(file[k], pic[k]); # does not work
end do:

exportplot(file[0], pic[0]); # works

# =====================================================================================
# export
# =====================================================================================
for k from 0 to max_frame do
  exportplot(file[k], pic[k]);
od; # also works

# =====================================================================================
# import
# =====================================================================================
for k from 0 to max_frame do
    reimported_pic[k] := importplot(file[k]); # this might take a while (depending on the amount of frames)
end do: # import works but [Length of output exceeds limit of 1000000]

whattype(reimported_pic[0]); #seems to create a plot function
show := convert(reimported_pic,list):
#Error, while processing result #There is no help page available for this error

show[1]; # works

# =====================================================================================
# create an animated gif at least
# =====================================================================================
delay_time := ceil(evalf(100/max_frame));
command_for_gif := MapleTA:-Builtin:-strcat("convert -delay ",
                                            convert(delay_time, string),
                                            " -loop 0 ", # -reverse ",
                                            FileTools:-JoinPath([path, "frame_*.jpg "]),
                                            FileTools:-JoinPath([path, "animation.gif"])
                                            );
ssystem(command_for_gif);

 

 

Download bug_report_maybe.mw

 

I would be grateful for any suggestions. Moreover I have run accross

?DocumentTools:-Components:-VideoPlayer

which I could not figure out how to use by the help pages (I tried to create an avi and import that). If someone has informations on that, please share!

how to convert (a+b)^3 to a list [a+b, a+b, a+b]?

for example

(a+b)^2 to [a+b, a+b]

Is there a way to automatically convert and paste my clipboard contents as 2D math?

 

 

 

 

Can we calculate the following equations in Maple?

Substituting equations (21) and (22) into (17), and then obtain equation (23). How to do that? I have done this, but the results are complex and large. They are not in a sum form, but in an expansion form. The reference and the maple file are attached.

Hope for your help.

Best wishes,

Kang

Dynamic_buckling_of_thin_isotropic_plates_subjected_to_in-plane_impact.pdf

gg.mw

hi...how i can convert 3 couple equations to 1 equation with Placement each other?

thanks...

 

3-1.mw

pd1 := A1*(diff(U(x, theta), x, x, x, x))+A2*(diff(U(x, theta), x, x))+A3*(diff(U(x, theta), x, x, theta, theta))+A4*(diff(V(x, theta), x, x, x, theta))+A5*(diff(V(x, theta), x, theta))+A6*(diff(V(x, theta), x, theta, theta, theta))+A7*(diff(W(x, theta), x, x, x))+A8*(diff(W(x, theta), x))+A9*(diff(W(x, theta), x, theta, theta))+A10*(diff(U(x, theta), theta, theta))+A11*(diff(U(x, theta), theta, theta, theta, theta))-A12*omega^2*U(x, theta)

A1*(diff(diff(diff(diff(U(x, theta), x), x), x), x))+A2*(diff(diff(U(x, theta), x), x))+A3*(diff(diff(diff(diff(U(x, theta), theta), theta), x), x))+A4*(diff(diff(diff(diff(V(x, theta), theta), x), x), x))+A5*(diff(diff(V(x, theta), theta), x))+A6*(diff(diff(diff(diff(V(x, theta), theta), theta), theta), x))+A7*(diff(diff(diff(W(x, theta), x), x), x))+A8*(diff(W(x, theta), x))+A9*(diff(diff(diff(W(x, theta), theta), theta), x))+A10*(diff(diff(U(x, theta), theta), theta))+A11*(diff(diff(diff(diff(U(x, theta), theta), theta), theta), theta))-A12*omega^2*U(x, theta)

(1)

pd2 := B1*(diff(V(x, theta), x, x, x, x))+B2*(diff(V(x, theta), x, x))+B3*(diff(V(x, theta), theta, theta, theta, theta))+B4*(diff(V(x, theta), theta, theta))+B5*(diff(V(x, theta), x, x, theta, theta))+B6*(diff(U(x, theta), x, x, x, theta))+B7*(diff(U(x, theta), x, theta, theta, theta))+B8*(diff(U(x, theta), x, theta))+B9*(diff(W(x, theta), x, x, theta))+B10*(diff(W(x, theta), theta, theta, theta))+B11*(diff(W(x, theta), theta))-B12*omega^2*V(x, theta)

B1*(diff(diff(diff(diff(V(x, theta), x), x), x), x))+B2*(diff(diff(V(x, theta), x), x))+B3*(diff(diff(diff(diff(V(x, theta), theta), theta), theta), theta))+B4*(diff(diff(V(x, theta), theta), theta))+B5*(diff(diff(diff(diff(V(x, theta), theta), theta), x), x))+B6*(diff(diff(diff(diff(U(x, theta), theta), x), x), x))+B7*(diff(diff(diff(diff(U(x, theta), theta), theta), theta), x))+B8*(diff(diff(U(x, theta), theta), x))+B9*(diff(diff(diff(W(x, theta), theta), x), x))+B10*(diff(diff(diff(W(x, theta), theta), theta), theta))+B11*(diff(W(x, theta), theta))-B12*omega^2*V(x, theta)

(2)

pd3 := C1*(diff(W(x, theta), x, x, x, x, x, x))+C2*(diff(W(x, theta), x, x, x, x))+C3*(diff(W(x, theta), x, x, x, x, theta, theta))+C4*(diff(W(x, theta), x, x))+C5*(diff(W(x, theta), x, x, theta, theta))+C6*(diff(W(x, theta), x, x, theta, theta, theta, theta))+C7*(diff(U(x, theta), x, x, x))+C8*(diff(U(x, theta), x))+C9*(diff(U(x, theta), x, theta, theta))+C10*(diff(V(x, theta), x, x, theta))+C11*(diff(V(x, theta), theta))+C12*(diff(V(x, theta), theta, theta, theta))+C13*W(x, theta)+C14*(diff(W(x, theta), theta, theta))+C15*(diff(W(x, theta), theta, theta, theta, theta))+C16*(diff(W(x, theta), theta, theta, theta, theta, theta, theta))-C19*omega^2*W(x, theta)-C18*omega^2*(diff(W(x, theta), theta, theta))-C17*omega^2*(diff(W(x, theta), x, x))

C1*(diff(diff(diff(diff(diff(diff(W(x, theta), x), x), x), x), x), x))+C2*(diff(diff(diff(diff(W(x, theta), x), x), x), x))+C3*(diff(diff(diff(diff(diff(diff(W(x, theta), theta), theta), x), x), x), x))+C4*(diff(diff(W(x, theta), x), x))+C5*(diff(diff(diff(diff(W(x, theta), theta), theta), x), x))+C6*(diff(diff(diff(diff(diff(diff(W(x, theta), theta), theta), theta), theta), x), x))+C7*(diff(diff(diff(U(x, theta), x), x), x))+C8*(diff(U(x, theta), x))+C9*(diff(diff(diff(U(x, theta), theta), theta), x))+C10*(diff(diff(diff(V(x, theta), theta), x), x))+C11*(diff(V(x, theta), theta))+C12*(diff(diff(diff(V(x, theta), theta), theta), theta))+C13*W(x, theta)+C14*(diff(diff(W(x, theta), theta), theta))+C15*(diff(diff(diff(diff(W(x, theta), theta), theta), theta), theta))+C16*(diff(diff(diff(diff(diff(diff(W(x, theta), theta), theta), theta), theta), theta), theta))-C19*omega^2*W(x, theta)-C18*omega^2*(diff(diff(W(x, theta), theta), theta))-C17*omega^2*(diff(diff(W(x, theta), x), x))

(3)

``


Download 3-1.mw

hi

i have a problem with convert mathematica code in to maple one

i attached maple file .some line have error.please help me for remove error

thanks

fdm.mw

fdm.pdf

Dear Community,

Is there an easy way to convert elapsed days since January 1 1900 to date, i.e. to year, month, day in Maple? E.g. 23021 days should convert to 1963.01.10. Also what is the opposite, i.e. from date to elapsed days?

tx in advance,

best regards

Andras

hi.how convert root of to explicit form.

w is a imaginary..

thanks

123.mw

restart; w := (1/2)*(2*d-5+I*sqrt(4*d-9))/(d-2)

(1/2)*(2*d-5+I*(4*d-9)^(1/2))/(d-2)

(1)

with(LinearAlgebra):

{Q1 = RootOf((2*I)*(4*d-9)^(1/2)*_Z*d-((2*d-5+I*(4*d-9)^(1/2))/(d-2).(d*(I*(4*d-9)^(1/2)+1)*_Z/((d-2)*b)))*b*d+2*((2*d-5+I*(4*d-9)^(1/2))/(d-2).(d*(I*(4*d-9)^(1/2)+1)*_Z/((d-2)*b)))*b-2*d*_Z), Q2 = -(1/2)*d*(I*(4*d-9)^(1/2)+1)*RootOf((2*I)*(4*d-9)^(1/2)*_Z*d-((2*d-5+I*(4*d-9)^(1/2))/(d-2).(d*(I*(4*d-9)^(1/2)+1)*_Z/((d-2)*b)))*b*d+2*((2*d-5+I*(4*d-9)^(1/2))/(d-2).(d*(I*(4*d-9)^(1/2)+1)*_Z/((d-2)*b)))*b-2*d*_Z)/((d-2)*b)}

(2)

``

 

Download 123.mw

hi

if possible to convert matlab file in to maple fie program??convert_to_maple_program.txt

thanks

 

Hi guys,

 

I would like to convert a piecewise defined function of two variables into an if structure
Example :

F := (x,y) -> piecewise(x < 0, piecewise(y < 0, 0, 1), piecewise(y < 0, 1, 0));

What I expect is something like (the indentation is just for fun)
if x < 0 then
   if y < 0 then 0 else 1 end if;
else 
   if y < 0 then 1 else 0 end if;
 end if


I tried the following :

convert(F(x,y), `if`)  # but it only converts the "outer x condition" and keeps the "inner y conditions" unchanged

And next this :

map(u -> convert(u, `if`), F(x,y)):   # fails to give m
# and
map(u -> convert(u(x,y), `if`), F(x,y)): 
# ...

without success.

Can anoybody help me please.
I am also interested in an explanation of the reasons why the previous command do not work.

Thanks all

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