MaplePrimes Questions

Does anyone use the /= assignment operator?

I am trying to do a

while error  > error_tol do

sequence of ops,

# update error from last loop
# simple example of assignment test 

error /= 2;    #to simulate decreasing error each loop.  Real equation on RHS is error(i) = error(i-1) + comparison of last iterates.

# Real operator assignment I'd like to use is error += comparison

end do;

the divide / keeps applying as the single divide and a long line under the variable before I can type =.   This happens in both 1-D and 2-D.   The "Operator Assignments" help page doesn't have a lot of help on syntax problems using these. 

Thanks,
Bill

I am trying to find a fast method for integration of a function composed of several Heavisides. I used Quadrature-Romberg, but no success. What is the problem with it and what method do you recommend instead?

``

restart

``

A := Heaviside(zeta__2-.6429162216568)*Heaviside(eta__2+.5050000000000-10.98537767108*sqrt(492.5151416233-zeta__2^2))+Heaviside(zeta__2-.9999999999936)*Heaviside(eta__2+.9875792458758+3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.4637698986762+2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.4637698986762-2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.1619291800251+3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.1619291800251-3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.7243706106403+1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.7243706106403-1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2+.9875792458758-3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))-Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2+.9875792458758+3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))+Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2-.8341191288491-1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-1.000000000000)*Heaviside(eta__2-.8341191288491+1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-.9999999999796)*Heaviside(eta__2-.8341191288491-1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))-Heaviside(zeta__2-.5527964251744)*Heaviside(eta__2+.5050000000000-10.98537767108*sqrt(492.5151416233-zeta__2^2))+Heaviside(zeta__2-.5527964251744)*Heaviside(eta__2+.5050000000000+10.98537767108*sqrt(492.5151416233-zeta__2^2))+Heaviside(zeta__2-.7684252323012)*Heaviside(eta__2-.5050000000000-8.127372424924*sqrt(269.5813999936-zeta__2^2))-Heaviside(zeta__2-.6466146460206)*Heaviside(eta__2-.5050000000000-8.127372424924*sqrt(269.5813999936-zeta__2^2))-Heaviside(zeta__2-.7684252323012)*Heaviside(eta__2-.5050000000000+8.127372424924*sqrt(269.5813999936-zeta__2^2))+Heaviside(zeta__2-.6466146460206)*Heaviside(eta__2-.5050000000000+8.127372424924*sqrt(269.5813999936-zeta__2^2))-Heaviside(zeta__2-.9999999999936)*Heaviside(eta__2+.9875792458758-3.881485663812*10^9*sqrt(9.765625000000*10^22-zeta__2^2))+Heaviside(zeta__2-.9999999999796)*Heaviside(eta__2-.8341191288491+1.298592148442*10^10*sqrt(9.706617486471*10^21-zeta__2^2))+Heaviside(zeta__2+.9999999999972)*Heaviside(eta__2+.9842650870048-1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))-Heaviside(zeta__2+.9999999999972)*Heaviside(eta__2+.9842650870048+1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))+Heaviside(zeta__2+.9999999999990)*Heaviside(eta__2+.1619291800251-3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999990)*Heaviside(eta__2+.1619291800251+3.018371923484*10^11*sqrt(4.000000000000*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999988)*Heaviside(eta__2-.4637698986762-2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999988)*Heaviside(eta__2-.4637698986762+2.327456686822*10^11*sqrt(2.777777777778*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2+.7243706106403-1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2+.7243706106403+1.382194833711*10^11*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2-.9031048925918-8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+.9999999999984)*Heaviside(eta__2-.9031048925918+8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.9842650870048-1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2+.9842650870048+1.085166413462*10^10*sqrt(4.756242568371*10^23-zeta__2^2))-Heaviside(zeta__2-.6429162216568)*Heaviside(eta__2+.5050000000000+10.98537767108*sqrt(492.5151416233-zeta__2^2))-Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.9031048925918-8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2))+Heaviside(zeta__2+1.000000000000)*Heaviside(eta__2-.9031048925918+8.123652892875*10^10*sqrt(1.562500000000*10^24-zeta__2^2)):

