acer

32303 Reputation

29 Badges

19 years, 307 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

You could also set (per session) a new default for output that combines units to those dimensions (eg. volume/time).

restart

with(Units:-Simple)

 

The next command sets a default for simplification/combining of
units that make up a particular "dimension" (here, volume/time).

 

Units:-UseUnit(ml/min)

 

GFR := (18.2*Unit('mg'/'ml')*1.5)*Unit('ml'/'min')/(.201*Unit('mg'/'ml'))

135.8208955*Units:-Unit(mL/min)

13.0*Unit('cm')^3/Unit('day')

0.9027777778e-2*Units:-Unit(mL/min)

-2.3*Unit(kg/s)*Unit(m^3/g)

-0.1380000000e12*Units:-Unit(mL/min)

We can always force it the other way.

convert(GFR, units, m^3/s)

0.2263681592e-5*Units:-Unit(m^3/s)

Download un_useun.mw

Matrix(convert(Q,listlist))

Is this the kind of effect you're after?

nb. It's printing the results to the terminal. Adjust if wanted with strings programmatically returned.

Download CG_ex.mw

I don't see any attempt at calling BarChart (or ColumnGraph) in your worksheet. What did you try and what is the result you expect?

Are you perhaps wanting to do something like, say,

   BarChart(frequences, view = [0 .. ceil(1.08*max(Weights)), default])

or,

   ColumnGraph(frequences, view = 0 .. ceil(1.08*max(Weights)))

or,

   ColumnGraph(map(e -> nprintf(`#mn("%a",fontweight="bold",mathcolor="Red");`, lhs(e)) = rhs(e), frequences), view = 0 .. ceil(1.08*max(Weights)), gridlines)

or a similar effect for BarChart, etc. (Or you could utilize the many options of those commands to change spacing, widths, etc.)

S4_Statistiques_Descriptives_AxeTravail_Complet_ac.mw

That last one produces something like the following, btw,

Your boundary conditions for the plots pltU[j] where you are calling it u(y) = D(psi) are, in fact,

     D(psi)(-1) = 0
     D(psi)(1) = .2e-1

That comes directly from your code,

    D(psi)(1 + x^2/2) = 2*H,
    D(psi)(-1 - x^2/2) = 0

where your parameter data uses x=0 and H=0.01.

So, your claim that "...according to the BCs, they should start from 1" is false, for u(y)=D(psi).

Your plots pltU[j] each show the range y=-1..1, and all use u(-1)=D(psi)(-1)=0 and u(1)=D(psi)(1)=0.02 just as your formulas dictate. They each "start" at y=-1 with boundary value u(-1)=D(psi)(-1)=0.

First let's have a look at an approach using a slightly different "simplification" of the equations, and then simplifying under a simpler extra assumption.

Then we can consider some weaknesses which might be interfering (internally) with the natural attempt using these short assumptions (and why the system seems to need an unnecessarily longer form of the rho-1>beta  assumption).

restart;

eqqq := map(simplify,{sqrt(beta*rho*xi[8]^2 - beta*xi[8]^2)/xi[8] = sqrt(beta*rho - beta), (-rho + 1 + sqrt(beta*rho*xi[8]^2 - beta*xi[8]^2))/(xi[3]*xi[8] - 1) = sqrt(beta*rho - beta), -(-rho*xi[3]*xi[8] + sqrt(beta*rho*xi[8]^2 - beta*xi[8]^2) + xi[3]*xi[8])/(xi[8]*(xi[3]*xi[8] - 1)) = rho - 1}):

eq3 := map(eq->(rhs-lhs)(eq),eqqq);

{(beta*(rho-1))^(1/2)-(beta*xi[8]^2*(rho-1))^(1/2)/xi[8], (beta*(rho-1))^(1/2)-(-rho+1+(beta*xi[8]^2*(rho-1))^(1/2))/(xi[3]*xi[8]-1), rho-1-(-(beta*xi[8]^2*(rho-1))^(1/2)+(rho-1)*xi[3]*xi[8])/(xi[8]*(xi[3]*xi[8]-1))}

Let's reform the equations, then solve, and then use some (short) assumptions
in a
simplify call.
 

alt := solve(evala(eq3),{xi[8],xi[3]});

