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 have loaded the VectorCalculus package, which has its own way of displaying Vectors.

If you want to have that package be loaded, but display Vectors in their "usual" (non-VectorCalculus) fashon then you could turn them into "usual" Vectors by using the global :-Vector command. There are also other ways to do what I've done below.

If this is not what you want them could you please explain it in more detail? Thanks.

 

 

restart

with(VectorCalculus)

NULL

V_D2 := `<,>`(-8, -5, 4); V_D3 := `<,>`(-8, 5, 4); V_S2 := `<,>`(6, 0, 5)

Vector(3, {(1) = -8, (2) = -5, (3) = 4})

Vector(3, {(1) = -8, (2) = 5, (3) = 4})

Vector(3, {(1) = 6, (2) = 0, (3) = 5})

:-Vector(V_D2), :-Vector(V_D3), :-Vector(V_S2)

Vector[column](%id = 36893627834423408268), Vector[column](%id = 36893627834423408388), Vector[column](%id = 36893627834423408508)

`<|>`(V_D2, V_D3, V_S2)

Matrix(%id = 36893627834423405012)

`<|>`(V_D2, V_D3, V_S2)^%T

Matrix(%id = 36893627834423400676)

`<,>`(:-Vector[row](V_D2), :-Vector[row](V_D3), :-Vector[row](V_S2))

Matrix(%id = 36893627834423391284)

NULL

Download question_vector_ac.mw

Alternatively, you might not load the VectorCalculus package, and just use individual commands from it to get your Vector-plots, etc.

Your 2D Input call to solve had the following in the second set, even though it appeared to be just A[0] ,

  `__ `*A[0]

If I delete it and retype it as just A[0] then it works fine.

I don't know how you managed to get it entered that way.

NULL

restart

eq0 := -4*alpha*k^2*m^2*n^2*A[0]^2+4*beta*k*m*n^2*A[0]^3-4*gamma*k*m*n^2*A[0]^3+4*delta^2*m*n^2*A[0]^2-4*n^2*sigma*A[0]^4-4*m*n^2*w*A[0]^2 = 0

eq1 := -8*alpha*k^2*m^2*n^2*A[0]*A[1]+12*beta*k*m*n^2*A[0]^2*A[1]-12*gamma*k*m*n^2*A[0]^2*A[1]+8*delta^2*m*n^2*A[0]*A[1]-16*n^2*sigma*A[0]^3*A[1]+2*a*alpha*m*n*A[0]*A[1]-8*m*n^2*w*A[0]*A[1] = 0

eq2 := -4*alpha*k^2*m^2*n^2*A[1]^2+12*beta*k*m*n^2*A[0]*A[1]^2-12*gamma*k*m*n^2*A[0]*A[1]^2+4*delta^2*m*n^2*A[1]^2-24*n^2*sigma*A[0]^2*A[1]^2+a*alpha*m^2*A[1]^2+3*alpha*b*m*n*A[0]*A[1]-4*m*n^2*w*A[1]^2 = 0

eq3 := 4*beta*k*m*n^2*A[1]^3-4*gamma*k*m*n^2*A[1]^3-16*n^2*sigma*A[0]*A[1]^3+alpha*b*m^2*A[1]^2+alpha*b*m*n*A[1]^2+4*alpha*c*m*n*A[0]*A[1] = 0

eq4 := -4*n^2*sigma*A[1]^4+alpha*c*m^2*A[1]^2+2*alpha*c*m*n*A[1]^2 = 0

C := solve({eq0, eq1, eq2, eq3, eq4}, {a, b, c, A[0]})

{a = 4*n^2*(alpha*k^2*m-delta^2+w)/(m*alpha), b = 4*(gamma-beta)*k*n^2*A[1]/((m+n)*alpha), c = 4*n^2*sigma*A[1]^2/(alpha*m*(m+2*n)), A[0] = 0}

NULL

NULL

Download problem_4_ac.mw

