## Random Sample from Data Set

Maple 2021

A user would like to know if it is possible to specify a data set say, x:=[1,2,3,4,5,6] and then extract a random sample from that data set, i.e. xsample:=[3,2,4] for a bootstrapping-type calculation.

We suggested they use something like the following:

 (1)

## procedure in ribbonplot...

Hello people in Mapleprimes,
I haven't written in this site for a long time.

I have a question in the below program, which is to write ribbons.
For the implementation of this program,
I wrote this.
ribbonplot5([cos, sin, cos + sin], -Pi .. Pi,numpoints=20);

In the part of pattern matching, as -Pi .. Pi above is a range, so it is OK.
But, when I changed this part to x=-Pi..Pi, an error message appears.

ribbonplot5([cos, sin, cos + sin],x=-Pi .. Pi,numpoints=20);

brings error messages:
"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"

In the code of ribbonplot5,  x=-Pi..Pi which is the type of name=range shoud satisfy the pattern matching, as I wrote in the first part of the program as
ribbonplot5 := proc(Flist, r1::{range,name=range})

I cannot know why the part of the program:

" else
newFlist := map(unapply, Flist, lhs(r1));
opts := ['labels'=[lhs(r1), " "," "],
args[3 .. nargs]];
ribbonplot5(newFlist,rhs(r1),op(opts)):
"

wouldn't work well.

I wish I could get an answer to this.

This is a program in maple9 Advanced Programming Gude p. 253

graphic_ribbonplot.mw

```restart;
extend := proc(f)
local x, y;
unapply(f(x), x, y);
end proc:
p:=x->cos(2*x):
q:=extend(p);

ribbonplot5 := proc(Flist, r1::{range,name=range})
local i, m, p, n, opts,newFlist;
opts := [args[3 .. nargs]];
if type(r1, range) then
if not hasoption(opts, 'numpoints', 'n', 'opts')
then n := 25
end if;
m := nops(Flist);
p := seq(plot3d(extend(Flist[i]), r1, (i-1) .. i,
grid=[n, 2], op(opts)),
i = 1 .. m):
plots[display](p):
else
newFlist := map(unapply, Flist, lhs(r1));
opts := ['labels'=[lhs(r1), " "," "],
args[3 .. nargs]];
ribbonplot5(newFlist,rhs(r1),op(opts)):
end if:
end proc:
ribbonplot5([cos, sin, cos + sin], -Pi .. Pi,numpoints=20);
```

## Simplification with complex values...

I'd like to get the simplest possible expression when using simplify. The problem is that this is all done in a program, without having the benifit of looking at the expression on the screen and trying things. So I need a method that works for large set of input all the time.

I noticed in this example that simplify did not do what I think it should have.

Given the expression -2*(x^3 + 2)/(x*(x + 1)*(sqrt(3)*I + 2*x - 1)*(sqrt(3)*I - 2*x + 1)) it can be simplified to (x^3 + 2)/(2*x^4 + 2*x) but  I had to go into many tries in order to get this final result.

Is there a better way to do this? I end up now   doing simplify(expand(numer(expr))/expand(denom(expr))) in the hope to get better simplification.  Here is an example

 > interface(version);

 > restart;
 > w:=-2*(x^3+2)/x/(x+1)/(I*3^(1/2)+2*x-1)/(I*3^(1/2)-2*x+1);

 > simplify(w)

 > simplify(evalc(w))

 > simplify(w) assuming x::real

 > simplify(w,size)

 > simplify(w,symbolic)

 > simplify(w,sqrt)

 > simplify(expand(numer(w))/expand(denom(w)))

It would be nice if Maple simplify would just do it directly as follows in Mathematica. May be there is a an  option I am overlooking

## How can I get 2 and 3-fold symmetry axis for metha...

I drew a methane molecula and display three times because I wanted to get two-fold and three-fold symmetry axis. ,I would is that I would like to get a more exact output and doing it without clicking, it's say, using code. Can someone help me?tareaclase6.mw

University of Costa Rica

Course: SP-1493

Student: Lic. Marcus Vinicio Mora Salas

Instructor: Dr. Erick Castellón Elizondo

5

 Description In this assigment exercises e2.113,  e2.114, e2.115 and e2.117 was solved.
 ***e2.113

## Defining a piecewise function....

Suppose I have a real function which is defined on these intervals [x0,x1],...[x1,xn], and on each interval it's defined differently, for example f(x):=sqrt(x) if x>=0; f(x):=1/x if x<0.

For the last example I tried my last resort to use the assuming operator the following way:

f := ((x -> sqrt(x)) assuming (0 <= x)) or ((x -> 1/x) assuming (x < 0)) plot(f, x)

But it doesn't seem to be working, how do you propose to define this function? perhaps proc?

I tried looking for an example in maple's help, but didn't find any.

Your help is appreciated.

## what is recommended way to find magnitude of compl...

I read that abs(v) should find the magnitude of complex number. But I find cases where it does not.

