## Polynomial Ideals Usage

Maple 2021

Our user wondered about using PolynomialIdeals:

1.  If we have n+1 polynomials,  f, g1,...,gn,  how to determine if  f  is in the ideal generated by  g1,...,gn?

2.  If so, how to write  f  as a polynomial combination of   g1,...,gn?

We suggested that;

The nicest interface to answer the first question is given by the ?PolynomialIdeals,Operators page: you can write

```with(PolynomialIdeals):
with(Operators):
J := <g1, g2, ..., gn>;
f in J; # true or false
```

To answer the second question, you need to use the lower level  package (which underlies the  package). This will also answer the first question for you. In particular the  command. You can write:

(Edit Feb 1, 2022 - use  instead of

```with(Groebner):
G := [g1, g2, ..., gn];
ord := tdeg(x,y,z); # replace x, y, z with the appropriate variables; you can also use other variable orders -- see ?Groebner,MonomialOrders

b := Basis(G, ord);
n := NormalForm(f, b, ord, 'Q');
# if n = 0 then f is in the ideal; Q is the list of coefficients:
f - add(Q[i] * b[i], i = 1 .. numelems(b)); # this will be equal to n.```

## single step debug within a worksheet (or code edi...

Asked by:

Hello,

Can you enter debug in a worksheet vs a proc?

I have a for loop that is crashing in the middle with a bad calculated number to provide to a thermoprops function.   Is there a way to single step through a for loop (1500 iterations) to see which line is getting tripped up?  I can not post the worksheet as it's private development.   The question is generic to any "for loop".

I have also tried "porting" into a code edit region, but still can not enter the debugger mode.   Is proper debugger only available if I turn the "for loop" into a proc?   If yes, what is the availability of packages called right after restart for the worksheet for a proc, or do all the pre-calcs developed in the worksheet and the packages to be variables fed into the proc or packages re-declared insde a new proc ???

Sorry if this is a trival question.

Thanks in advance,
Bill

## How to combine matrices?...

Asked by:

I am a new user to Maple, but have used PTC's Mathcad and Prime.

I have several matrices that I need to combine both vertically and horizontally.  The command augment will combine the matrices horizontally.  I was unable to find a command to combine the matrices vertically.  I tried the stack command (Prime command).  The Maple stack command appears to have a different functionality.  Could you suggest which command would do the job?  The matrices are large and I would like to limit the number of rows and columns shown in the document.

The next step will be sorting the data. I am researching this at this time.

Thank you for the support,

David Tietje

## 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)

Download array-random-sample.mw

## procedure in ribbonplot...

Asked by:

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.

Thanks in advance.

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...

Asked by:

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

Download simplify.mw

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

Asked by:

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

Download tareaclase6.mw

## Defining a piecewise function....

Asked by:

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...

Asked by:

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 );

 >

Download complex.mw

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 ...

Asked by:

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 ...

Asked by:

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 :=

Download question7.mw

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 ...

Asked by:

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;

Download question6.mw

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

Asked by:

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;
Postgraduate student.

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

Asked by:

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)

Download SmithForm.mw

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

Asked by:

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;
Postgraduate student. question4.mw

 *** 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')]:

Download question4.mw

 First 18 19 20 21 22 23 24 Last Page 20 of 38
﻿