LINUX.ORG.RU

Сообщения saufesma

 

Как убрать \" из строки

 , ,

нужно убрать \"
;"(\"- F1 * (a - a1) + F2 * (a2 - a) + F3 * (a3 - a)\") / (\"b - a\")"

и получить 

 "(- F1 * (a - a1) + F2 * (a2 - a) + F3 * (a3 - a)) / (b - a)"

используя emacs API
saufesma
()

Не могу преобразовать string

 ,

(defun f-F-a (product lst1 lst2)
  (if (eq (car lst1) nil)
 product
    (f-F-a (cons (message "%S * %S" (car lst1) (car lst2)) product) (cdr lst1) (cdr lst2))))

(f-F-a '() '("- F1" "+ F2" "- F3")  '("a1" "a2" "a3")) ;;=>
;;=> ("\"- F3\" * \"a3\"" "\"+ F2\" * \"a2\"" "\"- F1\" * \"a1\"") получилось
;;а хочется вот так
;;"- F3 * a3 + F2 * a2 - F1 * a1"
напишите кодом, как это можно сделать, пожалуйста.
(require 'subr)
Debugger entered--Lisp error: (error "Loading file /usr/share/emacs/27.1/lisp/subr.elc f...")
  require(subr)
(string-trim "f" "jdjjfjjj") => "f"
(string-trim "jdjjfjjj" "f") => "jdjjfjjj"
(string-trim-left "f" "jdjjfjjj") => "f"
(string-trim-right "jdjjfjjj" "f") => "jdjjfjjj"
saufesma
()

Программирование термодинамических задач

 , , ,

Кто нибудь программировал такую задачу

В точку на поверхности пластины ввели тепла (кал) в течении нескольких секунд, затем источник тепла убрали. Надо определить скорость распространения температуры по пластине, конечную температуру пластины. Все решаемые задачи в краевых условиях оговаривают одинаковую температуру по телу. Мне это не помогает.

Какое время нагрева, размеры участка нагрева, размеры пластины, какой коэффициент теплопроводности. И что именно надо в итоге получить (и зачем).

Пластина 300Х300 мм
Толщина пластины 4 мм
Теплопроводность 41 Вт/(м град)
Скорость движения электрода 22 м/ч
Мощность дуги 1833 Вт
Среда окружающая атмосфера
Получить время остывания шва от 1540 град до 600 град

У меня создалось впечатление, из разговора с Вами, что под каждую сварную кострукцию надо решать уравнение теплопрводности. Вы понимаете, что Вы просто подрываете авторитет наших сварщиков технологов!

AntonI ну и все кому интересно.

saufesma
()

Какjdf конфигурация .emacs

 , ,

Как у товарища настроен emacs вот тут https://www.youtube.com/watch?v=p4HH8w3f-8s

saufesma
()

Как сохранить output from gnuplot in dxf

 ,

set terminal dxf
load 'plot.txt'

выплевывает все на терминал а в файл никак.

saufesma
()

Есть ли такая рисующая графики софта

 , ,

Провожу из ординаты параллельную оси абсцисс линию которая пересекает какую-то кривую и точка, по абсциссе, пересечения кривой с прямой выдается автоматом. В gnuplot такого не нашел, а может просто нет такого.

saufesma
()

Как установить SMOKE

 

Как установить вот это

https://techbase.kde.org/Languages/Smoke

такого пакета, Smoke, я просто не нашел

saufesma
()

Как возникает распределение Пуассона

 

В физико-математическом журнале «Квант» N8 за 1988 год приводится статья «Распределение Пуассона» в конце которой говорится о следующей статье «Как возникает распределение Пуассона» и найти эту статью у меня не вышло. Может у кого завалялась? Выложте пожалуйста.

saufesma
()

Нужна книга по обработке данных статистическими методами

 ,

Проводятся исследования, снимаются показания нескольких значений. Их надо сравнить с теоретически полученными значениями. И проверить всё ли у меня сростётся в будущем. Для таких познаний нужна книжка, а какая не знаю. Не подскажите?

Если можно, пример
Прыгун на          Прыгнул      Время
скакалке            раз        прыгал
1                  15           1мин
2                  10           10сек
3                  20           30сек

надо узнать кто больше раз напрыгает в будущем за меньшее время.

Перемещено hobbit из general

saufesma
()

Не понял как ввести мой интеграл в maxima

 , ,

Как у меня примера не нашёл, сам догадаться не смог как записать правильно в maxim.

integrate((2*q*dt)/(c*γ*[4*π*a*(t-t')]^(3/2)),t,0,t);
incorrect syntax: ' is not an infix operator
\263*[4*Space%piSpace*a*(t-t')

переделал так
integrate((2*q*dt)/(c*γ*[4*π*a*(t-к)]^(3/2)),t,0,7);
Is r-7 positive, negative or zero?

подправил и что-то вышло не понятное
(%i7)	integrate((2*q)/(c*γ*[4*π*a*(t-r)]^(3/2)),t,0,t);
"Is "t" positive, negative or zero?"positivew;
"Is "t" positive, negative or zero?"positivew;
"Is "t" positive, negative or zero?"positive;
"Is "t-r" positive, negative or zero?"positive;
"Is "r" positive, negative or zero?"positive;
(%o7)	[(q*integrate(1/(a*(t-r))^(3/2),t,0,t))/(4*%pi^(3/2)*c*γ)]

мне надо вот это https://dropmefiles.com/tfLUi решить в maxima.

saufesma
()

Сомневаюсь в правильности логарифмирования уравнения

 

Форум математиков есть http://www.mathforum.ru, а вот где сами математики не пойму. Позтому я сюда.

Θ = (1 / ρ) * e^(- ρ * ( 1 + cos φ))

логарифмирую

ln Θ = (ln 1 - ln ρ) + (- ρ * ( 1 + cos φ)) ln e = (0 - ln ρ) + (- ρ * ( 1 + cos φ)) * 1 =

= - ln ρ + (- ρ * ( 1 + cos φ)) <------- вот тут мои сомнения при потенциировании, всётаки после - ln ρ идет действие сложения но логарифма нет.

потенциирую

Θ = - ρ – ρ * ( 1 + cos φ) = - ρ * (1 + ( 1 + cos φ)) = ρ * (- 1 - ( 1 + cos φ))

откуда
ρ = Θ / (- 1 - ( 1 + cos φ))

Maxima очень вас рекомендуют с возникшей проблемой. Не поможете?

saufesma
()

Нужна рисующая графики софта

 ,

Нужна рисующая графики софта которая может определять координаты точки пересечения какой-то кривой с какой-то прямой.

saufesma
()

Установка wine

 ,

Такие вещи как то обруливаются.

W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-2.5-0_2.5.14+df... 404 Not Found [IP: 185.125.190.36 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/l/llvm-toolchain-15/libllvm15_15.0... 404 Not Found [IP: 185.125.190.36 80]

W: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/o/openldap/libldap-common_2.5.14+d... 404 Not Found [IP: 185.125.190.36 80]

если да то как.

saufesma
()

python3 sqrt не понял, что происходит

 ,

Всем привет,

Cкрипт работает и превращает <sqrt(2.)*a> в sqrt(2.)*7 затем вызывает sqrt(2.)*7 и возвращает значение.

Попробовал поиграться

$python3
>>> sqrt(2.)*7
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sqrt' is not defined

>>> from math import sqrt
>>> sqrt(2.)*7
9.899494936611665

Добавил в скрипт

from math import sqrt

ошибка осталась

******* ERROR ********
Line 27 in par.pre.fbd

swep p4 p5 tra <sqrt(2.)*a> 0 0 2

'NoneType' object is not callable

Что ещё можно сделать?

saufesma
()

Как в gnuplot определить координаты пересечения линий

 ,

Как в gnuplot программно определить координаты пересечения кривых с прямыми по оси абсцисс? Или для таких случаев надо другой инструмент, тогда подскажите какой?

https://wdfiles.ru/425abc7

saufesma
()

Старая, добрая рекурсия но в labels

 ,

(defvar *result*)
(setq *result* 0)
(defun sum-list (lst)
  (if (eq (car lst) nil)
      *result*
    (progn
      (setq *result* (+ *result* (car lst)))
      (sum-list (cdr lst)))))

(sum-list '(1 2 3 4 5)) => 15

переписал, что-не доходит с labels. Никак не могу понять как она создаёт место в памяти и суммирует туда

(defun labels-sum-list (lst n)
  (labels ((temp (lst)
             (if (eq (car lst) nil)
                 n
               (progn
                 (setq n (+ n (car lst)))))))
    (temp (cdr lst))))

(labels-sum-list '(1 2 3 4 5) 0) => 2

Кто-то может подправить код, растолковать работу labels.

saufesma
()

Программа управления е-mail box

 ,

Не могу посмотреть почту в ящике на yandex.ru, заставляет меня что то купить, а через dzen.ru он ко всем моим данным доступ будет иметь. Есть ли такая программа с помощью которой я мог бы скачать почту не заходя в ящик, ну и заодно и отправлять сообщения таким же манером, не заходя в ящик.

saufesma
()

Как тестировать чужой код когда он не совсем укладывается в spec языка

 ,

(defun is-var (expr)
  "is this a variable (i.e. starts with ?)"
  (and (symbolp expr) (eql (char (symbol-name expr) 0) #\?)))

(defun find-vars (expr)
  "returns a list of all the variables in expr"
  (if (consp expr) (append (find-vars (car expr)) (find-vars (cdr expr))) ;; Kак этот append работает?
    (if (is-var expr) (list expr) nil)))

тестирую append

CL-USER 2 > (append 'Z '(a sd))
Error: Z (of type SYMBOL) is not of type LIST.

CL-USER 3 : 1 > (append (car '(1 2 3)) (cdr '(1 2 3)))
Error: 1 (of type FIXNUM) is not of type LIST.

CL-USER 17 > (append (car '(s d f)) (cdr '(1 2 3)))
Error: S (of type SYMBOL) is not of type LIST.

А ведь тут работает, почему?

CL-USER 13 > (find-vars '?)
(?)

CL-USER 16 > (find-vars '(s d ?))
(?)

saufesma
()

slime Coonection part

 , , , ,

Тут кусок кода из slime, видно, что люди понимают то, что они делают. Главная тут make-connection, как с ней поиграться можно? Какими ещё знаниями нужно обладать чтобы написать этот код? Помимо того, что для соединения нам надо знать имя сайта и его IP адрес, в данном случае localhost, да, и порт на котором будет подключение.

Почитав код я что-то понял, а с чем-то надо поиграться, а как не знаю, чего-то не хватает, подскажите, где, как поиграться? А там глядишь и найду чего не хватает.

;;;; Connections
;;;
;;; Connection structures represent the network connections between
;;; Emacs and Lisp. Each has a socket stream, a set of user I/O
;;; streams that redirect to Emacs, and optionally a second socket
;;; used solely to pipe user-output to Emacs (an optimization).  This
;;; is also the place where we keep everything that needs to be
;;; freed/closed/killed when we disconnect.

(defstruct (connection
             (:constructor %make-connection)
             (:conc-name connection.)
             (:print-function print-connection))
  ;; The listening socket. (usually closed)
  (socket           (missing-arg) :type t :read-only t)
  ;; Character I/O stream of socket connection.  Read-only to avoid
  ;; race conditions during initialization.
  (socket-io        (missing-arg) :type stream :read-only t)
  ;; Optional dedicated output socket (backending `user-output' slot).
  ;; Has a slot so that it can be closed with the connection.
  (dedicated-output nil :type (or stream null))
  ;; Streams that can be used for user interaction, with requests
  ;; redirected to Emacs.
  (user-input       nil :type (or stream null))
  (user-output      nil :type (or stream null))
  (user-io          nil :type (or stream null))
  ;; Bindings used for this connection (usually streams)
  (env '() :type list)
  ;; A stream that we use for *trace-output*; if nil, we user user-output.
  (trace-output     nil :type (or stream null))
  ;; A stream where we send REPL results.
  (repl-results     nil :type (or stream null))
  ;; Cache of macro-indentation information that has been sent to Emacs.
  ;; This is used for preparing deltas to update Emacs's knowledge.
  ;; Maps: symbol -> indentation-specification
  (indentation-cache (make-hash-table :test 'eq) :type hash-table)
  ;; The list of packages represented in the cache:
  (indentation-cache-packages '())
  ;; The communication style used.
  (communication-style nil :type (member nil :spawn :sigio :fd-handler))
  )

(defun print-connection (conn stream depth)
  (declare (ignore depth))
  (print-unreadable-object (conn stream :type t :identity t)))

(defstruct (singlethreaded-connection (:include connection)
                                      (:conc-name sconn.))
  ;; The SIGINT handler we should restore when the connection is
  ;; closed.
  saved-sigint-handler
  ;; A queue of events.  Not all events can be processed in order and
  ;; we need a place to stored them.
  (event-queue '() :type list)
  ;; A counter that is incremented whenever an event is added to the
  ;; queue.  This is used to detected modifications to the event queue
  ;; by interrupts.  The counter wraps around.
  (events-enqueued 0 :type fixnum))

(defstruct (multithreaded-connection (:include connection)
                                     (:conc-name mconn.))
  ;; In multithreaded systems we delegate certain tasks to specific
  ;; threads. The `reader-thread' is responsible for reading network
  ;; requests from Emacs and sending them to the `control-thread'; the
  ;; `control-thread' is responsible for dispatching requests to the
  ;; threads that should handle them; the `repl-thread' is the one
  ;; that evaluates REPL expressions. The control thread dispatches
  ;; all REPL evaluations to the REPL thread and for other requests it
  ;; spawns new threads.
  reader-thread
  control-thread
  repl-thread
  auto-flush-thread
  indentation-cache-thread
  ;; List of threads that are currently processing requests.  We use
  ;; this to find the newest/current thread for an interrupt.  In the
  ;; future we may store here (thread . request-tag) pairs so that we
  ;; can interrupt specific requests.
  (active-threads '() :type list)
  )

(defvar *emacs-connection* nil
  "The connection to Emacs currently in use.")

(defun make-connection (socket stream style)
  (let ((conn (funcall (ecase style
                         (:spawn
                          #'make-multithreaded-connection)
                         ((:sigio nil :fd-handler)
                          #'make-singlethreaded-connection))
                       :socket socket
                       :socket-io stream
                       :communication-style style)))
    (run-hook *new-connection-hook* conn)
    (send-to-sentinel `(:add-connection ,conn))
    conn))

(defslimefun ping (tag)
  tag)

(defun safe-backtrace ()
  (ignore-errors
    (call-with-debugging-environment
     (lambda () (backtrace 0 nil)))))

(define-condition swank-error (error)
  ((backtrace :initarg :backtrace :reader swank-error.backtrace)
   (condition :initarg :condition :reader swank-error.condition))
  (:report (lambda (c s) (princ (swank-error.condition c) s)))
  (:documentation "Condition which carries a backtrace."))

(defun signal-swank-error (condition &optional (backtrace (safe-backtrace)))
  (error 'swank-error :condition condition :backtrace backtrace))

(defvar *debug-on-swank-protocol-error* nil
  "When non-nil invoke the system debugger on errors that were
signalled during decoding/encoding the wire protocol.  Do not set this
to T unless you want to debug swank internals.")

(defmacro with-swank-error-handler ((connection) &body body)
  "Close the connection on internal `swank-error's."
  (let ((conn (gensym)))
  `(let ((,conn ,connection))
     (handler-case
         (handler-bind ((swank-error
                         (lambda (condition)
                           (when *debug-on-swank-protocol-error*
                             (invoke-default-debugger condition)))))
           (progn . ,body))
       (swank-error (condition)
         (close-connection ,conn
                           (swank-error.condition condition)
                           (swank-error.backtrace condition)))))))

(defmacro with-panic-handler ((connection) &body body)
  "Close the connection on unhandled `serious-condition's."
  (let ((conn (gensym)))
    `(let ((,conn ,connection))
       (handler-bind ((serious-condition
                        (lambda (condition)
                          (close-connection ,conn condition (safe-backtrace))
                          (abort condition))))
         . ,body))))

(add-hook *new-connection-hook* 'notify-backend-of-connection)
(defun notify-backend-of-connection (connection)
  (declare (ignore connection))
  (emacs-connected))
saufesma
()

Никто не поверит!

 , ,

saufesma
()

RSS подписка на новые темы