{xi[3] = -(-beta+(beta*(rho-1))^(1/2))/beta, xi[8] = (-beta+(beta*(rho-1))^(1/2))/(beta*(rho-1))^(1/2)}

simplify(eval(eq3,alt)) assuming rho>1, beta>0, rho-1>beta;

{0}

Some of the following weaknesses might well be getting in the way
of the "original" attempt, also done below.
We'll use these assumptions:
 

conds := rho>1, beta>0, rho-1>beta;

1 < rho, 0 < beta, beta < rho-1

Ideally the following would all return true, since we have rho>1 .
 

is( -1 - sqrt(beta)*sqrt(rho - 1) + rho > 0 ) assuming conds;
is( rho - 1 > sqrt(beta)*sqrt(rho - 1) ) assuming conds;
is( (rho - 1)/sqrt(rho - 1) > sqrt(beta) ) assuming conds;

FAIL

FAIL

true

Dividing the argument of signum by a quantity sqrt(rho-1) which is strictly
greater than zero should not invalidate its result.


We can leverage this second example, further on, for the simplification following
substitution of the solution.

 

signum( (-1 - sqrt(beta)*sqrt(rho - 1) + rho)/sqrt(rho-1) ) assuming conds;
signum( evala((-1 - sqrt(beta)*sqrt(rho - 1) + rho)/sqrt(rho-1)) ) assuming conds;

signum(-1-beta^(1/2)*(rho-1)^(1/2)+rho)

1

The straightward way, solve, then backsubstitute and simplify under the
assumptions. Ideally, the simpler
conds would be enough.
 

sol := solve(eq3,{xi[8],xi[3]});

{xi[3] = (1+(beta*(rho-1))^(1/2)-rho)/(beta*(rho-1))^(1/2), xi[8] = -(1+(beta*(rho-1))^(1/2)-rho)/(rho-1)}

simplify(eval(evala(eq3),sol)) assuming conds; # another weakness

{(1-signum(-1-beta^(1/2)*(rho-1)^(1/2)+rho))*(rho-1)^(1/2)*beta^(1/2), (-1+signum(-1-beta^(1/2)*(rho-1)^(1/2)+rho))*(-beta*(rho-1)^(1/2)+beta^(1/2)*(rho-1))*beta^(1/2)/(-beta^(1/2)*(rho-1)^(1/2)+beta+rho-1), (rho-1)*beta^(1/2)*(-1+signum(-1-beta^(1/2)*(rho-1)^(1/2)+rho))*((-rho+1)*beta^(1/2)+beta*(rho-1)^(1/2))/((beta^(1/2)*(rho-1)^(1/2)-rho+1)*(beta^(1/2)*(rho-1)^(1/2)-beta-rho+1))}

The following is not a general purpose workaround, of course.
But we can show that, with hand-holding
, adequate machinery is there.
 

evalindets( simplify(eval(evala(eq3),sol)),
                     specfunc(signum),
                     term->signum(evala(op(term)/sqrt(rho-1))) ) assuming conds;

{0}


Download solve_ineq_assump_ex.mw

I'll be submitting the various weaknessess in a bug report (if nobody else has).

For example, to import your two files with sparse storage and float[8] double precision data,

M := ImportMatrix("test-km-1_MASS2.txt", source=MATLAB, format=entries, datatype=float[8]):

K := ImportMatrix("test-km-1_STIF2.txt", source=MATLAB, format=entries, datatype=float[8]):

After that, I can optionally check that they're been imported with storage=sparse and datatype=float[8] (ie. hardware double precision).

rtable_options(M, storage), rtable_options(M, datatype);

            sparse, float[8]

rtable_options(M, storage), rtable_options(K, datatype);

             sparse, float[8]

For plots, the typeset option allows you to get multiple things (text, math, etc) rendered in sequence together but without comma separators.

with(Typesetting,':-mtext'):
plot(x^2,'title'=':-typeset'(mtext("sorta",'fontfamily'="Courier",'size'=30),
                             mtext(" kinda",'fontfamily'="Helvetica",'size'=20),
                             mtext(" works\n",'size'=10)));

ps. I also added some quotes, to guard against the situation in which some of the unprotected global names were assigned values. (mint)

One way is to utilize the plots:-listplot command, with the useunits option.

testSheetHorseShoe_ac.mw

