Konstantin@

220 Reputation

9 Badges

16 years, 294 days
Kharkov
PhD in Numerical Optimization.

MaplePrimes Activity


These are questions asked by Konstantin@

Dear friend,

Recently I noticed, that numerical integration returns different values for the same function.

For example the code

restart;
evalf(int((exp(x)*(4420*cos(4)*sin(4)-544*cos(4)^2+148147*exp(-1)-4225*cos(4)-215203)/(71825*exp(1)-71825*exp(-1))-exp(-x)*(4420*cos(4)*sin(4)-544*cos(4)^2+148147*exp(1)-4225*cos(4)-215203)/(71825*exp(1)-71825*exp(-1))+(32/4225)*cos(4*x)^2+(1/71825)*(4225+(2210*x-6630)*sin(4*x))*cos(4*x)+x^2+8434/4225)^2, x = 0 .. 1));

each time returns values

0.0005951015934
0.0005950850548
0.0005950974588
0.0005950960805
0.0005951297843 etc.

Maybe, evalf uses a stochastic algorithm for integration?

Dear friends.

I need a simple approach for reading a specified line of a text file.

FileTools[Text] module allows to count the lines. By sequential reading of lines it's possible to reach any position in the file. But for large file this takes a lot of time.

FileTools[Position] allows to set/get position in the file, but the position is counted in bytes.

Are there any workarounds for the problem or the use of Database Package is more preferable?

Maple function plot allows to build a linear plot for two vectors, when one vector contains X coordinates, another -- Y coordinates (similar to plot below):

Is it possible to build such a plot for several Y-vectors like this:

12

 

Is it possible to organize output of plots in Mathematica-like manner

1
in one list (placed in one cell)?

In Maple I use tables for these purposes:

1

Maybe, does there exist a more elegant solution?

I try to save results of numeric integration of ODE, returned by dsolve. I address very simple equation and before saving all works as needed:

S1 := dsolve([diff(z(x), x$2)+z(x) = -2, z(0)=0, z(1)=1], z(x), 'numeric', 'output' = listprocedure);

F1 := unapply(rhs(S1[2])(x), x); plot(F1, 0..1, thickness=3);
1

Next I save solution S1 by save operator:

save S1,  filename;

S1 saved and likely looks correctly:

S1 := [x = proc (x) local _res, _dat, _solnproc; option
`Copyright (c) 1993 by the University of Waterloo. All rights reserved.`; _dat
:= Array(1..4, {1 = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; ........................................................

Operator read reads S1 from file:
read filename;

but

F1 := unapply(rhs(S1[2])(x), x);

returns an error:

Error, (in unknown) invalid input: the 1st argument to pointto is not a valid pointer handle

How to save solution correctly?

 

1 2 3 4 5 6 Page 4 of 6