plot3d(A, zeta__2 = -1 .. 1, eta__2 = -1 .. 1, color = green)

 

Digits := 22:

with(Student[NumericalAnalysis]):

Quadrature(Quadrature(A, zeta__2 = -1 .. 1, method = romberg[8]), eta__4 = -1 .. 1, method = romberg[8])

Float(undefined)*Heaviside(eta__2+1212964270000000000001.)+Float(undefined)*Heaviside(eta__2-1279401131003415700657.)-0.1513022270849353690226e-1*Heaviside(eta__2-133.8411610374164929382)+Float(undefined)*Heaviside(eta__2-7483906296259851792359.)+Float(undefined)*Heaviside(eta__2+7483906296259851792361.)+Float(undefined)*Heaviside(eta__2-0.1015456611625000000000e24)+Float(undefined)*Heaviside(eta__2+0.1015456611625000000000e24)+Float(undefined)*Heaviside(eta__2+0.3879094478488497112464e24)+Float(undefined)*Heaviside(eta__2+1279401131003415700655.)-0.4538512794872905686682e-1*Heaviside(eta__2-133.8360207224718595497)+0.4538512794872905686682e-1*Heaviside(eta__2+132.8260207224718595497)+0.4538512794872905686682e-1*Heaviside(eta__2+132.8042477794001150390)-0.4538512794872905686682e-1*Heaviside(eta__2-133.8253766167816064928)-0.4538512794872905686682e-1*Heaviside(eta__2-243.1883998382669648802)+0.1513022270849353690226e-1*Heaviside(eta__2+132.8311610374164929382)+Float(undefined)*Heaviside(eta__2-0.1727743542500000000000e24)-0.1513022270849353690226e-1*Heaviside(eta__2-243.2027260661341424950)+0.1513022270849353690226e-1*Heaviside(eta__2+244.2127260661341424950)+0.4538512794872905686682e-1*Heaviside(eta__2+244.1983998382669648802)-0.4538512794872905686682e-1*Heaviside(eta__2-243.1980716456433769010)+0.4538512794872905686682e-1*Heaviside(eta__2+244.2080716456433769010)+0.4538512794872905686682e-1*Heaviside(eta__2+132.8153766167816064928)+0.1513022270849353690226e-1*Heaviside(eta__2+132.8098727970154075001)+Float(undefined)*Heaviside(eta__2-0.3879094478488497112464e24)-0.4538512794872905686682e-1*Heaviside(eta__2-243.2072595071292620415)+Float(undefined)*Heaviside(eta__2+0.6036743846000000000000e24)+Float(undefined)*Heaviside(eta__2-0.6036743846000000000000e24)+Float(undefined)*Heaviside(eta__2+0.1727743542500000000000e24)-0.1916322521366165064753e-1*Heaviside(eta__2-133.8307592537082147847)+0.1916322521366165064753e-1*Heaviside(eta__2+132.8207592537082147847)-0.1916322521366165064753e-1*Heaviside(eta__2-243.2116719753798543789)+0.1916322521366165064753e-1*Heaviside(eta__2+244.2216719753798543789)-0.4538512794872905686682e-1*Heaviside(eta__2-133.8026340889186250133)+0.4538512794872905686682e-1*Heaviside(eta__2+132.7926340889186250133)-0.4538512794872905686682e-1*Heaviside(eta__2-133.8142477794001150390)-0.1513022270849353690226e-1*Heaviside(eta__2-133.8198727970154075001)+0.4538512794872905686682e-1*Heaviside(eta__2+244.2172595071292620415)-0.1903631769101229216919e-1*Heaviside(eta__2-133.8085015485931455736)+0.1903631769101229216919e-1*Heaviside(eta__2+132.7985015485931455736)+0.1903531841918040745676e-1*Heaviside(eta__2+244.2032962387251632874)-0.1903531841918040745676e-1*Heaviside(eta__2-243.1932962387251632874)+Float(undefined)*Heaviside(eta__2-1212964269999999999999.)