That attachment produce the following, amongst a few other plots.

The plot command works with Maple's usual scheme for procedure calls, and its arguments are evaluated up-front, ie. before the plot routine receieves them.

So when you call,

   plot(kk(3,m)[1], ...)

then the call kk(3,m) gets evaluated up-front, ie. before m gets any actual numeric values.

But when m is just a symbolic name then the sort actions inside your kk procedure don't act the same way (for generic name m) as they would for all the numeric values of m.

The key thing, then, is to delay the evalutation of the argument k(3,m)[1] passed to the plot command until such time as name m gets actual numeric values. That avoids the so-called premature evaluation.

This is a very common user-issue.

Below, I show you code for two ways to delay that evaluation, for your plot attempts. The underlying problem and its possible alternatives are the same here for plot3d as they are for plot, so I'll leave those for you to adjust according to whichever approach you choose.

restart

with(LinearAlgebra); with(Typesetting); Settings(typesetdot = true); with(plots); with(DEtools); with(MultiSeries); with(plottools)

couple := [diff(x(t), `$`(t, 2))+2*xi*`&omega;__1`*(diff(x(t), t))+`&omega;__1`^2*x(t)+m__1*l*(diff(`&varphi;`(t), `$`(t, 2)))-m__1*l*(diff(varphi(t), t))^2*varphi(t) = F*cos(Omega*t), diff(varphi(t), `$`(t, 2))+(diff(x(t), `$`(t, 2)))/l+`&omega;__2`^2*varphi(t) = 0]

couple1 := remove(has, (lhs-rhs)(couple[1]), [2*xi*`&omega;__1`*(diff(x(t), t)), m__1*l*(diff(`&varphi;`(t), t))^2*`&varphi;`(t), F*cos(Omega*t)])+epsilon*select(has, (lhs-rhs)(couple[1]), [2*xi*`&omega;__1`*(diff(x(t), t)), m__1*l*(diff(`&varphi;`(t), t))^2*`&varphi;`(t), F*cos(Omega*t)]); couple2 := (lhs-rhs)(couple[2])

变换F的值,F=f cos((Omega2+εσ)(T0+εT1))

data1 := F*cos(Omega*t) = f*cos(applyrule(T__0*epsilon = T__1, expand((epsilon*sigma+`&Omega;__2`)*T__0)))

couple := [subs(data1, couple1), couple2]

timescales := T__0, T__1

dt__1 := proc (expr) options operator, arrow; diff(expr, T__0)+epsilon*(diff(expr, T__1)) end proc

dt__2 := proc (expr) options operator, arrow; diff(expr, `$`(T__0, 2))+2*epsilon*(diff(diff(expr, T__1), T__0))+epsilon^2*(diff(expr, `$`(T__1, 2))) end proc

expand_1 := subs(diff(x(t), t, t) = dt__2(x(timescales)), diff(x(t), t) = dt__1(x(timescales)), x(t) = x(timescales), diff(`&varphi;`(t), t, t) = dt__2(`&varphi;`(timescales)), diff(`&varphi;`(t), t) = dt__1(`&varphi;`(timescales)), `&varphi;`(t) = `&varphi;`(timescales), couple)

fexpand := seq(convert(series(expand_1[i], epsilon = 0, 2), polynom), i = 1 .. 2)

solForm := map(proc (term) local i; term(timescales) = add(epsilon^i*term[i](timescales), i = 0 .. 1) end proc, [x, varphi])[]

fexpand2 := seq(seq(coeff(expand(subs(solForm, fexpand[i])), epsilon^j), i = 1 .. 2), j = 1 .. 2)

ordery0 := map(proc (expr) options operator, arrow; expr = 0 end proc, [seq(remove(has, expand(subs(solForm, fexpand[i])), epsilon), i = 1 .. 2)])[]

ordery1 := seq(select(has, fexpand2[i], [diff(x[1](T__0, T__1), T__0, T__0), diff(x[1](T__0, T__1), T__0, T__0), x[1](T__0, T__1), diff(x[1](T__0, T__1), T__0), diff(`&varphi;`[1](T__0, T__1), T__0), `&varphi;`[1](T__0, T__1), V[1](T__0, T__1)]) = -remove(has, fexpand2[i], [diff(`&varphi;`[1](T__0, T__1), T__0, T__0), diff(x[1](T__0, T__1), T__0, T__0), x[1](T__0, T__1), diff(x[1](T__0, T__1), T__0), diff(`&varphi;`[1](T__0, T__1), T__0), `&varphi;`[1](T__0, T__1), V[1](T__0, T__1)]), i = 1 .. 2)[]

