Post Reply 
[VA] SRC #012d - Then and Now: Area
01-12-2023, 07:31 AM
Post: #10
RE: [VA] SRC #012d - Then and Now: Area
All calculators used (42S, DM42 and Free42) have
  • 30.07 in variable "M"
  • 1.598 in variable "d"
  • RAD mode.

1. define the rectangle

Let's first determine the y-values of the rectangle.

It's clear that EXP(-((x-d)^3-y)^2) <= 1, and it is equal to 1 for all y=(x-d)^3
so y^2/M + EXP(-SIN(y)) = 1 is a border: anything < 1 may belong to the area, > 1 does not.
that turns out to be the case for y=0 and y=2.8274.., found with the 42S solver program.
So our area is between these two y values.

00 { 27-Byte Prgm }
01▸LBL "VA4Y"
02 MVAR "Y"
03 RCL "Y"
04 ENTER
05 X^2
06 RCL÷ "M"
07 X<>Y
08 SIN
09 +/-
10 E^X
11 +
12 1
13 -
14 END

Incidentally (and accidentally) I also found a tiny region -4.0851.. <= y <= -4.0492.. where the original inequality will hold (eg. y=-4.05 and x=0.004). There are no other regions since
EXP(-SIN(y)) >= 1/e, abs(y) < SQRT((1 - 1/e)*M) = 4.3598.

If we rewrite the orginal formula as an equality, we can isolate x for a given y:

(1) x = d + CBRT(y +/- SQRT(-LN(y^2/M + EXP(-SIN(y)))))

When the result of LN is positive, we're outside of the area and there are no real solutions for x.
Within the area, there are two results for x (that coincide at the edges), describing the shape.
A bit of trial and error gives the following rectangle boundaries, just for the purpose of graphing the area (I used Y=-0.1 to have the shape come clear off the bottom edge).

Main Tiny
X0: 0.97 -0.001
X1: 3.05 0.0045
Y0: -0.1 -4.049
Y1: 2.85 -4.086


2. graph the shape

I graphed the main shape on my DM42 with the following drawing routine, with GrMod=2
(I enlarged the X range to X0=0.58 and X1=3.44 to have the X and Y scale be the same)
Set the values with VARMENU "VA4D", EXIT the menu and do XEQ "VA4D".
(the program can be made a lot more efficient, but that was not the scope here).


.bmp  VA4.bmp (Size: 12.31 KB / Downloads: 20)

00 { 167-Byte Prgm }
01▸LBL "VA4D"
02 MVAR "X0"
03 MVAR "X1"
04 MVAR "Y0"
05 MVAR "Y1"
06 MVAR "GrMod"
07 CLLCD
08 RCL "X1"
09 RCL- "X0"
10 RCL "ResX"
11 LSTO "X"
12 DSE ST X
13 ÷
14 LSTO "Sx"
15 RCL "Y0"
16 RCL- "Y1"
17 RCL "ResY"
18 DSE ST X
19 ÷
20 LSTO "Sy"
21▸LBL 10
22 RCL "Sx"
23 RCL× "X"
24 LASTX
25 -
26 RCL+ "X0"
27 LSTO "Xc"
28 RCL "ResY"
29 LSTO "Y"
30▸LBL 11
31 RCL "Sy"
32 RCL× "Y"
33 LASTX
34 -
35 RCL+ "Y1"
36 ENTER
37 ENTER
38 X^2
39 RCL÷ "M"
40 X<>Y
41 SIN
42 +/-
43 E^X
44 +
45 RCL "Xc"
46 RCL- "d"
47 3
48 Y^X
49 R^
50 -
51 X^2
52 +/-
53 E^X
54 X≤Y?
55 GTO 00
56 RCL "Y"
57 RCL "X"
58 PIXEL
59▸LBL 00
60 DSE "Y"
61 GTO 11
62 DSE "X"
63 GTO 10
64 END

3. calculate area

Well then. All that is needed is to integrate the shape over the Y-range. That can be done with a standard 42S integration routine, integrating dx = x2-x1, with x2 the positive root of (1):

c := SQRT(-LN(y^2/M + EXP(-SIN(y))));
dx := CBRT(y + c) - CBRT(y - c);
Area := integral(y=0 to 2.8274,dx);

Here I use LLIM=0 and ULIM=2.82740261413 for Main area
LLIM=-4.08514674764 and ULIM=-4.092122644 for Tiny area
the accurate limits are calculated with the solver program VA4Y above
The integration is done in Free42.

00 { 55-Byte Prgm }
01▸LBL "VA4"
02 MVAR "Y"
03 RCL "Y"
04 ENTER
05 X^2
06 RCL÷ "M"
07 X<>Y
08 SIN
09 +/-
10 E^X
11 +
12 LN
13 X>0?
14 CLX
15 X=0?
16 RTN
17 +/-
18 SQRT
19 ENTER
20 RCL+ "Y"
21 XEQ 13
22 X<>Y
23 RCL- "Y"
24 XEQ 13
25 +
26 RTN
27▸LBL 13 @ Cube Root
28 SIGN
29 LASTX
30 ABS
31 3
32 1/X
33 Y^X
34 ×
35 END

with ACC=1E-5 we get

2.07663 for the Main area
7.19762E-5 for the Tiny area

This accuracy needs 16383 function evaluations (for the Main area). That would take quite some time on a real 42S. The DM42 on USB takes about 94s.
Since the constant M is only given to 4 sig. digits, probably the Tiny area can be considered negligible. If not, I took the calculation of the integral a bit further, only on Free42 this time:

ACC #evals Main Tiny

1E-5 16383 2.07662797558 7.19761929874-5
1E-7 131071 2.07662603505 7.19761930422E-5
1E-9 524287 2.07662630959 =
1E-11 = =
1E-15 = =

So the sum of both areas is 2.07669828578

And now I'm going to try and understand Albert's contribution ;-)

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC #012d - Then and Now: Area - Werner - 01-12-2023 07:31 AM



User(s) browsing this thread: 1 Guest(s)