acer

32333 Reputation

29 Badges

19 years, 319 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by acer

@mary120 You could use options such as,

  legend=typeset(n__0p/n__0n=0.1), legendstyle=[font=[Helvetica,10]]

where you adjust the font name as size as desired. Note that I used a double-underscore to get the subscripting.

@faizfrhn Please don't submit the question more than once.

You've incorrectly used square-brackets [...] instead of round-brackets (...) as delimiters in your expression for eq3.

Also, did you mean Pi/4 instead of 90? Maple's trig sommands work with radians.

Also, in the term sin(((beta + 90 + delta) - beta) + phi)) there is a +beta added to a -beta. Is that intentional, or did you mean something else?

 

[edited] Put your followup questions as Comments here, instead of in a separate Question thread.

Here is something more programmatic (ie. hopefully more systematic and less ad hoc). I'm trying to keep in mind the OP's mention of pulling out the H (akin to factoring in some sense).

I expect there is room for improvement. I tried to make it not expand terms. I didn't stress-test it.

The main idea is to not have to determine visually (and specifiy manually) which multiplicative term to adjust, or by what power of H.

At the end, for fun, it's also used to pull out other "factors".

restart;

eq := W__1 + W__2 = -sin(-beta + alpha)*((H^2 - h^2)*gamma
                    + h^2*psi)/(2*sin(beta)*sin(alpha));

W__1+W__2 = -(1/2)*sin(-beta+alpha)*((H^2-h^2)*gamma+h^2*psi)/(sin(beta)*sin(alpha))

targ := W__1 + W__2 = -H^2*sin(-beta + alpha)*((1 - h^2/H^2)*gamma
                    + h^2*psi/H^2)/(2*sin(beta)*sin(alpha));
 

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

F := proc(ee::`*`,T::name)
  local a,c,count,d,o,p,P,q;
  (a,o) := selectremove(type,[op(ee)],
                    And(`+`,polynom(anything,T),
                        satisfies(p->degree(p,T)>0)));
  count:=0; P:=1;
  if nops(a)>0 then
    for p in a do
      d := degree(p,T); count := count+d;
      (c,q) := selectremove(type,[op(p)],`*`);
      P := P*`+`(op(map(`/`,q,T^d)),map(u->F(u,T)/T^d,c)[]);
    end do;
  end if;
  `*`(P,T^count,op(o));
end proc:

 

answer := lhs(eq) = F(rhs(eq), H);

W__1+W__2 = -(1/2)*H^2*sin(-beta+alpha)*((1-h^2/H^2)*gamma+h^2*psi/H^2)/(sin(beta)*sin(alpha))

evalb(simplify(answer-eq)), evalb(answer=targ);

true, true

# for fun...
lhs(eq) = F(rhs(eq), h); evalb(simplify(%-eq));
lhs(eq) = F(rhs(eq), gamma); evalb(simplify(%-eq));
lhs(eq) = F(rhs(eq), psi); evalb(simplify(%-eq));

W__1+W__2 = -(1/2)*((H^2/h^2-1)*gamma+psi)*h^2*sin(-beta+alpha)/(sin(beta)*sin(alpha))

true

W__1+W__2 = -(1/2)*(H^2-h^2+h^2*psi/gamma)*gamma*sin(-beta+alpha)/(sin(beta)*sin(alpha))

true

W__1+W__2 = -(1/2)*((H^2-h^2)*gamma/psi+h^2)*psi*sin(-beta+alpha)/(sin(beta)*sin(alpha))

true

 

Download manipulation.mw

 

@nguyenhuyenag I never claimed that it would work for every other problem you concocted. That's why I wrote particular in italics.

If you are trying to ask something else, something more general, then ask it clearly.

In a related way that happens to work quickly for this particular example (but without reliance on identify),

restart;