针对最初上部方程求解固有频率

couple1 := [remove(has, couple[1], epsilon), couple[2]]

data2 := x(t) = x__0*exp(I*omega*t), varphi(t) = `&varphi;__0`*exp(I*omega*t)

expand(simplify(expand(subs(data2, couple1)/exp(I*omega*t)))); AA, bb := GenerateMatrix(%, [x__0, `&varphi;__0`]); det := Determinant(AA); omega_nature := solve(%, omega)

NULL

data4 := xi = 0.25e-1, g = 9.8, M = 300, k = 2000, F = 600

m__1 := subs(data4, m/(m+M)); `&omega;__1` := evalf(subs(data4, sqrt(k/(m+M)))); `&omega;__2` := evalf(subs(data4, sqrt(g/l))); f := subs(data4, F/(m+M))

`&Omega;__1` := sort(subs(data4, `~`[evalf]([omega_nature])))[3]; `&Omega;__2` := sort(subs(data4, `~`[evalf]([omega_nature])))[4]

Q__1 := subs(data4, l*m__1*`&Omega;__1`^2/(-`&Omega;__1`^2+`&omega;__1`^2)); Q__2 := subs(data4, l*m__1*`&Omega;__2`^2/(-`&Omega;__2`^2+`&omega;__1`^2))

sort(subs(l = 3, m = 300, evalf([omega_nature])))

subs(data4, l = 1, m = 100, `~`[evalf]([omega_nature]))

绘制比例Q2的变化曲线

 

kk := proc (i, ii) local Omega1, Omega2, Q1, Q2; Omega1 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[3]; Omega2 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[4]; Q1 := subs(data4, l = i, m = ii, l*m__1*Omega1^2/(-Omega1^2+`&omega;__1`^2)); Q2 := subs(data4, l = i, m = ii, l*m__1*Omega2^2/(-Omega2^2+`&omega;__1`^2)); return Omega1, Omega2, Q1, Q2 end proc

Notice the distinction here!

kk(3, 300)

1.390272336, 3.356656496, 2.070214276, -2.130214275


If instead you call kk with a symbolic second argument m then
that calls evaluates, and subsequent substitution with numeric values
or 
m is a completely different result from calling kk with the actual
numeric second arguments.


So, in your procedure, the sort actions will work differently if m
is not an actual number.

That's what's gone wrong in your original plotting attempts. It's
sometimes called "premature evaluation". The plot call is
receiving the prematurely evaluated result from kk(3,m).
temp := kk(3, m); eval(%, m = 300)

3.356656496, -3.356656496, -2.130214275, -2.130214275

One was to deal with it is to use the operator-form
calling sequence of the plot command.
plot(proc (m) options operator, arrow; kk(3, m)[1] end proc, 200 .. 600)

This is your original attempt, with argument kk(3,m) accidentally evaluated too early.

plot(kk(3, m)[1], m = 200 .. 600)

Another way to handle it is to make your procedure
kk return unevaluated if its arguments are not the
"expected" type, ie. numeric.

altkk := proc(i, ii) local Omega1, Omega2, Q1, Q2;
  if not ii::numeric and i::numeric then return 'procname'(args); end if;
  Omega1 := sort(subs(data4, l = i, m = ii, evalf~([omega_nature])))[3];
  Omega2 := sort(subs(data4, l = i, m = ii, evalf~([omega_nature])))[4];
  Q1 := subs(data4, l = i, m = ii, l*m__1*Omega1^2/(-Omega1^2 + omega__1^2));
  Q2 := subs(data4, l = i, m = ii, l*m__1*Omega2^2/(-Omega2^2 + omega__1^2));
  return Omega1, Omega2, Q1, Q2;
end proc;

