Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What we need to get PDF doc to build... #876

Merged
merged 7 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mathics/builtin/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ def eval_with_options(x, evaluation: Evaluation, options: dict):

name: Optional[str] = None
context: str = ""
abstract: bool = False
attributes: int = A_PROTECTED
is_numeric: bool = False
rules: Dict[str, Any] = {}
Expand Down
58 changes: 31 additions & 27 deletions mathics/builtin/datentime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

Dates and times are represented symbolically; computations can be performed on them.

Date object can also input and output dates and times in a wide range of formats, as well as handle calendars.
Date object can also input and output dates and times in a wide range of formats, as \
well as handle calendars.
"""

import re
Expand Down Expand Up @@ -259,7 +260,6 @@ def to_datelist(self, epochtime, evaluation):
(isinstance(val, float) and i > 1) or isinstance(val, int)
for i, val in enumerate(etime)
):

default_date = [1900, 1, 1, 0, 0, 0.0]
datelist = etime + default_date[len(etime) :]
prec_part, imprec_part = datelist[:2], datelist[2:]
Expand Down Expand Up @@ -348,7 +348,8 @@ class AbsoluteTime(_DateFormat):

<dl>
<dt>'AbsoluteTime[]'
<dd>gives the local time in seconds since epoch January 1, 1900, in your time zone.
<dd>gives the local time in seconds since epoch January 1, 1900, in your \
time zone.

<dt>'AbsoluteTime[{$y$, $m$, $d$, $h$, $m$, $s$}]'
<dd>gives the absolute time specification corresponding to a date list.
Expand Down Expand Up @@ -380,9 +381,7 @@ class AbsoluteTime(_DateFormat):
= 1000
"""

abstract = "absolute time in seconds"

summary_text = "absolute time in seconds"
summary_text = "get absolute time in seconds"

def eval_now(self, evaluation):
"AbsoluteTime[]"
Expand Down Expand Up @@ -410,7 +409,8 @@ class AbsoluteTiming(Builtin):

<dl>
<dt>'AbsoluteTiming[$expr$]'
<dd>evaluates $expr$, returning a list of the absolute number of seconds in real time that have elapsed, together with the result obtained.
<dd>evaluates $expr$, returning a list of the absolute number of seconds in \
real time that have elapsed, together with the result obtained.
</dl>

>> AbsoluteTiming[50!]
Expand All @@ -421,7 +421,7 @@ class AbsoluteTiming(Builtin):

attributes = A_HOLD_ALL | A_PROTECTED

summary_text = "total wall-clock time to run a Mathics command"
summary_text = "get total wall-clock time to run a Mathics command"

def eval(self, expr, evaluation):
"AbsoluteTiming[expr_]"
Expand Down Expand Up @@ -612,7 +612,9 @@ class DateObject(_DateFormat, ImmutableValueMixin):
]

messages = {
"notz": "Argument `1` in DateObject is not a recognized TimeZone specification.",
"notz": (
"Argument `1` in DateObject is not a recognized " "TimeZone specification."
),
}

options = {
Expand All @@ -625,9 +627,7 @@ class DateObject(_DateFormat, ImmutableValueMixin):
"DateObject[]": "DateObject[AbsoluteTime[]]",
}

summary_text = (
" an object representing a date of any granularity (year, hour, instant, ...)"
)
summary_text = "get an object representing a date (year, hour, instant, ...)"

def eval_any(self, args, evaluation: Evaluation, options: dict):
"DateObject[args_, OptionsPattern[]]"
Expand Down Expand Up @@ -779,7 +779,6 @@ def eval(self, date, off, evaluation):
and isinstance(o[0], (float, int))
for o in pyoff
):

for o in pyoff:
idate.addself([o[0] * TIME_INCREMENTS[o[1]][i] for i in range(6)])
else:
Expand Down Expand Up @@ -998,7 +997,7 @@ class DateStringFormat(Predefined):

value = "DateTimeShort"

summary_text = "default date string format"
summary_text = "get default date string format as a list"

# TODO: Methods to change this

