Kitonum

18909 Reputation

26 Badges

14 years, 34 days

MaplePrimes Activity


These are replies submitted by Kitonum

@abhilashun  You can easily calculate the volume of this body numerically, using the Monte Carlo method (of course with low accuracy):

f1:=x^4+2*x^2*y^2+2*x^2*z^2+y^4+2*y^2*z^2+z^4-2*x^3-2*x*y^2-2*x*z^2-(79/25)*x^2-(104/25)*y^2-(8/5)*z^2+(104/25)*x:
f2:=x^4+2*x^2*y^2+2*x^2*z^2+y^4+2*y^2*z^2+z^4-2*x^2*y-2*y^3-2*y*z^2-(104/25)*x^2-(79/25)*y^2-(8/5)*z^2+(104/25)*y:
f3:=x^4+2*x^2*y^2+2*x^2*z^2+y^4+2*y^2*z^2+z^4+2*x^3+2*x*y^2+2*x*z^2-(79/25)*x^2-(104/25)*y^2-(8/5)*z^2-(104/25)*x:
f4:=x^4+2*x^2*y^2+2*x^2*z^2+y^4+2*y^2*z^2+z^4+2*x^2*y+2*y^3+2*y*z^2-(104/25)*x^2-(79/25)*y^2-(8/5)*z^2-(104/25)*y:
evalf(Int(`if`(f1<=0 and f2<=0 and f3<=0 and f4<=0, 1, 0), [x=-2..2, y=-2..2, z=-2..2], method = _MonteCarlo, epsilon=0.001));
                                                           
 12.16037145
 

@abhilashun

plots:-implicitplot3d(max(f1,f2,f3,f4)=0,  x=-2..2, y=-2..2,z=-2..2, style=surface, axes=normal, scaling=constrained, lightmodel=light3, numpoints=1000000); 

                                     

 

@Deank1905  You should more clearly formulate your problem and also download (or give a link) the worksheet.

@acer  I think your approach will be too difficult for a beginner. Because we already know that  f(1)=0 , then we can just write

f := x -> 2*x^2-2;
1/D(f)(1);
                                                


or if we do not know the value of  x  in  y=f(x)  for  y=0 :

f := x -> 2*x^2-2;
x:=eval(x, solve({f(x)=0, x>=0})) ;
1/D(f)(x);
                                                  

@amrramadaneg Try the following way. We have about 100 points  on every side of the square:

a:=2: b:=5:
plot([[0,t,t=-a..a], [t,a,t=0..b], [b,t,t=-a..a], [t,-a,t=0..b]], style=point, color=red,scaling=constrained, symbol=circle, symbolsize=3, numpoints=100, adaptive=false, size=[1000,600]);

@RElax  Sorry that did not answer your questions right away, I was pretty busy. I answer for each item. I note at once that this is not a recursive procedure, because In the body of the procedure, we do not refer anywhere to the name of the procedure.

1. In the first line we declare the name of the procedure, i.e. Sierpinski, and in parentheses after that we declare the names of formal parameters and their types.
2. In the next line, we declare the names of local variables. Outside the body of the procedure these are just symbols.
3. The sub-procedure  named  Step  plays a key role in Sierpinski procedure. It reproducts triangles for one step, i.e. to each element from a list  L (the element is a list of vertices of a triangle), it associates three new triangles. For example, triangles AEG, EBF, GFC, where E, F, G are the midpoints of the sides AB, BC, AC, will be associated with the triangle ABC.
4. In  A  we simply fill the interior of the resulting triangles, and in  B  we draw their vertices in the form of small circles.
5. display command depicts everything together.

@RElax  

1. I did not understand what you mean "...starting from "16" ".

2. Circles at the tops of the Sierpinski triangle:

