acer

32333 Reputation

29 Badges

19 years, 324 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Have you tried storing KinAddCurveData in a .mla Library Archive file?

By that I mean using the Create and the Save commands from the LibraryTools package.

Then at the start of a new worksheet you would append the new .mla's location to libname, ie.
   libname := "mylocation/mylib.mla", libname:
where, naturally, you would replace with the actual name and location.

If that worked then it would be possible to (in one of a few ways) to make it automatically available without the need to manually prepend to libname.

But first check whether it works. (This is the usual way to make a procedure available across sessions, without completely recreating it. I hazily recall that procedures created via  define_external results could also be re-used in this way, but I'm not 100% sure. So you could test it.)

You could first test with a version of that was just something simple, like,
   KinAddCurveData := proc(x) x^2; end proc
That'd be a sanity check that the .mla approach itself was working. Once it did, you could try with the define_external version.

You might also need to look at the Help page with Topic,
    define_external,save
You may need to also pass the appropriate GENARGS option to define_external.

The creation and save session might look something like this,

KinAddCurveData :=
   define_external( 'AddCurveData',
                    'GENARGS'=proc()
         'LIB'=ExternalCalling:-ExternalLibraryName("C:\\Users\\tom\\Documents\\Excel docs\\kinexa dll solver\\equilibriumdll\\Equilibrium.dll");
                              end proc
);

mymla := LibraryTools:-Create("C:\\Users\\tom\\Documents\\MyEquil.mla");

LibraryTools:-Save(KinAddCurveData, mymla);

The usage session might then look like,

restart;
libname := "C:\\Users\\tom\\Documents\\MyEquil.mla",libname;

KinAddCurveData();

If it works you could also make the creation session fancier (test whether the .mla exists already, optionally delete it first, etc).

One thing I am not sure about is whether the GENARGS option allows you to use any arbitrary location for the .dll file, or whether it would need to be some place in the runtime linking path. A hint'd be if it complains about not finding it...

Please check for spelling mistakes, etc.

Your equations eq1, eq2 have instances of f and theta instead of f(x) and theta(x).

That is the meaning of the error message that you got, conveying that problem about f vs f(x).

You also have one too few boundary conditions.

So I've added D(theta)(9)=1, but you could change it.

restart

kernelopts(version);

`Maple 18.02, X86 64 LINUX, Oct 20 2014, Build ID 991181`

with(plots):

eq1 := diff(f(x), x, x, x)+(1/2)*(1+phi[1])^2.5*(1-phi[2])^2.5*((1-phi[2])(1-phi[1]+phi[1]*rho[s1]/rho[fl])+phi[2]*rho[s2]/rho[fl])*f(x)*(diff(f(x), x, x))+((1+phi[1])^2.5*(1-phi[2])^2.5*M+1/K[p])*sin(alpha)^2*(1-(diff(f(x), x)))+(1+phi[1])^2.5*(1-phi[2])^2.5*((1-phi[2])(1-phi[1]+phi[1]*rho[s1]*beta[s1]/(rho[fl]*beta[fl]))+phi[2]*rho[s2]*beta[s2]/(rho[fl]*beta[fl]))*lambda*cos(gamma)*theta(x) = 0:

eq2 := (k[s2]+2*k[fl]-2*phi[2](k[fl]-k[s2]))*(k[s1]+2*k[fl]-2*phi[1](k[fl]-k[s1]))*(diff(theta(x), x, x))/((k[s2]+2*k[fl]+phi[2](k[fl]-k[s2]))*(k[s1]+2*k[fl]+phi[1](k[fl]-k[s1])))+(1/2)*Pr*((1-phi[2])(1-phi[1]+phi[1]*rho[s1]*C[p][s1]/(rho[fl]*C[p][fl]))+phi[2]*rho[s2]*C[p][s2]/(rho[fl]*C[p][fl]))*f(x)*(diff(theta(x), x))+upsilon*Pr*theta(x)/((1-phi[2])(1-phi[1]+phi[1]*rho[s1]*C[p][s1]/(rho[fl]*C[p][fl]))+phi[2]*rho[s2]*C[p][s2]/(rho[fl]*C[p][fl])) = 0:

bcs := f(0) = 0, (D(f))(0) = 0, (D(f))(9) = 1;

f(0) = 0, (D(f))(0) = 0, (D(f))(9) = 1

theta(0) = 1, theta(9) = 0, (D(theta))(9) = 1

a1 := [phi[1] = .1, phi[2] = .1, rho[s1] = 3970, rho[s2] = 8933, rho[fl] = 997.1, beta[s1] = .85, beta[s2] = 1.67, beta[fl] = 21, k[s1] = 40, k[s2] = 401, k[fl] = .613, C[p][s1] = 765, C[p][s2] = 385, C[p][fl] = 4179, sin(alpha) = 0, cos(gamma) = 1, M = 1, K[p] = .5, lambda = 0, upsilon = 1]:

c1 := dsolve({bcs, bcs1, subs(a1, eq1), subs(a1, eq2)}, numeric):

TFP := Typesetting:-Typeset(theta(x)):

display(p1, p2, p3, p4, thickness = 3, legendstyle = [location = right], size = [700, 450]);

 

Download HIPT_ac.mw

Your substitution of the found roots is only being done at Digits=10. That means the working precision for the operations in the evaluation of the expression upon substitution. It does not mean that the results of that substitution in the expression (a compound expression) will be accurate to 10 places.

You can be a more accurate result from the substituion by using a higher Digits for that substitution/evaluate-at-a-point step.

I do this  below by wrapping the 2-argument eval calls (for evaluating the expression at a point) in an evalf[20] call so that it uses Digits=20 for the evaluations.

I also wrap that in evalf[5] so the the results are terser with just five digits.

For example,

forget(evalf);
[seq(evalf[5](evalf[20](eval(poly, x = SL[i]))), i = 1 .. nops(SL))];

   [         -11            -11             -11            -11  ]
   [2.8353 10    - 1.0886 10    I, 1.2648 10    - 3.3670 10    I]

forget(evalf);
[seq(evalf[5](evalf[10](eval(poly, x = SL[i]))), i = 1 .. nops(SL))];

   [-0.0000035746 + 0.0000044384 I, -0.000025687 - 0.0000048971 I]

Root_Poly_ac.mw

@C_R You asked about a Help page.

On the Help page with Topic,
    worksheet,documenting/2DMathShortcutKeys   (to which several other 2D Math pages like)
there is table item for backslash, with description,

   Escape Next Character (For displaying "^" or "_", for example)

In other words, it's a somewhat general way to enter literal plaintext characters in 2D Input/Math mode, as opposed to marked up entry.

That Help page is linked to from several other 2D Math pages, and appears 2nd in the Browser when querying for just "shortcut". The phrasing doesn't quite convey the breadth of the mechanism.

There's a less accurate description on the Help page with Topic,
   worksheet,help,QuickHelpDetails
ie,

   Escape next character for entering "^"

 

Unfortunately, there are no examples of such escaping on the Help page,
   worksheet,documenting,2DMathDetails

The use of % to denote an inert form is also underdocumented. There's a blurb on ?value, and a link there from ?InertForm. But the search ?inert doesn't provide much of direct use on it.

On my Linux there is a palettes subdirectory, at the same location as the maplerc GUI preferences file, if I have a Favorites palette set up.

For example, for my Maple 2022 that palettes subdirectory contained a Favorites.properties file. The maplerc file references it in two places: once to denote it as expanded or not, and once for its palettelist.

Perhaps there is a similar file and subfolder on your first machine, that you also need to copy over.

You could add one or more newline characters "\n" to the end of the axis label.

Below, I add just one.

legend_covers_plot_labels_ac.mw

I'm not entirely sure what you mean by, "So there should be a clear anwer, giving me back the whole RootOf function in the intervall."

Is it perhaps this:

restart

solve({x = RootOf(_Z^2-y, index = real[2])+1, 1 < y, y < 2, y < x}, x)

{x = RootOf(_Z^2-y, index = real[2])+1}

Download QUESTI_2_ac.MW

Or, modifying your original code to only include the extra argument x, the "whole RootOf" form is returned, without the Warning,

restart;
Sol := {x = RootOf(_Z^2 - y, index = real[2]) + 1, 1 < y, y < 2}:
area := {1 < y, y < x}:
Sol_area := solve(Sol union area, x);

{x = RootOf(_Z^2-y, index = real[2])+1}

Download QUESTI_2_acc.mw

I'm not sure what form you want for the final result, but here are two ways to get it as piecewise, and [edited] one way to get it as a single sequence of (in)equalities.

restart;

solve({a = 1/y, b = x/(x + y - 1), x = (y - 1)^2, 1 < y, y < 5/4}, {b,y,x});

piecewise(a <= 4/5, [], a < 1, [{b = 1-a, x = (a-1)^2/a^2, y = 1/a}], 1 <= a, [])

T := solve({a = 1/y, b = x/(x + y - 1)},[x,y]);

[[x = b*(a-1)/(a*(b-1)), y = 1/a]]

new := eval({x = (y - 1)^2, 1 < y, y < 5/4}, T[1]);

{b*(a-1)/(a*(b-1)) = (1/a-1)^2, 1 < 1/a, 1/a < 5/4}

solve(new,b);

piecewise(a <= 4/5, [], a < 1, [{b = 1-a}], 1 <= a, [])

solve(new,[a,b]);

[[a < 1, 4/5 < a, b = 1-a]]

Download QUESTI_1_ac.mw

nb. I do not have the last call as, say, just,
    solve(new)
or,
    solve(new, {a,b})
because while those happen to produce a desired result with requested inequalities for `a`, that happens by "luck" due to the lexicographic ordering of your variable names. Ie, `a` comes before `b`.  Compare,

solve(new,[a,b]);

[[a < 1, 4/5 < a, b = 1-a]]

solve(new,[b,a]);

[[b < 1/5, 0 < b, a = -b+1]]

I prefer it more robust against switching around the variable names, or using another pair of names.

The reason that solve returns NULL is that solving for the {r} variables only has a solution if a constraint is satisfied by some of the remaining names (say, the f[...] names).

restart;

t := add(a[j]*q^j, j = 0 .. 9):

H := diff(t, q):

F := diff(t, q $ 2):

p1 := simplify(eval(t, q = x)) = y[n]:
p2 := simplify(eval(F, q = x)) = f[n]:
p3 := simplify(eval(F, q = x + h/4)) = f[n + 1/4]:
p4 := simplify(eval(F, q = x + h/2)) = f[n + 1/2]:
p5 := simplify(eval(F, q = x + (3*h)/4)) = f[n + 3/4]:
p6 := simplify(eval(F, q = x + h)) = f[n + 1]:
p7 := simplify(eval(F, q = x + (5*h)/4)) = f[n + 5/4]:
p8 := simplify(eval(F, q = x + (3*h)/2)) = f[n + 3/2]:
p9 := simplify(eval(F, q = x + (7*h)/4)) = f[n + 7/4]:
p10 := simplify(eval(F, q = x + 2*h)) = f[n + 2]:

r := seq(a[i], i = 0 .. 9);

a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9]