Expand Down Expand Up @@ -1091,7 +1090,8 @@ class SystemTimeZone(Predefined):

<dl>
<dt>'$SystemTimeZone'
<dd> gives the current time zone for the computer system on which Mathics is being run.
<dd> gives the current time zone for the computer system on which Mathics is \
being run.
</dl>

>> $SystemTimeZone
Expand All @@ -1101,7 +1101,7 @@ class SystemTimeZone(Predefined):
name = "$SystemTimeZone"
value = Real(-time.timezone / 3600.0)

summary_text = "time zone used by your system"
summary_text = "get the time zone used by your system"

def evaluate(self, evaluation):
return self.value
Expand All @@ -1120,7 +1120,7 @@ class Now(Predefined):
= ...
"""

summary_text = "current date and time"
summary_text = "get current date and time"

def evaluate(self, evaluation):
return Expression(SymbolDateObject.evaluate(evaluation))
Expand All @@ -1142,9 +1142,9 @@ class TimeConstrained(Builtin):

Possible issues: for certain time-consuming functions (like simplify)
which are based on sympy or other libraries, it is possible that
the evaluation continues after the timeout. However, at the end of the evaluation, the function will return '$Aborted' and the results will not affect
the state of the \\Mathics kernel.

the evaluation continues after the timeout. However, at the end of the \
evaluation, the function will return '$Aborted' and the results will not affect
the state of the Mathics3 kernel.
"""

# FIXME: these tests sometimes cause SEGVs which probably means
Expand All @@ -1166,7 +1166,10 @@ class TimeConstrained(Builtin):

attributes = A_HOLD_ALL | A_PROTECTED
messages = {
"timc": "Number of seconds `1` is not a positive machine-sized number or Infinity.",
"timc": (
"Number of seconds `1` is not a positive machine-sized number "
"or Infinity."
),
}

summary_text = "run a command for at most a specified time"
Expand Down Expand Up @@ -1219,7 +1222,7 @@ class TimeZone(Predefined):
"$TimeZone": str(value),
}

summary_text = "resettable default time zone"
summary_text = "gets the default time zone"

def eval(self, lhs, rhs, evaluation):
"lhs_ = rhs_"
Expand All @@ -1245,7 +1248,7 @@ class TimeUsed(Builtin):
"""

summary_text = (
"the total number of seconds of CPU time in the current Mathics session"
"get the total number of seconds of CPU time in the current Mathics3 session"
)

def eval(self, evaluation):
Expand Down Expand Up @@ -1274,7 +1277,7 @@ class Timing(Builtin):

attributes = A_HOLD_ALL | A_PROTECTED

summary_text = "CPU time to run a Mathics command"
summary_text = "get CPU time to run a Mathics3 command"

def eval(self, expr, evaluation):
"Timing[expr_]"
Expand All @@ -1301,7 +1304,7 @@ class SessionTime(Builtin):
"""

summary_text = (
"total elapsed time in seconds since the beginning of your Mathics session"
"get total elapsed time in seconds since the beginning of Mathics3 session"
)

def eval(self, evaluation):
Expand All @@ -1317,7 +1320,8 @@ class TimeRemaining(Builtin):

<dl>
<dt>'TimeRemaining[]'
<dd>Gives the number of seconds remaining until the earliest enclosing 'TimeConstrained' will request the current computation to stop.
<dd>Gives the number of seconds remaining until the earliest enclosing \
'TimeConstrained' will request the current computation to stop.

<dt>'TimeConstrained[$expr$, $t$, $failexpr$]'
<dd>returns $failexpr$ if the time constraint is not met.
Expand All @@ -1332,7 +1336,7 @@ class TimeRemaining(Builtin):