You can do it in 2D Input, just not by using the -> keystrokes.


We can in fact enter the procedure f in 2D Input and avoid the
warning message and declare the variable as local.

But it take more typing to do that in 2D Input than in 1D plaintext code.

We can do it in two ways in 2D Input. The second, which prints the
procedure as an "arrow" operator, is longer to type in.

f := proc (x) local j; seq(x, j = 1 .. 5) end proc

proc (x) local j; seq(x, j = 1 .. 5) end proc

f := proc (x) local j; options operator, arrow; seq(x, j = 1 .. 5) end proc

proc (x) local j; options operator, arrow; seq(x, j = 1 .. 5) end proc


It's unfortunate that the above printing of the procedure doesn't
show the local declaration.

(That makes that documentation webpage less clear and helpful.
I will submit a bug report.)

showstat(f)


f := proc(x)
local j;
   1   seq(x,j = 1 .. 5)
end proc
 

Download local_proc.mw

This isn't very significantly different in nature from your earlier Question from Dec 9.

Since the Maple commands which deal with external files accept strings to denote the file name, these can be viewed as queries about programmatic string construction. The following code is more about the construction of the string than it is about the save command.

You can use cat, but sprintf (modeled after that in C/C++) is more flexible.

restart;

Variable := 10;

10

fname := sprintf("Result(%a).txt", Variable);

"Result(10).txt"

M := 4;

4

save M, fname;

 

restart;

read "Result(10).txt";

4

Download sprintf_again.mw

Naturally, if you intend on doing this repeatedly and in a repeating pattern then you could also make a (possibly even 1-liner) re-usable procedure/operator which makes that usage terser.

By default the imaginary unit is captical I in Maple. You can change this to lowercase i with the interface command.

Also, some of the problem inputs had a semicolon terminator before the context-action, resulting in double output.

Also, you don't need to apply the factor command. These products expand and evaluate automatically.

NULLComplex Numbers

interface(imaginaryunit = I)

 

Key Skills 11-48

NULLc11 := 2-3*I+(6+8*I)"(=)"8+5*I

c12 := 4+5*I-8+2*I"(=)"-4+7*I

c13 := -7+2*I+4*I"(=)"-7+6*I

c14 := 3-4*I+(3+4*I) = 6NULL

c15 := -6-5*I-6*I"(=)"-6-11*I

c16 := -10+4*I+2*I"(=)"-10+6*I

c17 := 3*(2-6*I) =

6-18*I

c18 := -4*(2+8*I) =

-8-32*I

NULL

c19 := (2*I)*(2-3*I) =

6+4*I

c20 := (3*I)*(-3+4*I) = -12-9*INULL

c21 := (2+I)*(3-4*I) = 10-5*INULL

c22 := (2-I)*(5+3*I) = 13+INULL

``

 

NULL

Download 1.3-Complex_Numbers_bad_ac.mw

You could read the .m file, before your call to with.

restart

TEST := module () local sumpro; export sumvip; option package;  sumpro := proc (a, b, c) local sumex; sumex := a+b+c; printf("sum of %A , %A and %A is %A", a, b, c, sumex) end proc; sumvip := proc () sumpro(args) end proc end module

save TEST, "TEST.m"


And now we restart...

restart

read "TEST.m"

with(TEST)

[sumvip]

sumvip(2, 3, 4)

sum of 2 , 3 and 4 is 9

NULL

Download TEST_ac.mw

Alternatively you could LibraryTools:-Save the module to a .mla archive (in stead of save to .m file), and have that be in a libname location.

You could use Norm instead of abs. That is, you could use the double vertical bars, rather than the single vartical bars, in 2D Input.

Or you could use the Normalize command.

I also added evalf; It doesn't seem so useful to get Numeric Formatting to show all rationals as floats.

restart;

with(VectorCalculus):

f:=(l, theta)->[ l*sin( convert(theta*degrees, radians)),
                 l*cos( convert(theta*degrees, radians))
               ]:
V1:= <-20,2,5>:
V2:= <14,7,-10>:
V3:= <-10,5,20>:
V4:= <4,30,-10>:
V5:=V1+V2+V3+V4;
            

Vector(3, {(1) = -12, (2) = 44, (3) = 5})

evalf(V5/LinearAlgebra[Norm](V5)); evalf(Normalize(V5))

Vector(3, {(1) = -.2615502840, (2) = .9590177083, (3) = .1089792850})

Vector[column](%id = 36893628718476985036)

Download 3d_vector_ac.mw

@salim-barzani You didn't answer what currentdir() returns, and you didn't say specifically what you else had tried. It's more difficult to help when you don't provide the concrete details.

If you're going to use currentdir() then you don't need to concatenate. The purpose of that command is to set the default location.

You might try this, since it you may be able to write to your own User directory.
1) At the start of your code, issue,
   currentdir(kernelopts(':-homedir')):
2) Then you could do the export like,
   ExportMatrix("ST2.txt",...)
data-analysis_ac.mw

nb. When you call currentdir its return value is the previous value (not what you pass as argument). This might have confused you about what you'd set it to.

Alternatively, you could use cat to build up an explicit, fully qualified filename with path, and pass that to the exporting command. In that case you wouldn't need currentdir at all.

If you have problems then you could show us exactly what string was being passed.

Your "test relation" context-panel action is not using your assumptions.

That context-panel action actually consists of a call to the is command, (right-click in left border and Show Command of Document Block, to see).

If such a call is made under your assumptions then is returns true instead of false.

restart

eq1 := (S__0^2*K__2-K__2*S^2+2*S__0*K__1-2*K__1*S+2*ln(S__0)-2*ln(S))/(2*V__max)

eq2 := (ln(S__0/S)+K__1*(S__0-S)+(1/2)*(-S^2+S__0^2)*K__2)/V__max

is(eq1-eq2 = 0)

false

`assuming`([is(eq1-eq2 = 0)], [S > 0, S__0 > S])

true

`assuming`([int(1/(V__max*S)+K__1/V__max+K__2*S/V__max, S = S .. S__0)], [S > 0, S__0 > S])

(1/2)*(S__0^2*K__2-K__2*S^2+2*S__0*K__1-2*K__1*S+2*ln(S__0)-2*ln(S))/V__max

`assuming`([combine(%)], [S > 0, S__0 > S])

(1/2)*(ln(S__0^2/S^2)+S__0^2*K__2-K__2*S^2+2*S__0*K__1-2*K__1*S)/V__max

NULL

Download mapleintvsmanualint_ac.mw

The following is smaller.

But it does a different collect than you had. It's not just a repair involving the coefficients of your form. (You did not answer my query about whether you needed that particular B[1],B[2] collect, or whether you just wanted something smaller.)

restart