proc (i, ii) local Omega1, Omega2, Q1, Q2; if not ii::numeric and i::numeric then return ('procname')(args) end if; Omega1 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[3]; Omega2 := sort(subs(data4, l = i, m = ii, `~`[evalf]([omega_nature])))[4]; Q1 := subs(data4, l = i, m = ii, l*m__1*Omega1^2/(-Omega1^2+omega__1^2)); Q2 := subs(data4, l = i, m = ii, l*m__1*Omega2^2/(-Omega2^2+omega__1^2)); return Omega1, Omega2, Q1, Q2 end proc

altkk(3,m);

altkk(3, m)

plot(altkk(3, m)[1], m = 200 .. 600);

NULL

Download gra423_Omega_ac.mw

nb. You could also delay the evaluation with single right-ticks (aka unevaluation quotes), by instead doing it as,
      plot( 'kk(3,m)'[1], ... )
but I didn't show that above because quotes seems to confused some people (and also because the uneval-quotes are ephemeral; if you pass around an expression with them then they vanish, upon intermediate evaluation...). Definitely not the best choice.

ps. There are several kinds of ways in which the issue of premature evaluation can be an issue. Another common case is where an error message occurs when the plotted procedure call gets accidentally evaluated. As you can see from that link, that error is common enough that it has its own special page. Your situation is more insidious because instead of a helpful error and stoppage your code merely procedes with wrong values (which for another example might possibly be overlooked).

Using implicitplot3d for generating a plot of a plane is a relatively very inefficient way to do it.

But first, to address your particular query: No, you don't need the plots:-display call, and that's not actually what made it work for you. What made it work for you is that your large plot structure by default needs a separate printing, without being in an assignment statement, in order for the GUI to render the plot. See the attachment below, for an example.

A more efficient way to construct the 3D plot of the plane would be to use the plot3d command with the minimal grid=[2,2] option. (Using a small plot structure will get better GUI performance if you have to rotate it much, or use it in an animation, or export it, or transform it, or right-click adjust it much, etc.)

restart

with(plots)

pln := x-2*y+3*z

x-2*y+3*z

P := plot3d(solve(pln, z), x = -3 .. 3, y = -3 .. 3, grid = [2, 2], transparency = .6)

length(P)

117

P;P

plt0 := implicitplot3d(pln, x = -3 .. 3, y = -3 .. 3, z = -3 .. 3, style = patchnogrid, transparency = .6)

length(plt0)

108118

plt0;plt0

NULL

Download 2025-05-18_Q_display_a_simple_plane_ac.mw


nb. For this example, the plt0 structure is about 1000 times larger than P.

Here are a few ways, producing either Matrices or DataFrames. Choose which you'd prefer.

The key bit seems to be removal of the datatype=truefalse from the inner Matrix, so that arbitrary substitutions can be made. That datatype restricts what kind of value can the stored entries can take.

I've split these into a few steps, both to show an idea of what's going on as well as to allow you to just take the generated Matrix rather than the new DataFrame (if you prefer).

restart;

with(Logic):

T:=TruthTable(a &xor b)

DataFrame(Matrix(4, 3, {(1, 1) = false, (1, 2) = false, (1, 3) = false, (2, 1) = false, (2, 2) = true, (2, 3) = true, (3, 1) = true, (3, 2) = false, (3, 3) = true, (4, 1) = true, (4, 2) = true, (4, 3) = false}), rows = [1, 2, 3, 4], columns = [a, b, value], datatypes = [truefalse, truefalse, truefalse])


The Matrix container inside the DataFrame assigned to T has
datatype=truefalse, which is awkward because it restricts
what kind of value can be used as replacement.

Let's re-construct the DataFrame, without that restriction.

T2:=DataFrame(Matrix(convert(T,Matrix),'datatype'=anything),
              columns=['a','b',value]);

DataFrame(Matrix(4, 3, {(1, 1) = false, (1, 2) = false, (1, 3) = false, (2, 1) = false, (2, 2) = true, (2, 3) = true, (3, 1) = true, (3, 2) = false, (3, 3) = true, (4, 1) = true, (4, 2) = true, (4, 3) = false}), rows = [1, 2, 3, 4], columns = [a, b, value])

map(e->subs(true='t',false='f',e),T2);

DataFrame(Matrix(4, 3, {(1, 1) = f, (1, 2) = f, (1, 3) = f, (2, 1) = f, (2, 2) = t, (2, 3) = t, (3, 1) = t, (3, 2) = f, (3, 3) = t, (4, 1) = t, (4, 2) = t, (4, 3) = f}), rows = [1, 2, 3, 4], columns = [a, b, value])