Sierpinski1:=proc(T::list,n::nonnegint,C::symbol:=red)
local Step, A, B;
uses plottools, plots;
Step:=L->map(t->op([[t[1],(t[1]+t[2])/2,(t[1]+t[3])/2],[(t[1]+t[2])/2,t[2],(t[2]+t[3])/2],[(t[1]+t[3])/2,(t[2]+t[3])/2,t[3]]]), L);
A:=map(t->polygon(t,style=surface,color=C),(Step@@n)([T]));
B:=map(t->plot(t,style=point,color=C, symbol=circle, symbolsize=8),(Step@@n)([T]));
display(A,B, axes=none, scaling=constrained, size=[600,600]);
end proc:


Example of use:

Sierpinski1([[-1,0],[0,1.73],[1,0]], 5);

Output:

                        

@mehdi jafari  Here is another way in which the substitution  S  is done separately in the numerator and in the denominator:

restart;
f2:=-2*(sqrt(6*beta[11]^2-8*beta[11]*sigma[11]+12*beta[12]^2-24*beta[12]*sigma[12]+4*sigma[11]^2+12*sigma[12]^2)*(-sigma[11]^2-3*sigma[12]^2-3/2*(beta[11]^2)+2*beta[11]*sigma[11]+6*beta[12]*sigma[12]-3*beta[12]^2)+E*delta_gamma*omega*(beta[11]^2+6*beta[12]^2-12*beta[12]*sigma[12]+6*sigma[12]^2))*(1/sqrt(6*beta[11]^2-8*beta[11]*sigma[11]+12*beta[12]^2-24*beta[12]*sigma[12]+4*sigma[11]^2+12*sigma[12]^2))*(1/(3*beta[11]^2-4*beta[11]*sigma[11]+6*beta[12]^2-12*beta[12]*sigma[12]+2*sigma[11]^2+6*sigma[12]^2));
S:=sqrt(6*beta[11]^2-8*beta[11]*sigma[11]+12*beta[12]^2-24*beta[12]*sigma[12]+4*sigma[11]^2+12*sigma[12]^2)=phi:
simplify(subs(S,numer(f2))/subs(S,denom(f2)));

 

@Adam Ledger  This does not contradict what I wrote. You have defined the sequence of names explicitly with already known number of members.

@Adam Ledger  Just Maple is so designed that the formal parameters of the procedure can be a name or a sequence of names (specified explicitly) or nothing. If you have a sequence with an undefined number of terms, you can just give it a name and then reference it. You can even not specify formal parameters at all, but in the body of the procedure refer to them using  args  and  nargs  commands. Here is a simple example of these two ways. Two procedures below calculate the arithmetic mean of several numbers:

Mean1:=a->add(a)/nops(a); # First way
Mean2:=()->`+`(args)/nargs; # Second way

Mean1([1,2,3,4]);  # Examples of use
Mean2(1,2,3,4);


 

@Adam Ledger  Of course, I know this wonderful formula for calculating the number of lucky tickets. Maple can calculate by this formula, but it takes 20 times longer than using  NestedSeq  procedure:

t:=time(): 1/Pi*int((sin(10*x)/sin(x))^6, x=0..Pi); time()-t;
t:=time(): `+`(NestedSeq(`if`(i+j+k=l+m+n,1,0), [i,j,k,l,m,n]=~0..9)); time()-t;

                                                                        55252
                                                                        13.828
                                                                        55252
                                                                         0.719

@Muhammad Usman Sorry, I did not notice that degrees are required, not radians. Correct as showed to you by tomleslie.

@tomleslie 

convert(sum(ln(k), k=1..m), factorial)  assuming m::posint;
                                                       
 ln(m!)


 

@acer  1. Thank you for correcting the error in my answer.

2. We can also use  plottools:-curve  command, which is especially useful if you need to plot a broken line in 2D or in 3D with a greater number of links than one link:

A:=[1, 2, 3]: B:=[4, 5, 6]: C:=[3,2,9]:
plots:-display(plottools:-curve([A, B], color=red, thickness=2));
plots:-display(plottools:-curve([A, B, C], color=red, thickness=2));

@minhhieuh2003  See the update to my answer.

First 37 38 39 40 41 42 43 Last Page 39 of 124