MaplePrimes Questions

Suppose I want to calculate gcd(g(x),f(x))=a(x)f(x)+b(x)g(x) for two polynomial, i.e finding the RHS representation of the gcd, then how to implement this in maple?

I know of the command GCD(f(x),g(x)) but how to find the RHS representation?

Thanks!

Many formulas use a capital D to define parameters. A popular example is the second moment of area "I" of a tube. In Maple we get

Both I and D are protected symbols in Maple and are therefore printed in roman. With the "local" command, I and D can be used as unprotected symbols. However, only the unprotected "I" is printed in italic (like other symbols or names do). D is still printed in roman, which spoils Maple's excellent printout (a bit).

I hope this inconsistency can be improved one day. For the time being, I am looking for better alternatives than my workaround with a fat white space in the attachment. Are there better workarounds?

Italic_I_and_D.mw

primes_integrale_exp.mwThe integral in x of 

exp(-sqrt(x^2 + c))

was done by Maple 11 but return unevaluated in Maple 2021,

see attached worksheet 

I am trying to solve the equation in the attached Maple file, but Maple cannot return a result.

 

restart

Digits := 30

30

(1)

with(plots)

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fieldplot, fieldplot3d, gradplot, gradplot3d, implicitplot, implicitplot3d, inequal, interactive, interactiveparams, intersectplot, listcontplot, listcontplot3d, listdensityplot, listplot, listplot3d, loglogplot, logplot, matrixplot, multiple, odeplot, pareto, plotcompare, pointplot, pointplot3d, polarplot, polygonplot, polygonplot3d, polyhedra_supported, polyhedraplot, rootlocus, semilogplot, setcolors, setoptions, setoptions3d, shadebetween, spacecurve, sparsematrixplot, surfdata, textplot, textplot3d, tubeplot]

(2)

with(Statistics)

NULL

say the f(x) is a Beta with parameters alpha and beta

 

alpha := 10

10

(3)

beta := 100000

100000

(4)

"f(x):=PDF(BetaDistribution(alpha,beta),x)"

proc (x) options operator, arrow, function_assign; Statistics:-PDF(BetaDistribution(alpha, beta), x) end proc

(5)

f(x)

piecewise(x < 0, 0, x < 1, x^9*(1-x)^99999/Beta(10, 100000), 0)

(6)

NULL

semilogplot(PDF(BetaDistribution(alpha, beta), x), x = 0 .. 1)

 

 

fsolve(int(f(x), x = 0 .. y) = .1, y = 0 .. 1)

Download test_fsolve_integ.mw

On a shared cluster with 32 CPU cores, how do I limit Maple (called from the Linux command line) to use only 8 cores? (Certain built-in operations in Maple are parallelized by default.)

I try to sove the equation x^2-10*y^2=9 with tne procedure : 
genpellsolve := proc(D::posint, N::integer)
local t, u, L1, L2, sols, x, y;
if type(sqrt(D), integer) then error "D must be a nonsquare integer"; end
if; t, u := pellsolve(D); if 0 < N then L1 := 0;
L2 := floor(sqrt(1/2*N*(t - 1)/D)); elif N < 0 then L1 := ceil(sqrt(-N/D));
L2 := floor(sqrt(-1/2*N*(t + 1)/D)); else return {[0, 0]}; end if;
sols := {}; for y from L1 to L2 do x := sqrt(N + D*y^2);
if type(x, integer) then sols := sols union {[x, y]};
if (x^2 + D*y^2) mod N <> 0 or (2*x*y) mod N <> 0 then sols := sols union {[-x, y]};
end if;
end if;
end do;  return sols;
end proc:
This procedudure fails; I don't see why. Thank you for your help.

I upgraded to Maple 2022 and some of my old sheets from Maple 2021 don't work anymore. When I plot a histogram with a legend I get an error saying: Error, invalid input: Statistics:-Histogram expects value for keyword parameter legend to be of type list, but received data set 1.

OK so maybe Histogram changed in 2022 although I didn't think it did. I ran it in Maple 2021 and I received no such error message. I chose to comply with the error message and the plot is output without an error message, however the legend labels carry extra characters I don't want to be there.  My attempt at a solution was to first use square brackets to make the object a list, then use the typeset command to typeset the label.  Strangely, the typeset command was not recognized.

