Archivio autore: juhan

Maxima – 87- Polinomi – funzioni e variabili – 1

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.265.

Default value: false.

algebraic must be set to true in order for the simplification of algebraic integers to take effect.

Default value: true.

When berlefact is false then the Kronecker factoring algorithm will be used otherwise the Berlekamp algorithm, which is the default, will be used.

bezout (p1, p2, x)
an alternative to the resultant command. It returns a matrix. determinant of this matrix is the desired resultant.

(%i1) bezout(a*x+b, c*x^2+d, x);
                                [ b c  - a d ]
(%o1)                           [            ]
                                [  a     b   ]
(%i2) determinant(%);
                                   2      2
(%o2)                             a  d + b  c
(%i3) resultant(a*x+b, c*x^2+d, x);
                                   2      2
(%o3)                             a  d + b  c

bothcoef (expr, x)
Returns a list whose first member is the coefficient of x in expr (as found by ratcoef if expr is in CRE form otherwise by coeff) and whose second member is the remaining part of expr. That is, [A, B] where expr = A*x + B.

(%i4) islinear (expr, x) := block ([c],
                           c: bothcoef (rat (expr, x), x),
                           is (freeof (x, c) and c[1] # 0))$

(%i5) islinear ((r^2 - (x - r)^2)/x, x);
(%o5)                                true

coeff (expr, x, n)
coeff (expr, x)
Returns the coefficient of x^n in expr, where expr is a polynomial or a monomial term in x. Other than ratcoef coeff is a strictly syntactical operation and will only find literal instances of x^n in the internal representation of expr.

coeff(expr, x^n) is equivalent to coeff(expr, x, n). coeff(expr, x, 0) returns the remainder of expr which is free of x. If omitted, n is assumed to be 1.

x may be a simple variable or a subscripted variable, or a subexpression of expr which comprises an operator and all of its arguments.

It may be possible to compute coefficients of expressions which are equivalent to expr by applying expand or factor. coeff itself does not apply expand or factor or any other function.

coeff distributes over lists, matrices, and equations.

See also ratcoef.

coeff returns the coefficient x^n in expr.

(%i6) coeff (b^3*a^3 + b^2*a^2 + b*a + 1, a^3);
(%o6)                                 b

coeff(expr, x^n) is equivalent to coeff(expr, x, n).

(%i7) coeff (c[4]*z^4 - c[3]*z^3 - c[2]*z^2 + c[1]*z, z, 3);
(%o7)                                - c
(%i8) coeff (c[4]*z^4 - c[3]*z^3 - c[2]*z^2 + c[1]*z, z^3);
(%o8)                                - c

coeff(expr, x, 0) returns the remainder of expr which is free of x.

(%i9) coeff (a*u + b^2*u^2 + c^3*u^3, b, 0);
                                   3  3
(%o9)                             c  u  + a u

x may be a simple variable or a subscripted variable, or a subexpression of expr which comprises an operator and all of its arguments.

(%i10) coeff (h^4 - 2*%pi*h^2 + 1, h, 2);
(%o10)                              - 2 %pi
(%i11) coeff (v[1]^4 - 2*%pi*v[1]^2 + 1, v[1], 2);
(%o11)                              - 2 %pi
(%i12) coeff (sin(1+x)*sin(x) + sin(1+x)^3*sin(x)^3, sin(1+x)^3);
(%o12)                              sin (x)
(%i13) coeff ((d - a)^2*(b + c)^3 + (a + b)^4*(c - d), a + b, 4);
(%o13)                               c - d

coeff itself does not apply expand or factor or any other function.

(%i14) coeff (c*(a + b)^3, a);
(%o14)                                 0
(%i15) expand (c*(a + b)^3);
                        3          2        2        3
(%o15)                 b  c + 3 a b  c + 3 a  b c + a  c
(%i16) coeff (%, a);
(%o16)                              3 b  c
(%i17) coeff (b^3*c + 3*a*b^2*c + 3*a^2*b*c + a^3*c, (a + b)^3);
(%o17)                                 0
(%i18) factor (b^3*c + 3*a*b^2*c + 3*a^2*b*c + a^3*c);
(%o18)                            (b + a)  c
(%i19) coeff (%, (a + b)^3);
(%o19)                                 c

coeff distributes over lists, matrices, and equations.

(%i20) coeff ([4*a, -3*a, 2*a], a);
(%o20)                            [4, - 3, 2]
(%i21) coeff (matrix ([a*x, b*x], [-c*x, -d*x]), x);
                                 [  a    b  ]
(%o21)                           [          ]
                                 [ - c  - d ]
(%i22) coeff (a*u - b*v = 7*u + 3*v, u);
(%o22)                               a = 7

AI, innovazioni e blockchain – 44

Ubuntu nuovo, da aggiornare, appena recupero il ritardo, no prima ma intanto ecco qua 😁

Il Monviso fotografato da Bergamo – Valerio Minato

NIST “do you need a blockchain flowchart”
blockchain e crypto*
::: justincormack

The Cryptocurrency Industry is ‘On the Brink of an Implosion’, Research Says
blockchain e crypto*
::: Slashdot

Don’t look now, but @BostonDynamics’ robot Atlas is back. And now it can do parkour

AI has already begun rewiring warfare, even if it hasn’t (yet) taken the form of literal Terminators. There are less cinematic but equally scary ways to weaponize AI. You don’t need algorithms pulling the trigger for algorithms to play a dangerous role
artificial intelligence
::: FrankPasquale

The US Military Wants To Teach AI Some Basic Common Sense
artificial intelligence
::: Slashdot

Researchers Develop 3D Printed Objects That Can Track and Store How They Are Used
innovazioni, futuro
::: Slashdot

I just don’t know what to make of this blockchain crowd. They are either complete lunatics, or they will change the world
blockchain e crypto*
::: marcelsalathe

The UK Invited a Robot To ‘Give Evidence’ In Parliament For Attention
::: Slashdot

Google AI Claims 99 Percent Accuracy In Metastatic Breast Cancer Detection
artificial intelligence
::: Slashdot

L’involontaria ed inconsapevole ironia del titolo di questo articolo è stupenda
blockchain e crypto*
::: stefanoepifani

Samsung Says Its Foldable Phone Will Be a Tablet You Can Put In Your Pocket
dispositivi mobili
::: Slashdot ::: Slashdot

AI ethics and human rights: where we need to go
artificial intelligence
::: sherifea

Far morire i bitcoin dovrebbe essere un dovere civico: per l’ambiente e l’energia assurda che consumano, non solo per l’economia (e la politica malamente finanziata)
blockchain e crypto*
::: jacopo_iacoboni

DARPA, the arm of the Pentagon that gave us drones and the internet, is researching technology to let soldiers download memories to their brains
innovazioni, futuro
::: emenietti

If you’ve always wanted to play around with quantum computing, here’s your chance
quantum computing
::: IEEESpectrum

Start talking about where data come from, what is being measured and why, who is labelling the data, and how AI is only as good as the data it’s trained on
dati, raccolta | artificial intelligence
::: andrewthesmart

Rivals ARM and Intel Make Peace To Secure Internet of Things
Internet of things
::: Slashdot

Will China beat the United States to develop the best and brightest #AI?
Former Head of Google China Foresees an AI Crisis—and Proposes a Solution
artificial intelligence
::: IEEESpectrum

Blockchain has been heralded as a potential panacea for everything from poverty and famine to cancer
blockchain e crypto*
::: fabiochiusi

Jeff Bezos Predicts We’ll Have 1 Trillion Humans in the Solar System, and Blue Origin Wants To Help Get Us There
protagonisti | innovazioni, futuro
::: Slashdot

Most Americans Can’t Tell the Difference Between a Social Media Bot and A Human, Study Finds
web-bot | social media
::: Slashdot

Welcome to the World of Tomorrow
tutto il thread
storia | innovazioni, futuro
::: adrianhon

MIT today announced a new $1 billion commitment to address the global opportunities and challenges presented by the prevalence of computing and the rise of artificial intelligence
artificial intelligence
::: fabiochiusi

Sony Tries Using Blockchain Tech For Next-Gen DRM
blockchain e crypto*
::: Slashdot


Eta Compute says it has made the first commercial low-power #AI chip capable of learning on its own by using spiking neural networks
machine learning
::: IEEESpectrum ::: IEEESpectrum ::: IEEESpectrum

Rolls-Royce Wants To Fill the Seas With Self-Sailing Ships
innovazioni, futuro
::: Slashdot

Stephen Hawking Warns That AI and ‘Superhumans’ Could Wipe Humanity; Says There’s No God in Posthumous Book
artificial intelligence | innovazioni, futuro
::: Slashdot

Nobel-prize winner Rommer on innovation and higher education
innovazioni, futuro
::: lemire

Google Maps Adds EV Charging Station Info
innovazioni, futuro
::: Slashdot

This research marks the first time that any type of #AI has been incorporated into a MEMs device
artificial intelligence
::: IEEESpectrum

Optimism about the potential benefits of AI has dropped significantly among those who are actually developing AI systems
artificial intelligence
::: FrankPasquale

We started just with a business plan, a financial model and kind of a hope that our $19 million that we raised from—you know—friends and family would someday, maybe create a little company that could own a few buildings
una storia di innovazione fu8ori dal comune; ispirazionale?
innovazioni, futuro
::: danking00

The AI ethics body formed by five of the largest US corporations has expanded to include its first Chinese member, the search firm Baidu
artificial intelligence
::: fabiochiusi

Some Electric Car Drivers Might Spew More CO2 Than Diesel Cars, New Research Shows
innovazioni, futuro
::: Slashdot

Finally, all of the world’s coolest and most interesting #Robots are in one place: Congrats to @robotsapp on launch day!! 🤖❤️🤖❤️🤖
::: newsbeagle

In @qz, Personal Robots group head @cynthiabreazeal looks into the future of humanistic, social robots—beyond Rosie, Skynet, and R2D2
::: medialab

Someone Used a Deep Learning AI To Perfectly Insert Harrison Ford Into “Solo: A Star Wars Story”
deep learning
::: Slashdot

Alum @strausfeld is working to create a new #dataviz paradigm: a VR-explorable, 3D map of network connections—starting with a timeline of women’s history
virtual reality
::: medialab

Driverless Car Hype Gives Way To E-Scooter Mania Among Technorati
automazione | innovazioni, futuro
::: Slashdot

Former Top Waymo Engineer Altered Code To Go on ‘Forbidden Routes’, Report Says
::: Slashdot

Neutrino is a new bitcoin light client that enables Lightning to run on mobile phones
blockchain e crypto*
::: lightning

$194 million of Bitcoin was moved today for only $0.10
blockchain e crypto* | Web, Internet
::: ColeKennelly

The 5th Wave of computing will make traditional ways of measuring computing power obsolete, says the CEO of Arm
innovazioni, futuro
::: IEEESpectrum

Chinese City ‘Plans To Launch Artificial Moon To Replace Streetlights’
innovazioni, futuro
::: Slashdot

Governing Artificial Intelligence | Data & Society
artificial intelligence | dati, raccolta
::: Dunja_Mijatovic

I just posted “L’intelligenza artificiale per studiare il plancton” on Reddit
artificial intelligence
::: RadioProzac

You’ve heard about the ethics of #AI, but have you thought about the impact of AI on human rights? A team from @BKCHarvard considered the risks & benefits of AI on human rights in this new report
artificial intelligence
::: BKCHarvard

La copertina di SICP

Aggiornamento, correzioni: vedi in fondo, grazie a Luis Souto Graña.

Per me ha cominciato Michael con questo tweet. Un umanista ma che segue anche cose —ahemmm…— interessanti. No, aspetta Professor of Digital Humanities, chissà cos’è, mi devo aggiornare 😐 Non gli è sfuggito 0b10 (TwoBit) che si occupa di storia, ah! tout se tient.

Michael Piotrowski cita Raimondo Lullo, questo qui e qui.

OK, siamo un po’ fuori dalla programmazione corrente ma oggi mi va di  indagare  sbirciarci dentro, ecco 🤩

Di TwoBit me n’ero già accorto e l’ho anche messo nella rassegna Visto nel Web ma –come detto– approfondisco. Anche perché c’è xkcd, McCarthy, l’inizio del tutto e cose solo sentite di seconda mano (e seconda lingua) quando ero giovane, complice Douglas Hofstadter, quello di GEB (che, strano, non viene citato, la mia storia è solo mia).

Bravo Luis Souto Graña (spectrumgomas) che ci illumina: They aren’t a wizard and a woman. They are Hermes Trismegistus and Ramon Llull.
Luis ogni volta che lo ritrovo su Twitter mi sento in colpa per via di Mastodon, Guile e adesso scopro anche G+ 😐

Kudos @ Benjamin Breen che ne sa di queste cose, la salamandra finora nessuno l’ha citata, nella copertina di SICP non c’è. Uh! prof anche lui, Assistant professor @UCSC working on the history of drugs, technology, and globalization. Quante cose ci sono tra il cielo e la terra che –OK, inizio cit. personalizzata. Avendo tempo il suo blog, Res Obscura

+++Brekki-Niù+++ scopro proprio ora che 0b10 ha un nome (Sinclair Target), un about esplicativo e un altro account Twitter, poco usato ma sexyassay. Futuro prof anche lui 🤩
Sinclair rivela che con il misticismo Lisp ci si può spingere ben oltre (vedetevelo voi, io non ho il coraggio).
Ma risponde Luis, è uno scherzo, è Athanasius Kircher e l’Edipus AEgypticus. E, sempre nello stesso thread entra Matthew Alhonte controllate la copertina del libro (l’ultimo citato, non il SICP); uh! analisi bayesiana, fuggo via.

Tornando alla salamandra arriva Vriese – Hans Vredeman de Vries.

E quando il gioco si fa duro (inizio.cit) arriva Pancicz Godek, apre un altro filone, con altri commentatori.

Qui smetto perché –confesso– mi sono un po’ perso, anzi tanto, completamente. E se qualcuno ha letto anche lui 😐 Ma terrei a far sapere che posso smettere quando voglio 😐 probabilmente 😐 Ma davvero ci tenevo tanto a metterlo giù per iscritto, metti che quando sarò vecchio… 😐

Aggiornamento: Luis @spectrumgomas mi fa notare che ho fatto un po’ di confusione, saltata l’attribuzione a Arno Bosse (da followare, impo), e i riferimenti classici 😐.

In particolare Plinio, questo tweet non l’avevo visto, ha ragione Luis devo fare più attenzione.

E quindi il Lisp (Scheme): the dual nature of knowledge: dangerous […], but also enlightening […]; sì il Lisp è diverso, migliore –anche se può essere pericoloso ( a volte mi guardano male se lo nomino).

Maxima – 86- Polinomi – introduzione

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.265.

Polynomials are stored in Maxima either in General Form or as Canonical Rational Expressions (CRE) form. The latter is a standard form, and is used internally by operations such as factor, ratsimp, and so on.

Canonical Rational Expressions constitute a kind of representation which is especially suitable for expanded polynomials and rational functions (as well as for partially factored polynomials and rational functions when RATFAC is set to true).

In this CRE form an ordering of variables (from most to least main) is assumed for each expression. Polynomials are represented recursively by a list consisting of the main variable followed by a series of pairs of expressions, one for each term of the polynomial. The first member of each pair is the exponent of the main variable in that term and the second member is the coefficient of that term which could be a number or a polynomial in another variable again represented in this form. Thus the principal part of the CRE form of 3*X^2-1 is (X 2 3 0 -1) and that of 2*X*Y+X-3 is (Y 1 (X 1 2) 0 (X 1 1 0 -3)) assuming Y is the main variable, and is (X 1 (Y 1 2 0 1) 0 -3) assuming X is the main variable.

“Main”-ness is usually determined by reverse alphabetical order. The “variables” of a CRE expression needn’t be atomic. In fact any subexpression whose main operator is not §§+ – * / or ^ with integer power will be considered a “variable” of the expression (in CRE form) in which it occurs. For example the CRE variables of the expression X+SIN(X+1)+2*SQRT(X)+1 are X, SQRT(X), and SIN(X+1). If the user does not specify an ordering of variables by using the RATVARS function Maxima will choose an alphabetic one. In general, CRE’s represent rational expressions, that is, ratios of polynomials, where the numerator and denominator have no common factors, and the denominator is positive.

The internal form is essentially a pair of polynomials (the numerator and denominator) preceded by the variable ordering list. If an expression to be displayed is in CRE form or if it contains any subexpressions in CRE form, the symbol /R/ will follow the line label. See the RAT function for converting an expression to CRE form. An extended CRE form is used for the representation of Taylor series. The notion of a rational expression is extended so that the exponents of the variables can be positive or negative rational numbers rather than just positive integers and the coefficients can themselves be rational expressions as described above rather than just polynomials. These are represented internally by a recursive polynomial form which is similar to and is a generalization of CRE form, but carries additional information such as the degree of truncation. As with CRE form, the symbol /T/ follows the line label of such expressions.

Maxima – 85- Files di input e output – funzioni e variabili per l’output del Fortran

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.262.

Default value: 0.
fortindent controls the left margin indentation of expressions printed out by the fortran command. 0 gives normal printout (i.e., 6 spaces), and positive values will causes the expressions to be printed farther to the right.

fortran (expr)
Prints expr as a Fortran statement. The output line is indented with spaces. If the line is too long, fortran prints continuation lines. fortran prints the exponentiation operator ^ as **, and prints a complex number a + b %i in the form (a,b).

expr may be an equation. If so, fortran prints an assignment statement, assigning the right-hand side of the equation to the left-hand side. In particular, if the right-hand side of expr is the name of a matrix, then fortran prints an assignment statement for each element of the matrix.

If expr is not something recognized by fortran, the expression is printed in grind format without complaint. fortran does not know about lists, arrays, or functions.

fortindent controls the left margin of the printed lines. 0 is the normal margin (i.e., indented 6 spaces). Increasing fortindent causes expressions to be printed further to the right.

When fortspaces is true, fortran fills out each printed line with spaces to 80 columns.

fortran evaluates its arguments; quoting an argument defeats evaluation. fortran always returns done.

See also the function f90, for printing one or more expressions as a Fortran 90 program.

(%i1) expr: (a + b)^12$

(%i2) fortran (expr);
(%o2)                                done
(%i3) fortran ('x=expand (expr));
      x = b**12+12*a*b**11+66*a**2*b**10+220*a**3*b**9+495*a**4*b**8+792
     1   *a**5*b**7+924*a**6*b**6+792*a**7*b**5+495*a**8*b**4+220*a**9*b
     2   **3+66*a**10*b**2+12*a**11*b+a**12
(%o3)                                done
(%i4) fortran ('x=7+5*%i);
      x = (7,5)
(%o4)                                done
(%i5) fortran ('x=[1,2,3,4]);
      x(1) = 1
      x(2) = 2
      x(3) = 3
      x(4) = 4
(%o5)                                done
(%i6) f(x) := x^2$

(%i7) fortran (f);
(%o7)                                done

Default value: false.

When fortspaces is true, fortran fills out each printed line with spaces to 80 columns.

Averlo avuto 30+ anni orsono! Per esempio ho un integrale di quelli non banali mi faccio calcolare l’espressione pronta per copiarla e inserirla nel mio programma. Oggi nessuno conosce più il Fortran, tranne me (io) 😐

cit. & loll – 118

Ecco a voi la rassegna più –OK, la solita 😉

The Depressed Developer 37
::: {}

“In the past 12 months Americans have searched for Python on Google more often than for Kim Kardashian” – The Economist
::: nicolaiarocci

I was an ordinary person
::: ProfFeynman

What you’re supposed to do when you don’t like a thing is change it
::: MauroV1968

Sometimes you run into websites that time forgot. Today’s example:
uh! su ‘buntu c’è xeyes, lanciato, lanciatelo
::: mikkotweets2013

No, a “blockchain” will not help you trace your bananas
::: federicopaesano

If you’re not having fun, you’re not learning
::: ProfFeynman

Quando trovi un bivio sulla tua strada
::: MauroV1968

Visited the O’Reilly site for the first time in a while. There’s no indication on the front page that they publish books
::: JohnDCook

Structured programming didn’t just take away goto statements; it took away your /need/ for goto statements
::: FunctorFact

Up, up and up we go! Every single mile we drive helps us refine our fully self-driving technology and bring it to even more people and places
::: Waymo

Compiled languages are more kid-friendly
::: RichRogersIoT

Burj Al Arab

What does NLP make you think of?
::: JohnDCook

::: Genjuro75

Comic for October 12, 2018
::: ow2541

Maglie che possono tornare utili
::: Kevin2600

Regardless of our Divine Name, bless all these other programming languages
::: memecrashes

At the end of the day, your attention is the only resource you can allocate
::: fchollet

I like to find
::: JohnDCook

Programming is another way to teach the world that
::: CodeWisdom

Open source
::: justincormack

It’s odd that many refer to machine learning also as “algorithmic intelligence”
::: mariofusco

::: nixcraft

La risposta definitiva a tutto
::: brunomastro

Einstein Yukawa Wheeler Bhabha

Student in office hours: So what is Microsoft Excel?
quelli che conosco io chiamano “Excel” anche il foglio di calcolo di Libre Office; e per qualcuno è l’altra app del ‘puter
::: colin_jemmott

New thing: Twitter is inserting typos in conservative tweets
::: RespectableLaw

why I prefer Linux, in a nutshell
::: WebReflection

Western Union responding to Alexander Graham Bell’s offer of a telephone patent for $100,000, 1876
::: cryptospaced

Advice to my younger self: remember how big you’re dreaming now. Don’t scale back just because some people tell you life is hard
::: jeanqasaur

Just a majestically incomprehensible error message from my new sous vide gadget
::: CaseyNewton

::: ZonePhysics

If you want to become an expert one day, you should not get started by learning from amateurs
::: fchollet

Speaking of funny compiler warnings This gcc one is one of my favorite
::: shafikyaghmour

To iterate is human
::: RichRogersIoT

Concurrency is like an evil sauce
nope nèh!
::: redsymbol

TeX e LaTeX a confronto

La mia domanda “TeX e LaTeX sono compatibili?” [qui] è mooolto mal posta, anzi priva di senso, vado a lavarmi i diti e la testiera con il sapone, ecco 😐

Per fortuna c’è  Google  DuckDuckGo 🤩

What is the difference between TeX and LaTeX? [qui]

TeX is both a program (which does the typesetting, tex-core) and format (a set of macros that the engine uses, plain-tex). Looked at in either way, TeX gives you the basics only. If you read the source for The TeXBook, you’ll see that Knuth wrote more macros to be able to typeset the book, and made a format for that.

LaTeX is a generalised set of macros to let you do many things. Most people don’t want to have to program TeX, especially to set up things like sections, title pages, bibliographies and so on. LaTeX provides all of that: these are the ‘macros’ that it is made up of.

Quindi, sintetizzando per me: il testo TeX è (almeno per quanto concerne Maxima e me) conforme a quanto si aspetta LaTeX. Ecco perché tutti (OK, quasi tutti) quelli che conosco usano LaTeX.

Proseguendo con i documenti trovati ecco The difference between TeX and LaTeX [qui]. È roba macista ma who cares? E dice:

[… W]hen you type LaTeX you are running TeX, but before it loads your LaTeX source it first loads the latex.ltx file, which defines all the familiar \section, \documentclass, \begin, \end, \ref, \label, … commands familiar to LaTeX users.

Ricorda poi che ci sono altre varianti ancora, per me adesso: who cares 😐

Una  googlata  ddg-ata per questo tipo di query non è completa se manca Quora && Stack Overflow, quindi…

What’s the difference between TeX and LaTeX? [qui].

LaTeX is a user-friendly extension of TeX. Sort of. Let me explain. C’è di là, non riporto anche se breve (ma con tanti link invoglianti). Anche perché, per chi volesse My book “TeX by Topic”, published in 1991, is a free download, and back in print.

Si diceva della famiglia TeX, eccola qui.

E Stack Overflow che ho promesso? C’è qui, topic chiuso per OT ma con una rimarchevole dritta: “Learn TeX only if you would like to become a typesetter“. E anche qui una marea di links.

Conclusione per la mia domanda malposta: , per quanto riguarda Maxima e me TeX e LaTeX accettano gli stessi files. (OK, risposta che a rigore non è corretta, TeX non è quello (a rigore), sono pressapochista) 😐 Ma sì.

Maxima – 84 – Files di input e output – funzioni e variabili per l’output di TeX

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.257.

Nota urgente per me: devo verificare se TeX e LaTeX sono compatibili o quali sono le differenze. Confido nella compatibilità ma chissà… 🤔

Note that the built-in TeX output functionality of wxMaxima makes no use of the functions described here but uses its own implementation instead.

tex (expr)
tex (expr, destination)
tex (expr, false)
tex (label)
tex (label, destination)
tex (label, false)
Prints a representation of an expression suitable for the TeX document preparation system. The result is a fragment of a document, which can be copied into a larger document but not processed by itself.

tex(expr) prints a TeX representation of expr on the console.

tex(label) prints a TeX representation of the expression named by label and assigns it an equation label (to be displayed to the left of the expression). The TeX equation label is the same as the Maxima label.

destination may be an output stream or file name. When destination is a file name, tex appends its output to the file. The functions openw and opena create output streams.

tex(expr, false) and tex(label, false) return their TeX output as a string.

tex evaluates its first argument after testing it to see if it is a label. Quote-quote '' forces evaluation of the argument, thereby defeating the test and preventing the label. See also texput.

(%i1) integrate (1/(1+x^3), x);
                                          2 x - 1
                       2             atan(-------)
                  log(x  - x + 1)         sqrt(3)    log(x + 1)
(%o1)          (- ---------------) + ------------- + ----------
                         6              sqrt(3)          3
(%i2) tex (%o1);
$$-{{\log \left(x^2-x+1\right)}\over{6}}+{{\arctan \left({{2\,x-1
 }\over{\sqrt{3}}}\right)}\over{\sqrt{3}}}+{{\log \left(x+1\right)
 }\over{3}}\leqno{\tt (\%o1)}$$
(%o2)                               (\%o1)
(%i3) tex (integrate (sin(x), x));
$$-\cos x$$
(%o3)                                false
(%i4) tex (%o1, "foo.tex");
(%o4)                               (\%o1)

Sì, compatibile

tex(expr, false) returns its TeX output as a string.

(%i5) S : tex (x * y * z, false);
(%o5) $$x\,y\,z$$
(%i6) S;
(%o6) $$x\,y\,z$$

tex1 (e)
Returns a string which represents the TeX output for the expressions e. The TeX output is not enclosed in delimiters for an equation or any other environment.

(%i7) tex1 (sin(x) + cos(x));
(%o7)                            \sin x+\cos x

texput (a, s)
texput (a, f)
texput (a, s, operator_type)
texput (a, [s_1, s_2], matchfix)
texput (a, [s_1, s_2, s_3], matchfix)
Assign the TeX output for the atom a, which can be a symbol or the name of an operator.

texput(a, s) causes the tex function to interpolate the string s into the TeX output in place of a.

texput(a, f) causes the tex function to call the function f to generate TeX output. f must accept one argument, which is an expression which has operator a, and must return a string (the TeX output). f may call tex1 to generate TeX output for the arguments of the input expression.

texput(a, s, operator_type), where operator_type is prefix, infix, postfix, nary, or nofix, causes the tex function to interpolate s into the TeX output in place of a, and to place the interpolated text in the appropriate position.

texput(a, [s_1, s_2], matchfix) causes the tex function to interpolate s_1 and s_2 into the TeX output on either side of the arguments of a. The arguments (if more than one) are separated by commas.

texput(a, [s_1, s_2, s_3], matchfix) causes the tex function to interpolate s_1 and s_2 into the TeX output on either side of the arguments of a, with s_3 separating the arguments.

Assign TeX output for a variable.

(%i8) texput (me,"\\mu_e");
(%o8)                                \mu_e
(%i9) tex (me);
(%o9)                                false

Assign TeX output for an ordinary function (not an operator).

(%i10) texput (lcm, "\\mathrm{lcm}");
(%o10)                           \mathrm{lcm}
(%i11) tex (lcm (a, b));
$$\mathrm{lcm}\left(a , b\right)$$
(%o11)                               false

Call a function to generate TeX output.

(%i12) texfoo (e) := block ([a, b], [a, b] : args (e),

(%i13) texput (foo, texfoo);
(%o13)                              texfoo
(%i14) tex (foo (2^x, %pi));
(%o14)                               false

Assign TeX output for a prefix operator.

(%i15) prefix ("grad");
(%o15)                               grad
(%i16) texput ("grad", " \\nabla ", prefix);
(%o16)                              \nabla
(%i17) tex (grad f);
$$ \nabla f$$
(%o17)                               false

Assign TeX output for an infix operator.

(%i18) infix ("~");
(%o18)                                 ~
(%i19) texput ("~", " \\times ", infix);
(%o19)                              \times
(%i20) tex (a ~ b);
$$a \times b$$
(%o20)                               false

Assign TeX output for a postfix operator.

(%i21) postfix ("##");
(%o21)                                ##
(%i22) texput ("##", "!!", postfix);
(%o22)                                !!
(%i23) tex (x ##);
(%o23)                               false

Assign TeX output for a nary operator.

(%i24) nary ("@@");
(%o24)                                @@
(%i25) texput ("@@", " \\circ ", nary);
(%o25)                               \circ
(%i26) tex (a @@ b @@ c @@ d);
$$a \circ b \circ c \circ d$$
(%o26)                               false

Assign TeX output for a nofix operator.

(%i27) nofix ("foo");
(%o27)                                foo
(%i28) texput ("foo", "\\mathsc{foo}", nofix);
(%o28)                           \mathsc{foo}
(%i29) tex (foo);
(%o29)                               false

Assign TeX output for a matchfix operator.

(%i30) matchfix ("<<", ">>");
(%o30)                                <<
(%i31) texput ("<<", [" \\langle ", " \\rangle "], matchfix);
(%o31)                      [ \langle ,  \rangle ]
(%i32) tex (<>);
$$ \langle a \rangle $$
(%o32)                               false
(%i33) tex (<<a, b>>);
$$ \langle a , b \rangle $$
(%o33)                               false
(%i34) texput ("<<", [" \\langle ", " \\rangle ", " \\, | \\,"], matchfix);
(%o34)                 [ \langle ,  \rangle ,  \, | \,]
(%i35) tex (<>);
$$ \langle a \rangle $$
(%o35)                               false
(%i36) tex (<<a, b>>);
$$ \langle a \, | \,b \rangle $$
(%o36)                               false

get_tex_environment (op)
set_tex_environment (op, before, after)
Customize the TeX environment output by tex. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

Only the TeX environment of the top-level operator in an expression is output; TeX environments associated with other operators are ignored.

get_tex_environment returns the TeX environment which is applied to the operator op; returns the default if no other environment has been assigned.

set_tex_environment assigns the TeX environment for the operator op.

(%i37) get_tex_environment (":=");
(%o37) [
, ;
(%i38) tex (f (x) := 1 - x);


(%o38)                               false
(%i39) set_tex_environment (":=", "$$", "$$");
(%o39)                             [$$, $$]
(%i40) tex (f (x) := 1 - x);
(%o40)                               false

get_tex_environment_default ()
get_tex_environment_default (before, after)
Customize the TeX environment output by tex. As maintained by these functions, the TeX environment comprises two strings: one is printed before any other TeX output, and the other is printed after.

get_tex_environment_default returns the TeX environment which is applied to expressions for which the top-level operator has no specific TeX environment (as assigned by set_tex_environment).

set_tex_environment_default assigns the default TeX environment.

(%i41) get_tex_environment_default ();
(%o41)                             [$$, $$]
(%i42) tex (f(x) + g(x));
(%o42)                               false
(%i43) set_tex_environment_default ("\\begin{equation}
", "
(%o43) [\begin{equation}
(%i44) tex (f(x) + g(x));
(%o44)                               false

Maxima – 83 – Files di input e output – funzioni e variabili – 3

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.255.

save (filename, name_1, name_2, name_3, ...)
save (filename, values, functions, labels, ...)
save (filename, [m, n])
save (filename, name_1=expr_1, ...)
save (filename, all)
save (filename, name_1=expr_1, name_2=expr_2, ...)
Stores the current values of name_1, name_2, name_3, ..., in filename. The arguments are the names of variables, functions, or other objects. If a name has no value or function associated with it, it is ignored. save returns filename.

save stores data in the form of Lisp expressions. If filename ends in .lisp the data stored by save may be recovered by load(filename). See load.

The global flag file_output_append governs whether save appends or truncates the output file. When file_output_append is true, save appends to the output file. Otherwise, save truncates the output file. In either case, save creates the file if it does not yet exist.

The special form save(filename, values, functions, labels, ...) stores the items named by values, functions, labels, etc. The names may be any specified by the variable infolists. values comprises all user-defined variables.

The special form save(filename, [m, n]) stores the values of input and output labels m through n. Note that m and n must be literal integers. Input and output labels may also be stored one by one, e.g., save("foo.1", %i42, %o42). save(filename, labels) stores all input and output labels. When the stored labels are recovered, they clobber existing labels.

The special form save(filename, name_1=expr_1, name_2=expr_2, ...) stores the values of expr_1, expr_2, ..., with names name_1, name_2, …. It is useful to apply this form to input and output labels, e.g., save("foo.1", aa=%o88). The right-hand side of the equality in this form may be any expression, which is evaluated. This form does not introduce the new names into the current Maxima environment, but only stores them in filename.

These special forms and the general form of save may be mixed at will. For example, save(filename, aa, bb, cc=42, functions, [11, 17]).

The special form save(filename, all) stores the current state of Maxima. This includes all user-defined variables, functions, arrays, etc., as well as some automatically defined items. The saved items include system variables, such as file_search_maxima or showtime, if they have been assigned new values by the user; see myoptions.

save evaluates filename and quotes all other arguments.

stringout (filename, expr_1, expr_2, expr_3, ...)
stringout (filename, [m, n])
stringout (filename, input)
stringout (filename, functions)
stringout (filename, values)
stringout writes expressions to a file in the same form the expressions would be typed for input. The file can then be used as input for the batch or demo commands, and it may be edited for any purpose. stringout can be executed while writefile is in progress.

The global flag file_output_append governs whether stringout appends or truncates the output file. When file_output_append is true, stringout appends to the output file. Otherwise, stringout truncates the output file. In either case, stringout creates the file if it does not yet exist.

The general form of stringout writes the values of one or more expressions to the output file. Note that if an expression is a variable, only the value of the variable is written and not the name of the variable. As a useful special case, the expressions may be input labels (%i1, %i2, %i3, ...) or output labels (%o1, %o2, %o3, ...).

If grind is true, stringout formats the output using the grind format. Otherwise the string format is used. See grind and string.

The special form stringout(filename, [m, n]) writes the values of input labels m through n, inclusive.

The special form stringout(filename, input) writes all input labels to the file.

The special form stringout(filename, functions) writes all user-defined functions (named by the global list functions) to the file.

The special form stringout(filename, values) writes all user-assigned variables (named by the global list values) to the file. Each variable is printed as an assignment statement, with the name of the variable, a colon, and its value. Note that the general form of stringout does not print variables as assignment statements.

with_stdout (f, expr_1, expr_2, expr_3, ...)
with_stdout (s, expr_1, expr_2, expr_3, ...)
Evaluates expr_1, expr_2, expr_3, ... and writes any output thus generated to a file f or output stream s. The evaluated expressions are not written to the output. Output may be generated by print, display, grind, among other functions.

The global flag file_output_append governs whether with_stdout appends or truncates the output file f. When file_output_append is true, with_stdout appends to the output file. Otherwise, with_stdout truncates the output file. In either case, with_stdout creates the file if it does not yet exist.

with_stdout returns the value of its final argument.

See also writefile.

(%i1) with_stdout ("tmp.out", for i:5 thru 10 do
                   print (i, "! yields", i!))$

(%i2) printfile ("tmp.out")$
5 ! yields 120
6 ! yields 720
7 ! yields 5040
8 ! yields 40320
9 ! yields 362880
10 ! yields 3628800

writefile (filename)
Begins writing a transcript of the Maxima session to filename. All interaction between the user and Maxima is then recorded in this file, just as it appears on the console.

As the transcript is printed in the console output format, it cannot be reloaded into Maxima. To make a file containing expressions which can be reloaded, see save and stringout. save stores expressions in Lisp form, while stringout stores expressions in Maxima form.

The effect of executing writefile when filename already exists depends on the underlying Lisp implementation; the transcript file may be clobbered, or the file may be appended. appendfile always appends to the transcript file.

It may be convenient to execute playback after writefile to save the display of previous interactions. As playback displays only the input and output variables (%i1, %o1, etc.), any output generated by a print statement in a function (as opposed to a return value) is not displayed by playback.

closefile closes the transcript file opened by writefile or appendfile.

Maxima – 82 – Files di input e output – funzioni e variabili – 2

Continuo da qui, copio dal Reference Manual, PDF scaricabile da qui, sono a p.252.

These variables specify lists of directories to be searched by load, demo, and some other Maxima functions. The default values of these variables name various directories in the Maxima installation.

The user can modify these variables, either to replace the default values or to append additional directories. For example,
file_search_maxima: ["/usr/local/foo/###.mac", "/usr/local/bar/###.mac"]$
replaces the default value of file_search_maxima, while
file_search_maxima: append (file_search_maxima, ["/usr/local/foo/###.mac", "/usr/local/bar/###.mac"])$ appends two additional directories. It may be convenient to put such an expression in the file maxima-init.mac so that the file search path is assigned automatically when Maxima starts. See also Introduction for Runtime Environment.

Multiple filename extensions and multiple paths can be specified by special “wildcard” constructions. The string ### expands into the sought-after name, while a comma separated list enclosed in curly braces {foo,bar,baz} expands into multiple strings.

For example, supposing the sought-after name is neumann, "/home/{wfs,gcj}/###.{lisp,mac}" expands into /home/wfs/neumann.lisp, /home/gcj/neumann.lisp, /home/wfs/neumann.mac, and /home/gcj/neumann.mac.

file_type (filename)
Returns a guess about the content of filename, based on the filename extension.

filename need not refer to an actual file; no attempt is made to open the file and inspect the content.

The return value is a symbol, either object, lisp, or maxima. If the extension is matches one of the values in file_type_maxima, file_type returns maxima. If the extension matches one of the values in file_type_lisp, file_type returns lisp. If none of the above, file_type returns object.

See also pathname_type. See file_type_maxima and file_type_lisp for the default values.

(%i1) map('file_type, ["test.lisp", "test.mac", "test.dem", "test.txt"]);
(%o1)                   [lisp, maxima, maxima, object]

Default value: [l, lsp, lisp].

file_type_lisp is a list of file extensions that maxima recognizes as denoting a Lisp source file. See also file_type.

Default value: [mac, mc, demo, dem, dm1, dm2, dm3, dmt, wxm].

file_type_maxima is a list of file extensions that maxima recognizes as denoting a Maxima source file. See also file_type.

load (filename)
Evaluates expressions in filename, thus bringing variables, functions, and other objects into Maxima. The binding of any existing object is clobbered by the binding recovered from filename. To find the file, load calls file_search with file_search_maxima and file_search_lisp as the search directories. If load succeeds, it returns the name of the file. Otherwise load prints an error message.

load works equally well for Lisp code and Maxima code. Files created by save, translate_file, and compile_file, which create Lisp code, and stringout, which creates Maxima code, can all be processed by load. load calls loadfile to load Lisp files and batchload to load Maxima files.

load does not recognize :lisp constructs in Maxima files, and while processing filename, the global variables _, __, %, and %th have whatever bindings they had when load was called.

It is also to note that structures will only be read back as structures if they have been defined by defstruct before the load command is called.

See also loadfile, batch, batchload, and demo. loadfile processes Lisp files; batch, batchload, and demo process Maxima files.

See file_search for more detail about the file search mechanism.

load evaluates its argument.

Default value: false.

When a file is loaded with the functions load, loadfile or batchload the system variable load_pathname is bound to the pathname of the file which is processed.

The variable load_pathname can be accessed from the file during the loading. Example: Suppose we have a batchfile test.mac in the directory "/home/dieter/workspace/mymaxima/temp/" with the following commands:
print("The value of load_pathname is: ", load_pathname)$
print("End of batchfile")$
then we get the following output:
(%i1) load("/home/dieter/workspace/mymaxima/temp/test.mac")$
The value of load_pathname is:
End of batchfile

loadfile (filename)
Evaluates Lisp expressions in filename. loadfile does not invoke file_search, so filename must include the file extension and as much of the path as needed to find the file.

loadfile can process files created by save, translate_file, and compile_file.

The user may find it more convenient to use load instead of loadfile.

Default value: true.

loadprint tells whether to print a message when a file is loaded.

  • When loadprint is true, always print a message.
  • When loadprint is 'loadfile, print a message only if a file is loaded by the function loadfile.
  • When loadprint is 'autoload, print a message only if a file is automatically loaded. See setup_autoload.
  • When loadprint is false, never print a message.

directory (path)
Returns a list of the files and directories found in path in the file system. path may contain wildcard characters (i.e., characters which represent unspecified parts of the path), which include at least the asterisk on most systems, and possibly other characters, depending on the system.

directory relies on the Lisp function DIRECTORY, which may have implementation-specific behavior.

pathname_directory (pathname)
pathname_name (pathname)
pathname_type (pathname)
These functions return the components of pathname.

(%i2) pathname_directory("/home/dieter/maxima/changelog.txt");
(%o2)                        /home/dieter/maxima/
(%i3) pathname_name("/home/dieter/maxima/changelog.txt");
(%o3)                              changelog
(%i4) pathname_type("/home/dieter/maxima/changelog.txt");
(%o4)                                 txt

printfile (path)
Prints the file named by path to the console. path may be a string or a symbol; if it is a symbol, it is converted to a string.

If path names a file which is accessible from the current working directory, that file is printed to the console. Otherwise, printfile attempts to locate the file by appending path to each of the elements of file_search_usage via filename_merge.

printfile returns path if it names an existing file, or otherwise the result of a successful filename merge.