(1)

int(int(A, zeta__2 = -1 .. 1), eta__2 = -1 .. 1)

.4238607655960000000000

(2)

``

Download romberg.mw

I am trying to solce eq (2) by integration. But maple integrate only 1st term in eq. Why not other two terms? 

 

Solve_integral.mw

and I try to fix my file use this method: https://www.mapleprimes.com/questions/129377-There-Were-Problems-During-The-Loading?reply=reply , but an error occurred as follows .

And my code is:

restart;

DeleteBadCharacters := proc(file :: string)
local base, badchar, char, cnt, msg, outfile, str, unicode;
    str := FileTools:-Text:-ReadFile(file);
    for cnt from 0 do
        try
            XMLTools:-ParseString(str);
            break;
        catch "An invalid XML character":
            msg := lastexception[2];
            if not StringTools:-RegMatch("Unicode: 0x([^)]+)", msg, 'all', 'unicode') then
                error;
            end if;
            unicode := sscanf(unicode,"%x");
            char := convert(unicode,'bytes');
            badchar[cnt+1] := char;
            str := StringTools:-SubstituteAll(str, char, "");
        end try;
    end do;

    if cnt=0 then
        printf("no errors in file\n");
    else
        if not StringTools:-RegMatch("^(.*)\\.mw$", file, 'all', 'base') then
            error "problem extracting basename";
        end if;
        printf("deleted bad characters: %A\n", {seq(badchar[cnt],cnt=1..cnt)});
        outfile := sprintf("%s-fixed.mw", base);
        FileTools:-Text:-WriteString(outfile, str);
        fclose(outfile);
        printf("wrote updated file to %s\n", outfile);
    end if;
    return NULL;
end proc:
NULL;
NULL;
DeleteBadCharacters( "E:/EchoModel_V3.mw" );

And the error is

"Error, (in XMLTools:-ParseString) XML document structures must start and end within the same entity."

I use maple 2021.  Thank you very much!

I can not find my Kamke book right now. But according to Maple help, Homogeneous ODE of Class C is the following

If I understand the above, it is saying that the RHS of the ode should be ratio of two polynomials, and both should be linear in y and x. Correct?

Given the above, then why Maple says the following ode is _homogeneous, `class C` ? Since the RHS is not linear in y and not linear in x:

restart;
ode:=diff(y(x),x)=(2*y(x)-1)*(4*y(x)+6*x-3)/(y(x)+3*x-1)^2;
ode:=lhs(ode)=expand(numer(rhs(ode)))/expand(denom(rhs(ode)))

DEtools:-odeadvisor(ode)

           [[_homogeneous, `class C`], _rational]

What Am I overlooking/misunderstanding  from reading this definition? 

The system does not correctly calculate the CDF of a Binomial using the Regularized Incomplete Beta for p=0.5.

 

Ícono de validado por la comunidad

restart;
n := 10;
f := x -> int(t^(n - x - 1)*(1 - t)^x, t = 0 .. 1 - p)/Beta(n - x, x + 1);
p := 0.5;
plot(f(x), x = 0 .. 10);

gaussian.m.mw

This is the maple worksheet

 

It's showing an error. It's showing an error with its conditions. What to do? How can I solve it? Got stuck here on this issue?Unable to solve this problem. Please help me. This the maple worksheet:

6coupled.m.mw

 

I have a function that refuses to allow "fsolve" to compute a root for.  I'm trying to use a brute force Newton (or secant) algorithm to find the root.  This is successful 

But I'm new enough in Maple Flow (and Maple) that I can't build an automatic recursion method.  All ideas welcome.