What am I doing wrong? All I want is to plot a histogram with a legend labelled by a string which I have done many times in the past. I have attached below, a maplesheet which explicitly shows the problematic behaviour.

Thanks,
N

restart

NULL

with(Statistics)

with(LinearAlgebra)``

with(plots)``

NULL

NULL

Define Random Variable

X := RandomVariable(Normal(1, 2))

_R

(1)

Sample that variable and plot a histogram.

s := Sample(X, 1000)

NULL

Maple 2022 as opposed to Maple 2021 does not consider this a valid way to define the legend. It want's it defined in a list as requested in the pink error message.

Histogram(s, legend = "data set 1")

Error, invalid input: Statistics:-Histogram expects value for keyword parameter legend to be of type list, but received data set 1

 

NULL

NULL

Maple 2022 as opposed to Maple 2021 does not consider this a valid way to define the legend. It works fine in Maple 2021. Maple 2022, want's it defined in a list. This works but, the square brackets and quotation marks appear when I don't want them to. The legend shouldn't have these extra quotations and brackets, just the desired name.

Histogram(s, legend = ["data set 1"], size = [300, 300])

 

I tried the typeset command. It doesn't seem to be recognized anymore.

 

Histogram(s, legend = [typeset("data set 1")], size = [300, 300])

 

What am I doing wrong? All I want is to plot a histogram with a legend labelled by a string.   

Download legend_as_list.mw

I want to solve a system of 3 simple real linear odinary differential equations.

The solution using dsolve has some extra imaginary terms with very small (10^-10) coefficients.   How to I get just the real part of the solution.

Here is an example code:

v1 := 1;
v2 := 0.5;
k := 0.12;
p1 := 0.328;
p2 := 0.74;
l1 := 0.31;
l2 := 1.16;
sysode := diff(Cp(t), t) = -(p1 + p2 + k)*Cp(t) + l1*C1(t) + l2*C2(t), diff(C1(t), t) = (p1*Cp(t) - l1*C1(t))/v1, diff(C2(t), t) = (p2*Cp(t) - l2*C2(t))/v2;
ics := Cp(0) = 0.347, C1(0) = 0., C2(0) = 0.;
sol := convert(dsolve([sysode, ics]), float);

Hello everybody!! Can you please help me figure it out. I wrote the code, but for some reason I have an infinite loop going on, it counts normally to the cycle, as the cycle reaches, then everything is infinite

restart;
with(plots):
f:=unapply(2*x-4*cos(x)-0.6,x); #the equation itself
f1:=unapply(diff(f(x),x),x); #its derivative
a:=-0.5; b:=1.5; eps:=0.001: #interval and accuracy
 
 
phi:=unapply((4*cos(x)-0.6)/2,x); #solving the equation with respect to x
x[0]:=1; #I take any point from the interval
x[1]:=evalf(phi(x[0]));
L:=evalf(abs(phi(b)-phi(a))/abs(b-a)); 
L1:=evalf(abs(phi(x[1])-phi(x[0]))/abs(x[1]-x[0])); 
psi:=unapply(abs(diff(phi(x),x)),x);
plot([psi(x),1],x=a..b,color=[red,green]);
 
n:=1:
while abs(evalf(x[n]-x[n-1])) > eps do
n:=n+1:
x[n]:=evalf(phi(x[n-1]));
od;
fsolve(f(x)=0,x=a..b);

 

I'm trying to solve a coupled inductor problem.  All I'm trying to do is solve for the currents (which I could do), then solve for resonance by setting the imaginary part of I1 to 0 and solving for omega.  I then want to plug this resonant frequency back into I1 and evaluate it for some component values and coupling coefficient.

The problem is that even though I define the various variables as real,  Maple doesn't seem to recognize them as such.  I suspect I've failed to define one of them, and that is why it is responding like it is, but I can't find it.  

I'm also getting some weird behavior.....for example if I type :  wres0, I get the value I assigned to it --that's fine.  But then, when I type : wres0/(2*pi), I get an error, "Error, unable to parse 'mverbatim"   --- what does this mean?

