vv

13837 Reputation

20 Badges

9 years, 317 days

MaplePrimes Activity


These are answers submitted by vv

# 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.

It's a specially cooked system.

 

restart;

sys:={
21000 = ((10/1000)/60)*4181*983*(x-y),
H = -((10/1000)/60)*4181*ln(1-((x-y)/(x-40))),
H = 124+102*ln(x-40)+(7+2*ln(x-40)) };

{21000 = (4109923/6000)*x-(4109923/6000)*y, H = -(4181/6000)*ln(1-(x-y)/(x-40)), H = 131+104*ln(x-40)}

(1)

evalf[1000]( fsolve(sys, {x,y,H}, {x=50..100,y=30..100,H=400..500} )   );

{H = 486.9792717948501357867918018059386067855156547114174326869481418810967243566285398975787784552235204706669347559475195400290118640303716801287372634993661346148619910232495800569296330392394830627549743601915872902357242427148731055409553705001658423528217321565927918891190491572966479397271232198426513612569355038417041808873881442623841262343853418832298327693593790610240451083265130917877844785166083247626127110701898215838963336513184408835894194697247808253085787062731557015693465725077077852896999228843274976631083570662482036300138497124715790019203338925750433405104219573337388245857036034857797986214888125128213468426540193206945839888044251684815660805344557214322036920099275934107239459489909624991382336777779198068497280647366466732283885118035797277802575588920390167295368604982886417919721008912823848353938665076022764471765288194352037535498835268165004232995241166817494393305369865683989720565493276815812710671414695060596389471870171101177308498370799633961387014797870, x = 70.65750866865388962274962328977939489377294903091858411945917234945764190715981783600325358893585110961932863462405500054380580852731304211782069883061069513954397685796059926183531905585579097223962590053390294660021611110475792368859465250322207982971943756610525306678494949905387521858682023969792135750167009335860887007621303198544321368035359069175536312026362350448543477228656103669649753257153387272484737179648441014252898713320281206372610926492497110938583549273159942143012717266939216706865489265272371561718110362755576369288566379279748261854103496737662967801146998815897672787725783471077732933162054089997390996937068458728288379330756605842335927722582205633540658909087373621564984005454626854462329726540402400771083530825578130314424765827873541484037247233111699579267679369342370990364580403457147196305388562501611449040359242137916479015561482141032930179069021129023984141254333721654117596419374749676562545752857082962606395129368846731712926167576535994552285681007055, y = 40.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000958347308577476849155817266967208600479833803954882640800358625509636683984970528639967775046602065201922053597715478431016498682880079609787467682537323162308315760688601560985179585421913717270699604525982018646370272917837250840635796722371496634076989812851876433207535565380863444548970077618286474517739106107056439827996365038277140944772163420380808436265855437736016956601251559483196367236991702787708084161571078609077635832578435472524929603687671421461968192303179415316459681254027553729208024619289830444214278717989841247739063311010334060299714878719957897139070573801145583905093544680767085382367073228848646299934993482758918092665796726848329309766789651450780060432670622190}

(2)

evalf(%);

{H = 486.9792718, x = 70.65750867, y = 40.00000000}

(3)

 

The exact answer should be Pr(infinity), where

Pr := proc(n::posint) local k; 
add((2/3)^k/3*`if`(is(sin(k)<=1/2),1,0),k=0..n)
end: 

which of course cannot be computed by Maple.
Maple answers:
Pr(13); evalf(%);
    
2839595/4782969
     0.5936887736
which is an approximation (not too good).

evalf[50](Pr(300));
    .59502775989667091140797025425657732088366035178640


 

 

You cannot because the function is not periodic (for any values of the parameters).

findOrderOf:= proc(g::posint, p::prime)
  local G,i;
  G:=1;
  for i from 1 to p-1 do
    G:=g*G mod p;
    if(G = 1) then return i end if;
  end do;  
end proc;

Maple has it builtin:  NumberTheory:-MultiplicativeOrder

You should read showstat(NumberTheory:-MultiplicativeOrder)
and try to understand the algorithm for an efficient implementation.

 

f := n -> sum(i^3, i=1..n);

But note that f(...) will fail if i is assigned, so a better definition is:

f := n -> sum('i'^3, 'i'=1..n);

 

First 75 76 77 78 79 80 81 Last Page 77 of 120