Should one then use sqrt( Re(v)^2 + Im(v)^2 ) instead or is there different command to use?  Here is an example

 > interface(version)

 > restart;
 > v:=1/16*(I*5^(1/2)+I-4*sin(1/5*Pi))*2^(3/10)*(5-5^(1/2))^(1/2)-1/8*2^(4/5)*((I*5^(1/2)+I)*sin(1/5*Pi)+1/2*5^(1/2)+3/2)

 > abs(v)

 > sqrt( Re(v)^2 + Im(v)^2 );

 >

Here is the same thing in Mathematica:

I searched help for modulus but could not find one.

Maple 2021.2

## Does exits a parameter for plot method that allow ...

question8.mw

In the exercise uploaded I have to plot asymptotes of a function. I know this is possible using definitions of all kind of asymptotes and ploting in a figure. However I would like to know if exists some parameter for plot method that automatically show asymptotes.

## How can I exclude a number of a sequence in order ...

question7.mw

***e2.106

Plot this couple of parametric equations, identify the geometric figure known as the folium of Descartes , and relate properties of the figure to numerical coefficients in the equations.

restart: with(plots):
 >
 >

See how the plot of the folium of Descartes can be built with the following code:

d1 :=

For this question I need that who help me focus in second block of code in the document. Basically, what I am trying is to get a plot of folium of Dercastes using parametric equation to plot ordered pairs. In order to success, is needed to exclude t=-1. In the block is showed what I tried. I concluded that my approach in solving that part of exercise is wrong. What could be a well approach?

## How can I point out the coordinates of intercepts ...

question6.mw
How you can see, in the following exercise I built five plots, every one with the graph of two functions. The exersise say that I must find coordinates of any intersection. I think I can do it with solve command. However, I want point out coordinates of  intersections inside the plots. Probably exists a command or a parameter to success with my objetive. How can I do it?

 *** e2.103 Plot the following couples of formulae; note in particular the contrasting forms of two curves in each case, and find the coordinates of any intersections. i)    {}, ii)    {}, iii)    {},  iv)   {},  v)   {}   restart:

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas;
Chemist;
Postgraduate student at University of Costa Rica;

## How can I build a table with 11 plots?...

question5.mw

In document uploaded I tried to write a code to get as output 11 plots. I would like a format as this: 9 plots in 3 columns an 3 rows, and a fourth row with two center plots. To explain me better, I drew a rustic sketch of what I want, basically something like this:

However I tried but I fail and my output is horrible. So, I want to ask: Does exists some option to the plot[display] command or should I try another aproach?

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas;
Chemist;

## SmithForm for 4th order equation Transfer Function...

As part of my course work I've encountered a block wherein I need to convert a 4th order TF to a SmithForm but am unable to do so.

Can anyone help me with the code as attatched.

 (1)

 (2)

 (3)

 (4)

## How can I get an output expressed in Scientific no...

This is a simple problem of Chemistry. I solved the exercise, but there are three aspects I don't like about output:
1) Even kg*m2 *s-2 = J (SI unit to energy) and both are correct, one must be explicit with units in order to be totally clear, so I need an output with units of J/mol and not kg*m2 *s-2 mol-1.
2) I had to hardcode number of significant figures, so I had to analize quantitys in order to determine this number, wich as you can see, is three. I think Maple can compute significant figures automatically, but I could not find the command in documentation and even in this case is not totally needed, I would like to learn how do it because it could be very useful for more complex expressions.
3) Finally, output must be expressed using scientific notation, it's say enthalpy = 10.4*104 J/mol.
Therefore: How can I get adecuate output?
Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Sallas;
Chemist;

 *** e1.501 Using this equation attributed to Clausius and Clapeyron,  =   and these data for the vapour pressure of liquid mercury at the indicated temperatures,        =  1.6  Pa at  = 273.15 K and  = 36.4 Pa at  = 373.15 K estimate the enthalpy change  for vapourization of mercury over this range of temperature.   p := [1.6e-4*Unit('Pa'), 36.4*Unit('Pa')]:

system_of_PDE.mw

 >
 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)
 >
 (7)
 >
 (8)
 >
 >
 (9)
 >
 (10)
 >
 (11)
 >
 (12)
 >
 (13)
 >
 >
 (14)

 >
 (15)
 >
 >
 (16)
 >
 >

## How can I evaluate trigonometric expressions in te...

In relation with the following code and its respective output:

I want get an output in wicht left side of equalitys be expressed in radical terms and not in terms of trigonometric expressions. I tried convert(expr, radical), but the result is not that I want. Could someone help me please? Also I want to know if exists a method to avoid hardcoding list of the forloop other than [seq(i, i = 1..5)];

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas;
Chemist;
postgraduate student in University of Costa Rica

## Do someone tell me how can I solve this exersise u...

Do someone tell me how can I solve this exersise using a created procedure? Also I would like to know if using a procedure is useful and if in that form code lines will be reduce. If procedures are not useful. What is the best aproach?

Here the exercise and the code:

Before to begin to learn Maple, I used to do math with python. I usually built function and classes in order to reduce code lines and to generalize the problem, but I don't know if this aproach is useful with Maple. In fact, I have another question. Is it possible to write in a document some codeblocks using Maple and another using python? If answer is yes, how can I do it?

Thank you for helping me;
Greetings;
Lic. Marcus Vinicio Mora Salas
Chemist

 First 12 13 14 15 16 17 18 Last Page 14 of 32
﻿