Another way to do it...

M0 := Matrix(convert(T,Matrix),'datatype'=anything);
subs(true='t',false='f',M0);
DataFrame(%, columns=['a','b',value]);

Matrix(4, 3, {(1, 1) = false, (1, 2) = false, (1, 3) = false, (2, 1) = false, (2, 2) = true, (2, 3) = true, (3, 1) = true, (3, 2) = false, (3, 3) = true, (4, 1) = true, (4, 2) = true, (4, 3) = false})

Matrix(4, 3, {(1, 1) = f, (1, 2) = f, (1, 3) = f, (2, 1) = f, (2, 2) = t, (2, 3) = t, (3, 1) = t, (3, 2) = f, (3, 3) = t, (4, 1) = t, (4, 2) = t, (4, 3) = f})

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module


And another...

M1 := map(e->subs(true='t',false='f',e),convert(T,Matrix));
DataFrame(M1, columns=['a','b',value]);

Matrix(4, 3, {(1, 1) = f, (1, 2) = f, (1, 3) = f, (2, 1) = f, (2, 2) = t, (2, 3) = t, (3, 1) = t, (3, 2) = f, (3, 3) = t, (4, 1) = t, (4, 2) = t, (4, 3) = f})

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module


Yet another way...

M := TruthTable(a &xor b, 'output'=Matrix);
M2 := map(e->subs(true='t',false='f',e),M);
DataFrame(M2, columns=['a','b',value]);

Matrix(4, 3, {(1, 1) = false, (1, 2) = false, (1, 3) = false, (2, 1) = false, (2, 2) = true, (2, 3) = true, (3, 1) = true, (3, 2) = false, (3, 3) = true, (4, 1) = true, (4, 2) = true, (4, 3) = false})

Matrix(4, 3, {(1, 1) = f, (1, 2) = f, (1, 3) = f, (2, 1) = f, (2, 2) = t, (2, 3) = t, (3, 1) = t, (3, 2) = f, (3, 3) = t, (4, 1) = t, (4, 2) = t, (4, 3) = f})

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

Download TT_dt.mw

You can use Or(x<1,x>1), to forestall difficulties with assuming x<>1 (both at once, which can sometimes accidentally turn into `false`).

restart;

ode := diff(y(x),x)*(x-ln(diff(y(x),x))) = 1;

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

maple_sol := dsolve(ode);

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

odetest(maple_sol,ode) assuming Or(x<1,x>1);

0

Download odetest_challange_may_15_2025_ac.mw

ps. I do not recommend using simplify(...,symbolic), if you really care about whether the result is correct.

It's pretty easy to just do the brute force check, with a double seq/loop, and quite quick for just going up to 100.

So, for a fun alternative,

restart;


You can stop looking above x=N

N := floor(fsolve(factorial(x)+1=100^2, x=1..100));

7

F := x -> local X := x! + 1;
          ifelse(issqr(X),[x,sqrt(X)],NULL):

 

sols := CodeTools:-Usage( [ seq(F(x), x=1..N) ] );

memory used=5.64KiB, alloc change=0 bytes, cpu time=0ns, real time=0ns, gc time=0ns

[[4, 5], [5, 11], [7, 71]]


Now, let's display those results,

seq( print(InertForm:-Display(`%factorial`(s[1])+1=s[2]%^2,
                              'inert'=false)),  s=sols);

factorial(4)+1 = `%^`(5, 2)

factorial(5)+1 = `%^`(11, 2)

factorial(7)+1 = `%^`(71, 2); "_noterminate"

Download sol_fac.mw

Since N=7 is small there are even more lightweight and very fast alternative approaches. (Even the cost of the F procedure calls is slightly wasteful here.) Perhaps the nice typesetting of the solutions is the more interesting bit here, and naturally you can use that no matter how you compute the solutions.

Another way, for the second problem,

restart

c := sum(1/i, i = 1 .. n)

Psi(n+1)+gamma

c := expand(c)

Psi(n)+1/n+gamma

s := sum(c/(n*(n+1)), n = 1 .. infinity)

(1/6)*Pi^2

Download test1_ac.mw

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