s := p || (1 .. 10):

indets([s],name);

{h, x, a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], f[n], f[n+1], f[n+2], f[n+1/2], f[n+1/4], f[n+3/2], f[n+3/4], f[n+5/4], f[n+7/4], y[n]}

raw:=eliminate([s],[r]):

alt := collect(raw[1],
               [f[n],f[n+1],f[n+2],f[n+1/2],f[n+1/4],f[n+3/2],f[n+3/4],f[n+5/4],f[n+7/4]],
               u->simplify(factor(u))):

#print~(alt):

alt[7];  # one of the results

a[6] = (1/135)*(4*x+5*h)*(23*h^2+40*h*x+16*x^2)*f[n]/h^7-(2/45)*(2477*h^3+7740*h^2*x+7440*h*x^2+2240*x^3)*f[n+1]/h^7-(1/135)*(333*h^3+1180*h^2*x+1296*h*x^2+448*x^3)*f[n+2]/h^7-(4/135)*(627*h^3+1780*h^2*x+1584*h*x^2+448*x^3)*f[n+1/2]/h^7-(4/135)*(2003*h^3+6740*h^2*x+6960*h*x^2+2240*x^3)*f[n+3/2]/h^7+(64/135)*(139*h^3+415*h^2*x+384*h*x^2+112*x^3)*f[n+3/4]/h^7+(128/135)*(111*h^3+361*h^2*x+360*h*x^2+112*x^3)*f[n+5/4]/h^7+(64/45)*(x+h)*(13*h^2+32*h*x+16*x^2)*f[n+7/4]/h^7