L := {m[4]+4*m[7]+m[10]+m[13]+m[16]+m[19]+m[22] = 2*sqrt(2)+7,
 m[15]+3*m[18]+11*m[21]+m[6]+9*m[12]+2*m[3]-2*sqrt(2)*m[18]+6*sqrt(2)*m[21]
 -4*sqrt(2)*m[12]+m[24] = 2*sqrt(2)+61, -4*sqrt(2)*m[14]+6*m[14]+m[17]
 +11*m[20]+m[2]+4*m[5]+18*m[8]+6*sqrt(2)*m[20]-8*sqrt(2)*m[8]+m[23]
 = 2*sqrt(2)+34, m[27]-2*sqrt(2)*m[19]+4*sqrt(2)*m[7]+2*sqrt(2)*m[13]
 -2*m[16]+m[17]-6*m[19]-4*m[4]+m[5]+m[20]-16*m[7]+4*m[8]+m[11]-4*m[13]
 +m[14] = 6*sqrt(2)-6, m[28]+2*sqrt(2)*m[19]-4*sqrt(2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*sqrt(2)*m[11]+2*sqrt(2)*m[15]+2*sqrt(2)*m[16]
 -12*sqrt(2)*m[19]-2*sqrt(2)*m[13]+2*sqrt(2)*m[20]-2*sqrt(2)*m[21]
 = 12*sqrt(2)-120}:

S:=Optimization:-LPSolve(1,L,map(u->u=0..infinity,
                                 indets(L,And(name,Not(constant))))[])[2]:

C2:=solve(eval(L,lhs~(select(type,S,name=0.0))=~0))
    union (lhs~(select(type,{S[]},name=0.0))=~0);

{m[1] = 0, m[2] = 0, m[3] = (261/7)*2^(1/2)-309/7, m[4] = 0, m[5] = 0, m[6] = 0, m[7] = 219/98-(61/49)*2^(1/2), m[8] = -22/7+(23/7)*2^(1/2), m[9] = -(51/14)*2^(1/2)+114/7, m[10] = -95/49+(342/49)*2^(1/2), m[11] = 0, m[12] = -(8/7)*2^(1/2)+109/7, m[13] = 0, m[14] = 0, m[15] = 0, m[16] = 0, m[17] = 0, m[18] = 0, m[19] = 0, m[20] = 366/7-36*2^(1/2), m[21] = 0, m[22] = 0, m[23] = 0, m[24] = 0, m[25] = 0, m[26] = 0, m[27] = 0, m[28] = 0, m[29] = 0, m[30] = 0, m[31] = 0}

normal(eval(map(lhs-rhs,L),C2));

{0}

 

Download LPSolve_ex2e.mw

@abdulganiy There are many more ways than this. Here are a few of them.

restart;
plot(ln(1+sin(Pi*x)), x = 0 .. 1, legend = numerical,
     style = point, symbol = box, color = blue,
     symbolsize = 15, numpoints = 8, adaptive=false);

restart;
f:=unapply(ln(1+sin(Pi*x)),x):
V:=Vector(8,i->0+(i-1)*(1-0)/(8-1)):
plot(<V|f~(V)>, legend = numerical, symbolsize = 15,
     style = point, symbol = box, color = blue);

restart;
f:=unapply(ln(1+sin(Pi*x)),x):
N,a,b := 8,0,1:
V:=Vector(N,i->a+(i-1)*(b-a)/(N-1)):
plot(<V|f~(V)>, legend = numerical, symbolsize = 15,
     style = point, symbol = box, color = blue);

restart;
f:=unapply(ln(1+sin(Pi*x)),x):
V:=<[seq(0..1,(1-0)/(8-1))]>:
plot(<V|f~(V)>, legend = numerical, symbolsize = 15,
     style = point, symbol = box, color = blue);

restart;
N,a,b := 8,0,1:
f:=unapply(ln(1+sin(Pi*x)),x):
V:=<[seq(a..b,(b-a)/(N-1))]>:
plots:-pointplot(<V|f~(V)>, legend = numerical, symbolsize = 15,
                 symbol = box, color = blue);

 

Download ptplot_misc.mw

 

@nguyenhuyenag 

restart;

L := {m[4]+4*m[7]+m[10]+m[13]+m[16]+m[19]+m[22] = 2*sqrt(2)+7,
 m[15]+3*m[18]+11*m[21]+m[6]+9*m[12]+2*m[3]-2*sqrt(2)*m[18]+6*sqrt(2)*m[21]
 -4*sqrt(2)*m[12]+m[24] = 2*sqrt(2)+61, -4*sqrt(2)*m[14]+6*m[14]+m[17]
 +11*m[20]+m[2]+4*m[5]+18*m[8]+6*sqrt(2)*m[20]-8*sqrt(2)*m[8]+m[23]
 = 2*sqrt(2)+34, m[27]-2*sqrt(2)*m[19]+4*sqrt(2)*m[7]+2*sqrt(2)*m[13]
 -2*m[16]+m[17]-6*m[19]-4*m[4]+m[5]+m[20]-16*m[7]+4*m[8]+m[11]-4*m[13]
 +m[14] = 6*sqrt(2)-6, m[28]+2*sqrt(2)*m[19]-4*sqrt(2)*m[10]-2*sqrt(2)*m[16]
 +m[15]+2*m[16]+m[18]+2*m[4]+m[6]+6*m[19]+m[21]+4*m[9]+2*m[10]+m[12]-2*m[13]
  = 6*sqrt(2)+21, m[25]+6*sqrt(2)*m[19]-2*sqrt(2)*m[20]-8*sqrt(2)*m[7]
 +4*sqrt(2)*m[8]-4*sqrt(2)*m[13]+2*sqrt(2)*m[14]+6*m[13]-4*m[14]+m[16]
 -2*m[17]+m[1]+4*m[4]+11*m[19]-6*m[20]-4*m[5]+18*m[7]-16*m[8] = 6*sqrt(2)-33,
 m[26]+6*sqrt(2)*m[19]+2*sqrt(2)*m[21]-4*sqrt(2)*m[10]-4*sqrt(2)*m[12]
 -2*sqrt(2)*m[16]-2*sqrt(2)*m[18]+m[13]-2*m[15]+3*m[16]+2*m[18]+2*m[1]
 +11*m[19]+6*m[21]+m[4]+2*m[6]+9*m[10]+2*m[12] = 6*sqrt(2)-33, m[29]
 +2*sqrt(2)*m[18]+6*sqrt(2)*m[20]-12*sqrt(2)*m[21]-2*sqrt(2)*m[3]
 -4*sqrt(2)*m[11]-2*sqrt(2)*m[15]-2*sqrt(2)*m[17]+m[14]+4*m[15]+3*m[17]
 -2*m[18]+2*m[2]+11*m[20]-22*m[21]+m[5]-4*m[6]+9*m[11] = 6*sqrt(2)-6, m[30]
 -12*sqrt(2)*m[20]+6*sqrt(2)*m[21]-2*sqrt(2)*m[2]-8*sqrt(2)*m[9]
 -2*sqrt(2)*m[14]-4*sqrt(2)*m[15]+2*sqrt(2)*m[17]+4*m[14]+6*m[15]-2*m[17]
 +m[18]+m[3]-22*m[20]+11*m[21]-4*m[5]+4*m[6]+18*m[9] = 6*sqrt(2)+21,
 -4*m[4]+2*m[5]+2*m[17]-2*m[18]-22*m[19]+6*m[20]-6*m[21]-2*m[16]-4*m[15]
 +m[31]-4*m[6]-16*m[9]+2*m[11]+4*m[13]-2*m[14]-2*sqrt(2)*m[1]+4*sqrt(2)*m[9]
 -2*sqrt(2)*m[17]-4*sqrt(2)*m[11]+2*sqrt(2)*m[15]+2*sqrt(2)*m[16]
 -12*sqrt(2)*m[19]-2*sqrt(2)*m[13]+2*sqrt(2)*m[20]-2*sqrt(2)*m[21]
 = 12*sqrt(2)-120}:

Digits:=60:
S:=Optimization:-LPSolve(1,L,map(u->u=0..infinity,
                                 indets(L,And(name,Not(constant))))[])[2]:
Digits:=15:

C:=identify(S);

[m[1] = 0, m[2] = 0, m[3] = -309/7+(261/7)*2^(1/2), m[4] = 0, m[5] = 0, m[6] = 0, m[7] = 219/98-(61/49)*2^(1/2), m[8] = -22/7+(23/7)*2^(1/2), m[9] = 114/7-(51/14)*2^(1/2), m[10] = -95/49+(342/49)*2^(1/2), m[11] = 0, m[12] = 109/7-(8/7)*2^(1/2), m[13] = 0, m[14] = 0, m[15] = 0, m[16] = 0, m[17] = 0, m[18] = 0, m[19] = 0, m[20] = 366/7-36*2^(1/2), m[21] = 0, m[22] = 0, m[23] = 0, m[24] = 0, m[25] = 0, m[26] = 0, m[27] = 0, m[28] = 0, m[29] = 0, m[30] = 0, m[31] = 0]

normal(eval(map(lhs-rhs,L),C));

{0}

 

Download LPSolve_ex2.mw

@Carl Love That is very unfortunate programming of the Java GUI.

(I spend so much time in the commandline interface that I reflexively think of its sane behaviour as "the normal manner".)

I will submit a bug report.

@Carl Love I agree with what you've written, except that I don't see it respecting interface(verboseproc) in the usual manner.

@pik1432 FYI, two solutions for the new system can also be found (quickly) as follows:

RootFinding:-Isolate(evalf[100]((lhs-rhs)~([f1,f2,f3,f4,f5,f6,f7,f8,f9,f10])),
                     [vars[]],maxroots=3,digits=20);

Q_ac_20200811_ac2.mw

You could start by providing us with details of what you did to obtain this.

You can upload and attach a Worksheet to a Comment or Question here. Use the green up-arrow in the Mapleprimes editor.

@Reshu Gupta 

G:=x -> -1.50000000000*x - 0.0170454545454*(x^4 + 17.6721666667*x^2
 - 5.11042142857)*x - 0.0197950153310*exp(-4.47213595500*x)
 + 0.0197950153310*exp(4.47213595500*x)
 + 6.62030572935*10^(-13)*(-92400.*x^4 - 82645.0724484*x^3 + 526680.*x^2
  + 241736.836912*x + 27027.)*exp(-4.47213595500*x + 4.47213595500)
  + 6.62030572935*10^(-13)*(92400.*x^4 - 82645.0724484*x^3 - 526680.*x^2
  + 241736.836912*x - 27027.)*exp(4.47213595500*x + 4.47213595500):
V:=Vector([seq(G(x),x=[seq(-1..1,0.1)])]):
P1:=plot(<<[seq(-1..1,0.1)]>|V>,style=point):
P2:=plot(G,-1..1):
plots:-display(P1,P2);
ExcelTools:-Export(V, "foo.xls");

@nm Debugging your example is easier at first, since one can trace or stopat the signum command, starting with argument  1/sin(x).

That  leads to Re(x) under the assumption. But Re is a kernel builtin, so showstat and stopat appear to be a dead end. However, some kernel builtins will also call back out to Library commands. By setting printlevel:=999: you can tell how the kernel calls back into the Library, for this example, and continue on with Library-side debugging techniques.

It gets a little awkward, as you have to also dispel the chaff after setting printlevel:=1: again. But it's workable.

So, I traced signum to find that Re(x) assuming x::{} returned 0. Then I used higher printlevel to see (fortunately) where the kernel happened to call back into the Library.

Your original question was about why the (accidental) use of assuming {} produced the division by zero error, since you had already corrected your syntax for using `assuming` in prefix form.

But for fun, a few other ways to get the more compact tan form result,

restart;

u1 := -ln(csc(x)-cot(x));

                   u1 := -ln(csc(x) - cot(x))

subs(X=x/2,convert(simplify(convert(subs(x=2*X,u1),tan)),tan));

                            /   /1  \\
                         -ln|tan|- x||
                            \   \2  //

[sin(x)=trigsubs(sin(x),trigidentity="Double Angle")[1]]:
convert(simplify(subs(%,simplify(u1))),tan);


                            /   /1  \\
                         -ln|tan|- x||
                            \   \2  //

[csc(x)=trigsubs(csc(x),trigidentity="Double Angle")[1],
 cot(x)=trigsubs(cot(x),trigidentity="Double Angle")[1]]:
convert(simplify(subs(%,u1)),tan);

                            /   /1  \\
                         -ln|tan|- x||
                            \   \2  //
First 160 161 162 163 164 165 166 Last Page 162 of 591