eq3 := -6*lambda*beta[0]^2*alpha[1]^2*a[3]-2*lambda*beta[0]^2*a[5]*alpha[0]+6*mu*beta[0]*alpha[1]^2*a[2]+3*mu*beta[0]*a[5]*alpha[0]^2+(10*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*alpha[1]^2*alpha[0]^3*a[4]+(6*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*alpha[1]^2*alpha[0]^2*a[3]+(4*(-(2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*lambda+4*mu^2))*alpha[1]^2*a[5]*alpha[0]-12*mu^2*alpha[1]^2*a[5]*alpha[0]+(3*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*alpha[1]^2*alpha[0]*a[2]-(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*k^2*a[1]*alpha[1]^2+(1/2)*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*lambda*a[1]+(5*(-(2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*lambda+4*mu^2))*alpha[1]^4*alpha[0]*a[4]+6*beta[0]^2*alpha[0]^2*a[3]-(1/4)*lambda*beta[0]^2*a[1]-k^2*a[1]*beta[0]^2+(1/4)*(3*(-(2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*lambda+4*mu^2))*alpha[1]^2*a[1]+3*beta[0]^2*alpha[0]*a[2]-(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*w*alpha[1]^2-9*mu^2*alpha[1]^2*a[1]*(1/4)+3*mu*a[1]*alpha[0]*beta[0]*(1/2)+10*beta[0]^2*alpha[0]^3*a[4]+(-(2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*lambda+4*mu^2)*alpha[1]^4*a[3]-w*beta[0]^2+(4*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda))*alpha[1]^2*lambda*a[5]*alpha[0]-30*lambda*beta[0]^2*alpha[1]^2*alpha[0]*a[4]-20*mu*beta[0]*lambda*alpha[1]^4*a[4]-7*mu*beta[0]*lambda*a[5]*alpha[1]^2+24*mu*beta[0]*alpha[1]^2*alpha[0]*a[3]+60*mu*beta[0]*alpha[1]^2*alpha[0]^2*a[4] = 0

-w*beta[0]^2+3*mu*beta[0]*a[5]*alpha[0]^2-6*lambda*beta[0]^2*alpha[1]^2*a[3]-2*lambda*beta[0]^2*a[5]*alpha[0]+6*mu*beta[0]*alpha[1]^2*a[2]+(1/2)*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*lambda*a[1]+5*(-2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*lambda+4*mu^2)*alpha[1]^4*alpha[0]*a[4]+10*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*alpha[0]^3*a[4]+6*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*alpha[0]^2*a[3]+(3/2)*mu*a[1]*alpha[0]*beta[0]+4*(-2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*lambda+4*mu^2)*alpha[1]^2*a[5]*alpha[0]-12*mu^2*alpha[1]^2*a[5]*alpha[0]+3*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*alpha[0]*a[2]-(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*k^2*a[1]*alpha[1]^2+10*beta[0]^2*alpha[0]^3*a[4]-k^2*a[1]*beta[0]^2+3*beta[0]^2*alpha[0]*a[2]-(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*w*alpha[1]^2+6*beta[0]^2*alpha[0]^2*a[3]-(9/4)*mu^2*alpha[1]^2*a[1]+(3/4)*(-2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*lambda+4*mu^2)*alpha[1]^2*a[1]-(1/4)*lambda*beta[0]^2*a[1]-20*mu*beta[0]*lambda*alpha[1]^4*a[4]+4*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*alpha[1]^2*lambda*a[5]*alpha[0]-30*lambda*beta[0]^2*alpha[1]^2*alpha[0]*a[4]+24*mu*beta[0]*alpha[1]^2*alpha[0]*a[3]-7*mu*beta[0]*lambda*a[5]*alpha[1]^2+(-2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)*lambda+4*mu^2)*alpha[1]^4*a[3]+60*mu*beta[0]*alpha[1]^2*alpha[0]^2*a[4] = 0

(1)

algsubs(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda=QQ,eq3):
collect(%, [QQ, mu, beta[0]],
        u->simplify(factor(u),size)):
new := subs(QQ=lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda, %);
 

-(-10*a[4]*alpha[0]^3-6*a[3]*alpha[0]^2+((10*a[4]*alpha[1]^2+4*a[5])*lambda-3*a[2])*alpha[0]+(2*a[3]*alpha[1]^2+a[1])*lambda+k^2*a[1]+w)*alpha[1]^2*(lambda*B[1]^2-lambda*B[2]^2-mu^2/lambda)+(4*(5*a[4]*alpha[0]+a[3])*alpha[1]^4+(1/4)*(16*a[5]*alpha[0]+3*a[1])*alpha[1]^2)*mu^2+(-20*lambda*a[4]*alpha[1]^4+(60*a[4]*alpha[0]^2-7*lambda*a[5]+24*a[3]*alpha[0]+6*a[2])*alpha[1]^2+3*a[5]*alpha[0]^2+(3/2)*a[1]*alpha[0])*beta[0]*mu+(10*a[4]*alpha[0]^3+6*a[3]*alpha[0]^2+(2*(-15*a[4]*alpha[1]^2-a[5])*lambda+3*a[2])*alpha[0]+(1/4)*(-24*a[3]*alpha[1]^2-a[1])*lambda-k^2*a[1]-w)*beta[0]^2 = 0

(2)
 

 

Download coment_acc.mw

There are few adjustments of numeric coeffcients also possible, but it can get tricky since not only might one need to sidestep automatic simplification (using inert %* and content, say) but one might also group only some summands in some subterms.

ps. collecting my intermediate expression wrt [QQ,mu,beta[0],w,lambda] also looks reasonably tidy.

What happens if you enter it like Pi*x*I  , with a capital I?

I understand that a complex number can be entered like 1+2i (no space) in Maple Flow. But -- in contrast to that -- if 1+2*i gets interpreted with `i` as just an unknown name then perhaps one cannot use x*i with lowercase i and symbol x. Just a guess.

You can adjust the numpoints option as you want. This gives even distance between delta2 values.

The interface(rtablesize) but is just so that you can visualize the whole Matrix in Maple.

restart:
interface(rtablesize=100):
h:=z->1-(delta2/2)*(1 + cos(2*(Pi/L1)*(z - d1 - L1))):
K1:=((4/h(z)^4)-(sin(alpha)/F)-h(z)^2+Nb*h(z)^4):
lambda:=Int(K1,z=0..1):
L1:=0.2: F:=10: d1:=0.2: alpha:=Pi/6:
P:=plot( [seq(eval(lambda, Nb=j), j in [0.1,0.2,0.3])],
           delta2=0.02..0.1,
           adaptive=false, numpoints=20);
T:=map[2](op,3,[plottools:-getdata(P)]):
M:=< T[1] | T[2][..,2] | T[3][..,2] >;
ExcelTools:-Export(M, "imparter.xls");

The DE dependent functions are psi(y) and theta(y), but your code tries to extract a value for u(y), which is not even in the system.

Your exact expression contains parameter names Br1, m1, k1, x1 but your code tries to substitute values instead for names Br, m, k, x.

If your analytic solution is supposed to represent diff(psi(y),y) then use that instead of the uneval-quoted 'u(y)' in the eval calls in your printf loop. (You should try and learn -- and remember -- what effect such quoting has.)

Abs_Error_help_acc.mw

The GUI's mechanism for rendering of "usual" animations has the behaviour that only a single instance of each "global" plot feature gets used.

By "global" I mean the kinds of plot feature that is common when one merges plots. For example the axis tickmarks, or the orientation, or the total view, or (in your case) the background image, etc. Those aspects become common/uniquified in every frame, when handled by the GUI's usual animation rendering mechanism.

So, you can't do a usual animation where the view changes with each frame. And you can't do one in which the background image changes with each frame. And (wisely or not) the Statistics:-HeatMap command uses a background image to get nice sharp edges on its rectangles, while reducing the use of GUI resources by avoiding a structure with many rectangles as POLYGONs.

You can, however, show such separate plots by sequentially sending them individually to an embedded PlotComponent. One easy way to get such an effect is to use the Explore command.

Why_cant_I_animate_still_images_like_this_ac.mw

You can experiment with frame duplicates, of floor/ceil/trunc of variable `i`, etc, to alter the frame-rate. Or you could Explore a call to a custom short procedure that did a Threads:-Sleep call before returning a frame.

Naturally, for a construction as quick as your HeatMap you might even Explore direct calls to it (on the fly, not precomputed).

ps. It's not clear how/whether you wanted your go2 procedure to utilize its parameter.

Here is an example that uses Optimization:-Maximize, as well as a 3D plot.

FindingExtractingvaluesdsolvewithspecificconditions_ac.mw

First 10 11 12 13 14 15 16 Last Page 12 of 336