This should be a pretty straight forward calculation on Maple, but at this point, I think I may be better off doing it by hand!  I appreciate any help you can provide.  Thank you.

reflected_load.mw

Hello :)

So what I was trying to find Galois group for quartic polynomials in a form f=x^+a_3*x^3+a_2*x^2+a_1*x+a_0, where 0<=a_i<=2 and a_0 <>0. I get polynomials and galois groups - that's not an issue. Lets say I specifically need polynomials with group D_4 so I run script

restart;
A := {seq(0 .. 2)};
A0 := A minus {0};
m := numelems(A)^3*(numelems(A) - 1);
a := Iterator:-CartesianProduct(A0, A $ 3);
s := seq(x^4 + add(v[i]*x^(i - 1), i = 1 .. 4), v = a);
for k to m do
if irreduc(s[k]) = 'true' then print(f[k] = s[k], galois(s[k])); end if end do;

This one gives all list of polynomalias and their galois group.

for k to m do
    if irreduc(s[k]) = 'true' then if galois(s[k]) = ("4T3", {"D(4)"}, "-", 8, {"(1 3)", "(1 2 3 4)"}) then print(f[k] = s[k], galois(s[k])); end if; end if;
end do;

This one gives me a list of D_4 specifically. 
When 0<=a_i<=2 - there are not many polynomials so I cant count it by hand, but if I make a sequence larger there are too many polynomials to count them manually. So the question is how to count how many polynomials there are with a group D_4? Or lets say how do I count how many polynomials are in each group?
Thank you

v2i2v_circuit.msim

I try to design a circuit to make a voltage-current-voltage translation. In my assumption, probe1.v is equal to probe2.v and it will generate a current(probe2.v / R4) through NMOS. The NMOS acts as a closed switch. Probe3.v is equal to CV3 and i can get "Probe4.v = CV1 + CV3". However, when the circuit operates, probe3.v isn't equal to CV3 and probe1.v isn't equal to probe2.v. I have tried to rise the differential input resistance and differential amplifier to make the Uin+ close to Uin- in op amp, but it doesn"t work effectively.
In addition, the closed resisitance of NMOS is also taken into consideration and i try to make it pretty below Kohm.

Could you help me fix the problem? 

Please help me solve the following problem about complex numbers with Maple: w= (3+zi)/(2+z) whose geometric representation in the "oxy" plane is a straight line. Calculate module of z. Thank you so much.

Hi,

I have a code (see below) for the following number sequence and want to produce a graph as well as the numerical data, please advise how to do it.

Sequence definition: Lexicographicaly least sequence of nonnegative integers commencing 1,3,5,7 such that any four  consecutive terms are mutually coprime.

The code I have so far is: 

ina := proc (n) false end :

a := proc (n) option remember; local k;

if n < 5 then k := 2*n-1

else for k from 2 while ina(k) or igcd(k, a(n-1)) <> 1 or igcd(k, a(n-2)) <> 1 or igcd(k, a(n-3)) <> 1

do  od 

fi; ina(k) := true; k

end proc;

seq(a(n), n = 1 .. 100);
1, 3, 5, 7, 2, 9, 11, 13, 4, 15, 17, 19, 8, 21, 23, 25, 16, 27, 

  29, 31, 10, 33, 37, 41, 14, 39, 43, 47, 20, 49, 51, 53, 22, 35, 

  57, 59, 26, 55, 61, 63, 32, 65, 67, 69, 28, 71, 73, 45, 34, 77, 

  79, 75, 38, 83, 89, 81, 40, 91, 97, 87, 44, 85, 101, 93, 46, 

  95, 103, 99, 52, 107, 109, 105, 58, 113, 121, 111, 50, 119, 

  127, 117, 62, 115, 131, 123, 56, 125, 137, 129, 64, 133, 139, 

  135, 68, 143, 149, 141, 70, 151, 157, 153

I have tried listplot but for some reason cant get the correct format

Hope you can help

Best regards

David.

First 202 203 204 205 206 207 208 Last Page 204 of 2308