vv

14112 Reputation

20 Badges

10 years, 135 days

MaplePrimes Activity


These are answers submitted by vv

Drawing letters is a trivial task in Maple.

It's a matter of defining the polygon(s). It would be nice if someone with artistic abilities would design them.

Note that for all the letters except i and j a single polygon is enough.

For example:

with(plottools):with(plots):

A := [[3,0],[4,0],[.5,10.5],[-.5,10.5],[-4,0],[-3,0],[-2,3],[2, 3],[1.65,4.05],[-1.65,4.05],[0, 9]]:

display(polygon(A), axes=none);

 

After that, in Maple 2017 we can do this:

AA:=extrude(display(polygon([A]), scaling=constrained), 0..1.2,style=surface, axes=none):

animate(display@rotate,[AA,t, [[0,0,0],[0,1,0]] ], t=0..2*Pi,paraminfo=false,orientation=[-90,-15,25]);

 

 

# Next number

f:=proc(n::{posint,name})
local t, k, f1, i;
f1 := (t,k) -> mul(t-i,i=1..k-1)*mul(t-i,i=k+1..nops(f(0)));
convert(add(f(0)[k]*f1(n,k)/f1(k,k),k=1..nops(f(0))),horner)
end:

f(0):=[3,10,2,7,7,42]:
seq(f(k),k=1..7);
f(x);

3, 10, 2, 7, 7, 42, 314

 

-197+(6212/15+(-3571/12+(195/2+(-179/12+(13/15)*x)*x)*x)*x)*x

(1)

f(0):=[3,10,2,7,7,13]:
seq(f(k),k=1..7);
f(x);

3, 10, 2, 7, 7, 13, 140

 

-168+(4175/12+(-5837/24+(1847/24+(-271/24+(5/8)*x)*x)*x)*x)*x

(2)

f(0):=[1,2,4,8,16];
seq(f(k),k=1..6);
f(x);

[1, 2, 4, 8, 16]

 

1, 2, 4, 8, 16, 31

 

1+(-3/4+(23/24+(-1/4+(1/24)*x)*x)*x)*x

(3)

f(0):=[1,2,4,8,16,32];
seq(f(k),k=1..9);

[1, 2, 4, 8, 16, 32]

 

1, 2, 4, 8, 16, 32, 63, 120, 219

(4)

 

Your  algebraic fractions al already simplified (but there are of course other possibilities, e.g. partial fractions).
For a factorization, the field K is needed.
For K=Q, the polynomials are already factorized.
If you want K=C (complete factorization) the simplest way is to find the roots with solve. E.g.

p:=(k+2)*(k^2+5)*(k^3-5*k^2+13*k-8)/(6*k*(k^2-3*k+8)):
p1,p2:=(numer,denom)(p):
R1,R2:=[solve(p1,k,explicit)],[solve(p2,k,explicit)]:
mul(k-r,r=R1)/mul(k-r,r=R2);

Actually, the solution of your ODE is

A(t) = a * exp( I * ( a^2*t + b ) ),  where  a, b are real constants.

This can be obtained with Maple writing A(t) in polar form:

restart;
ode := diff(A(t),t) - I * conjugate(A(t))*A(t)^2:
simplify(eval(ode, A(t)=R(t)*exp(I*phi(t)) )  /exp(I*phi(t)) ) assuming real:
evalc([Re,Im](%)):
dsolve(%);

restart;
a := Matrix(3, 3, [[x, y, z], [y, z, x], [z, x, y]]):
ex:= Matrix(3, 3, [[x, y, z], [y, z, x], [z, x, y]]) + B:
#eval(ex, a=A); #does not work
evalindets(ex, 'Matrix', u -> `if`(EqualEntries(u,a),A,u));

                             B + A
evalindets(ex, 'Matrix', u -> `if`(LinearAlgebra[Equal](u,a),A,u));
                             B + A

 

# Open Newton–Cotes (N=n-1)
ONC:=proc(n::posint)
local nodes:=[seq(k/n,k=1..n-1)], B,w,i,k,x;
B:=i -> [seq(`if`(k=i,1,0),k=1..n-1)]:
w:=[seq(int(CurveFitting:-PolynomialInterpolation(nodes,B(i),x),x=0..1),i=1..n-1)] ;
`1/(b-a)`.'c'=w,'p'=2*floor(n/2)+1
end:

ONC(5);
       `1/(b-a)` . c = [11/24, 1/24, 1/24, 11/24], p = 5