EqBIS := proc(P, U, V)
local a, eq1, M1, t, PU, PV, bissec1;
a := (P - U)/LinearAlgebra:-Norm(P - U, 2) + (P - V)/LinearAlgebra:-Norm(P - V, 2);
M1 := P + a*t;
eq1 := op(eliminate({x = M1[1], y = M1[2]}, t));
RETURN(op(eq1[2])); end proc;
EqBIS*([4, 5], [11, 7/3], [11, 5]);
why such a procedure gives no result Thabk you.

 

Trying to use the jets package from http://jets.math.slu.cz/ (file jets.s) for calculus of variations.

Test example -

coordinates([x,y],[f],3);
parameter(p);
g:=(f_x)^2+(f_y)^2-2*p*f;
vg:=variation(g,f);                  # first variation of g (from line 4354 of jets.s)

Now I want to find g from vg - inverse problem. The code for this starts on line 4367 of jets.s, command is lagrangian.

Tried -

Lg:=lagrangian(vg,f);
Lg:=lagrangian([vg,f]);
Lg:=lagrangian(vg,[f]);
Lg:=lagrangian(f=vg);

but all give syntax errors.

The authors of the package don't respond to query and the manual does't help.

Does anyone know what the correct syntax of lagrangian is. Or is there a better package to use for inverse problem.

Thank you.

I am doing some error I dont know where in the usage

T := [[1, 2], [3, 4]];
convert(T, set, nested);

{[1, 2], [3, 4]}

But I expected internal lists also to be converted to sets like {{1,2},{3,4}}  my list may be a big list just taken a example

This a simple question I know i tried somewhere i am going wrong please help

what i am trying to do is 

n:=8;

k:=2;

C:=choose(n,k);
convert(C,set,nested);
not making all nested all as set as mentioned in the simple example.

some simple program and fast kind help

I'm trying to figure out how to represent 100 people where each one has a 30% probablity of getting sick.

I think sample can be used but not I'm exactly sure how to achieve that. Basically how many people are sick?

The computer on which I have been executing Maple worksheets for the past six years (CPU: i7 - 5820K, 6 core, 3.3 GHz, 5th generation) is now significantly slower than new machines.

I don't know how to interpret public specifications of potential replacement machines into their actual future performance with Maple.

Please give me or direct me to any advice which would enable me to knowledgeably purchase a much faster processor of Maple code.

 

Hello there, 

Is there any chance to see that the 'eq_5_22_desired' expression shown below can be derived from a collection of the commands. similar to what's given in the 'eq_5_22a'? In other words, is it possible to make Maple aware of the point that 'L__ad/(L__ad + L__fd)' can be interpreted as 'L__ad*L__fd/(L__ad + L__fd) * 1/L__fd'?

restart;

with(LinearAlgebra):

interface(imaginaryunit=j):

eq_5_22 := Psi__ad = -L__ad*L__fd*i__d*1/(L__ad + L__fd) + L__ad*Psi__fd*1/(L__ad + L__fd);

Psi__ad = -L__ad*L__fd*i__d/(L__ad+L__fd)+L__ad*Psi__fd/(L__ad+L__fd)

(1)

eq_5_23x := L__ad__p = 1 / (1/L__ad + 1/L__fd);

L__ad__p = 1/(1/L__ad+1/L__fd)

(2)

eq_5_23 := L__ad__p = evala(rhs(eq_5_23x));

L__ad__p = L__ad*L__fd/(L__ad+L__fd)

(3)

eq_5_22a := Psi__ad = collect(expand(solve(eq_5_18x, Psi__ad)), rhs(eq_5_23)); # error

Error, invalid input: expand expects 1 argument, but received 0

 

eq_5_22_desired := Psi__ad = -L__ad__p*i__d + L__ad__p*Psi__fd/L__fd;

Psi__ad = -L__ad__p*i__d+L__ad__p*Psi__fd/L__fd

(4)

 

Download Q20220812.mw

First 168 169 170 171 172 173 174 Last Page 170 of 2308