"""

summary_text = "time before a time constraint in a running program"
summary_text = "get remaining time in allowed to run an expression"

def eval(self, evaluation):
"TimeRemaining[]"
Expand Down
12 changes: 7 additions & 5 deletions mathics/builtin/drawing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,21 @@
Showing something visually can be done in a number of ways:

<ul>
<li>Starting with complete images and modifying them using the 'Image' Built-in function.
<li>Starting with complete images and modifying them using the 'Image' \
Built-in function.
<li>Use pre-defined 2D or 3D objects like <url>
:'Circle':
/doc/reference-of-built-in-symbols/drawing-graphics/circle</url> and <url>
:'Cuboid':
/doc/reference-of-built-in-symbols/graphics-drawing-and-images/three-dimensional-graphics/cuboid/</url> \
/doc/reference-of-built-in-symbols/graphics-and-drawing/three-dimensional-graphics/cuboid/</url> \
and place them in a coordinate space.
<li>Compute the points of the space using a function. This is done using functions like <url>
<li>Compute the points of the space using a function. This is done using functions \
like <url>
:'Plot':
/doc/reference-of-built-in-symbols/graphics-drawing-and-images/plotting-data/plot</url> \
/doc/reference-of-built-in-symbols/graphics-and-drawing/plotting-data/plot</url> \
and <url>
:'ListPlot':
/doc/reference-of-built-in-symbols/graphics-drawing-and-images/plotting-data/listplot</url>.
/doc/reference-of-built-in-symbols/graphics-and-drawing/plotting-data/listplot</url>.
</ul>
"""

Expand Down
122 changes: 62 additions & 60 deletions mathics/builtin/drawing/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,66 +63,68 @@ def get_default_face_color(self):