Optimization:-Minimize(
0,
{
cos(q[1])*cos(q[3])-sin(q[1])*sin(q[3])+sin(q[1])*q[2]+cos(q[1]) - 1 = 0,
sin(q[1])*cos(q[3])+cos(q[1])*sin(q[3])-cos(q[1])*q[2]+sin(q[1]) -1 = 0
},


q[1] = 2 ..  Pi, q[2] = 1 .. 1.5, q[3] = -3 .. -2

#   q[1] = 0 ..  Pi, q[2] = 0.1 .. 1.5, q[3] = -Pi/2 .. 4*Pi/3
# ,  initialpoint = [q[1]=2.0944, q[2]=1.4, q[3]=-2.7925]

);

       [0., [q[1] = 2.30431169727399, q[2] = 1.03640893001776, q[3] = -2.75622305752699]]

int_part:=proc(f,h,t,n::integer)
local k,u,v,s;
u:=f;
v:=h;
s:=0;
for k from 1 to n do;
  u:=int(u,t);
  s:=s-(-1)^(k)*u*v;
  v:=diff(v,t);
od;
s;
end:

int_part(exp(-x*t), 1/sqrt(t*(t+1)), t, 6):
A:=unapply(simplify(-eval(%,t=1)),x);

proc (x) options operator, arrow; (1/2048)*exp(-x)*2^(1/2)*(1024*x^5-768*x^4+1216*x^3-3024*x^2+10404*x-46035)/x^6 end proc

(1)

J:= x -> Int((exp(-x*t))/sqrt(t*(t+1)),t=1..infinity):

evalf[20](eval( [A(x), A(x)-J(x)], x=20));  # check

[0.70333100226385465863e-10, -0.211984348249630e-15]

(2)

 

It seems that Maple needs help here.

solve({combine(7*cos(2*t)=7*cos(t)^2-5), t>=0, t<=2*Pi}, t, allsolutions, explicit);

restart;

with(plots):with(plottools):
p:=display(textplot([0,0,"A"]), 'font'=["times","roman",200],size=[210,200],axes=none ):
q:=display(textplot([0,0,"B"]), 'font'=["times","roman",200],size=[210,200],axes=none ):
FA:="A.png": FB:="B.png":  plottools:-exportplot(FA,p):  plottools:-exportplot(FB,q):
A:=plot3d(1, x=-1..1, y=-1..1,  image =FA): B:=plot3d(1, x=-1..1, y=-1..1,  image =FB):

f := (u,a,b) -> transform( (x,y,z) -> [a+x*cos(u)-y*sin(u),b+x*sin(u)+y*cos(u)]):
display(f(0,0,0)(A),f(Pi/6,4,0)(A),f(-Pi/3,2,-2)(B), axes = none,scaling=constrained);

 

 

u:=Re(exp(1/4-(1/4)*signum(x))*cos((1/2)*ln(abs(x))/Pi)-I*exp(1/4-(1/4)*signum(x))*sin((1/2)*ln(abs(x))/Pi)):

u1:=simplify(u) assuming x>0;
u2:=simplify(u) assuming x<0;

cos((1/2)*ln(x)/Pi)

 

exp(1/2)*cos((1/2)*ln(-x)/Pi)

(1)

limsup(u, x=infinity) = limsup(u1, x=infinity) =1  should be clear now. Also for liminf.

 

To see the oscillations, a semilog plot is needed.

plots:-semilogplot(u,x=10..10^100);

 

 

With Maple the approach should be completely different, see:
https://www.mapleprimes.com/questions/204335-Can-Rotate-3d-Text-Like-This-Be-Done-In-Maple

 

A := Matrix(3, 3, [[2, -3, 1], [-3, 5, 0], [1, 0, 5]]):

L:=LinearAlgebra:-LUDecomposition(A, method='Cholesky')^*;

Warning, Matrix is not positive-definite

 

_rtable[18446744074366462782]

(1)

A - L^* . L; # check

_rtable[18446744074366456886]

(2)

f := (x-2)^2+1:
ff := f(x);
    (x(x)-2)^2+1

So, ff is a mathematical nonsense but syntactically correct.
Because  const(x)  simplifies to  const  we have e.g.
eval(ff, x=12);
    101

So, actually ff will work in numerical computations if eval is used.

Minimize(g, {x >= -2, x <= 2});
gives a syntax error. Use:

Minimize(g, -2..1);
         
[2., Vector[column](1, [1.])]


About the piecewise stuff.

The Optimization package assumes that the objective function and constraints are twice continuously differentiable.
You cannot expect correct results if they are not so.
 

Use

A:=ImportMatrix("yourpath\\-Validierung-Stahl-AI-.txt");

and you will have a 1214 x 1356  Matrix.

First 76 77 78 79 80 81 82 Last Page 78 of 121