raw[2]; # this must equal zero for raw[1] to hold;

{96*f[n]+6720*f[n+1]+96*f[n+2]+2688*f[n+1/2]+2688*f[n+3/2]-5376*f[n+3/4]-5376*f[n+5/4]-768*f[n+7/4]-768*f[n+1/4]}

content(raw[2][1]);

96

raw[2]/~%; # this must equal zero for raw[1] to hold;

{f[n]+70*f[n+1]+f[n+2]+28*f[n+1/2]+28*f[n+3/2]-56*f[n+3/4]-56*f[n+5/4]-8*f[n+7/4]-8*f[n+1/4]}

#solve([s],[r],parametric); # another way

 

 

Download abdulganiy_1.mw

Is this the effect you're after?

Q_DataFrame_ac.mw

(If it is, and it gives you a problem for some other example then let me know and I could robustify the subsop step).

ps. I think it might be nice to have an option for that in the Tabulate static export of the Dataframe object.

It seems to be due to a much older -- but apparently rarely occurring -- bug in plotttols:-getdata, on which I will submit a bug report.

In Maple 2024 Explore started to make use of plotttols:-getdata.

Fortunately for your example, it can be avoided by using the Explore option adaptview=false .

Planck_Curve_ac.mw

Is it the same if you add the documented option,

   subfunctions=true

to the simplify call.

That would make it also forget the remember table of `simplify/do`, etc.

Using subs on the generated XML, you can retain "conveniences" of having Tabulate as a command.

GenerateSimilar_Ala_ac.mw
 



Download GenerateSimilar_Ala_ac.mw

It would be nice if Tabulate would offer Cell/Textfield alignment as an option.

You wrote "list of points", but in your code you are instead using a set of lists/points, and not a list of lists/points.

Note the difference between,
   plot( [ [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] ], x=-3..4, y=-4..10, style=line)
and,
   plot( { [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] }, x=-3..4, y=-4..10, style=line)

That is because of the difference in the results of,
   [ [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] ]
versus,
   { [3, 6], [-1, 6], [-1, 1], [-1, -2], [3, -2] }

A set's elements are sorted (an automatic simplification).

I use Ctrl-t to change an Exec Group's execution prompt into a text prompt/mode.

4 5 6 7 8 9 10 Last Page 6 of 336