class Graphics3D(Graphics):
r"""
<url>:WMA link:https://reference.wolfram.com/language/ref/Graphics3D.html</url>

<dl>
<dt>'Graphics3D[$primitives$, $options$]'
<dd>represents a three-dimensional graphic.

<dd>See also the Section "Plotting" for a list of Plot options.
</dl>

>> Graphics3D[Polygon[{{0,0,0}, {0,1,1}, {1,0,0}}]]
= -Graphics3D-

In 'TeXForm', 'Graphics3D' creates Asymptote figures:
>> Graphics3D[Sphere[]] // TeXForm
= #<--#
. \begin{asy}
. import three;
. import solids;
. size(6.6667cm, 6.6667cm);
. currentprojection=perspective(2.6,-4.8,4.0);
. currentlight=light(rgb(0.5,0.5,1), specular=red, (2,0,2), (2,2,2), (0,2,2));
. // Sphere3DBox
. draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1));
. draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,1)--(1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,-1)--(-1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,1)--(-1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,-1)--(-1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,-1)--(1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,-1)--(-1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,1,-1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. \end{asy}

#> Graphics3D[Point[Table[{Sin[t], Cos[t], 0}, {t, 0, 2. Pi, Pi / 15.}]]] // TeXForm
= #<--#
. \begin{asy}
. import three;
. import solids;
. size(6.6667cm, 6.6667cm);
. currentprojection=perspective(2.6,-4.8,4.0);
. currentlight=light(rgb(0.5,0.5,1), specular=red, (2,0,2), (2,2,2), (0,2,2));
. // Point3DBox
. path3 g=(0,1,0)--(0.20791,0.97815,0)--(0.40674,0.91355,0)--(0.58779,0.80902,0)--(0.74314,0.66913,0)--(0.86603,0.5,0)--(0.95106,0.30902,0)--(0.99452,0.10453,0)--(0.99452,-0.10453,0)--(0.95106,-0.30902,0)--(0.86603,-0.5,0)--(0.74314,-0.66913,0)--(0.58779,-0.80902,0)--(0.40674,-0.91355,0)--(0.20791,-0.97815,0)--(5.6655e-16,-1,0)--(-0.20791,-0.97815,0)--(-0.40674,-0.91355,0)--(-0.58779,-0.80902,0)--(-0.74314,-0.66913,0)--(-0.86603,-0.5,0)--(-0.95106,-0.30902,0)--(-0.99452,-0.10453,0)--(-0.99452,0.10453,0)--(-0.95106,0.30902,0)--(-0.86603,0.5,0)--(-0.74314,0.66913,0)--(-0.58779,0.80902,0)--(-0.40674,0.91355,0)--(-0.20791,0.97815,0)--(1.5314e-15,1,0)--cycle;dot(g, rgb(0, 0, 0));
. draw(((-0.99452,-1,-1)--(0.99452,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,-1)--(0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,1)--(0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,-1)--(-0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,-1)--(0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,1)--(-0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,-1)--(-0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,-1)--(0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,-1)--(-0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,1,-1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. \end{asy}
<url>:WMA link:https://reference.wolfram.com/language/ref/Graphics3D.html</url>

<dl>
<dt>'Graphics3D[$primitives$, $options$]'
<dd>represents a three-dimensional graphic.

See also the <url>:Drawing Option and Option Values:
/doc/reference-of-built-in-symbols/drawing-options-and-option-values
</url> for a list of Plot options.
</dl>

>> Graphics3D[Polygon[{{0,0,0}, {0,1,1}, {1,0,0}}]]
= -Graphics3D-

In 'TeXForm', 'Graphics3D' creates Asymptote figures:
>> Graphics3D[Sphere[]] // TeXForm
= #<--#
. \begin{asy}
. import three;
. import solids;
. size(6.6667cm, 6.6667cm);
. currentprojection=perspective(2.6,-4.8,4.0);
. currentlight=light(rgb(0.5,0.5,1), specular=red, (2,0,2), (2,2,2), (0,2,2));
. // Sphere3DBox
. draw(surface(sphere((0, 0, 0), 1)), rgb(1,1,1)+opacity(1));
. draw(((-1,-1,-1)--(1,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,1)--(1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,-1)--(-1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,-1)--(1,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,1)--(-1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,-1,-1)--(-1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,-1,-1)--(1,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-1,1,-1)--(-1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((1,1,-1)--(1,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. \end{asy}

#> Graphics3D[Point[Table[{Sin[t], Cos[t], 0}, {t, 0, 2. Pi, Pi / 15.}]]] // TeXForm
= #<--#
. \begin{asy}
. import three;
. import solids;
. size(6.6667cm, 6.6667cm);
. currentprojection=perspective(2.6,-4.8,4.0);
. currentlight=light(rgb(0.5,0.5,1), specular=red, (2,0,2), (2,2,2), (0,2,2));
. // Point3DBox
. path3 g=(0,1,0)--(0.20791,0.97815,0)--(0.40674,0.91355,0)--(0.58779,0.80902,0)--(0.74314,0.66913,0)--(0.86603,0.5,0)--(0.95106,0.30902,0)--(0.99452,0.10453,0)--(0.99452,-0.10453,0)--(0.95106,-0.30902,0)--(0.86603,-0.5,0)--(0.74314,-0.66913,0)--(0.58779,-0.80902,0)--(0.40674,-0.91355,0)--(0.20791,-0.97815,0)--(5.6655e-16,-1,0)--(-0.20791,-0.97815,0)--(-0.40674,-0.91355,0)--(-0.58779,-0.80902,0)--(-0.74314,-0.66913,0)--(-0.86603,-0.5,0)--(-0.95106,-0.30902,0)--(-0.99452,-0.10453,0)--(-0.99452,0.10453,0)--(-0.95106,0.30902,0)--(-0.86603,0.5,0)--(-0.74314,0.66913,0)--(-0.58779,0.80902,0)--(-0.40674,0.91355,0)--(-0.20791,0.97815,0)--(1.5314e-15,1,0)--cycle;dot(g, rgb(0, 0, 0));
. draw(((-0.99452,-1,-1)--(0.99452,-1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,-1)--(0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,1)--(0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,-1)--(-0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,-1)--(0.99452,1,-1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,1)--(-0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,-1,-1)--(-0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,-1,-1)--(0.99452,-1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((-0.99452,1,-1)--(-0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. draw(((0.99452,1,-1)--(0.99452,1,1)), rgb(0.4, 0.4, 0.4)+linewidth(1));
. \end{asy}
"""
summary_text = "a three-dimensional graphics image wrapper"
options = Graphics.options.copy()
Expand Down
Loading