
나는 상단에 정의된 변수 캔을 변경할 수 있도록 보고서를 자동화하려고 합니다. 이 변수는 업데이트된 숫자로 문서에 계단식으로 표시됩니다.
내 문제는 함수의 인수가 실제로 다른 방정식인 역삼각 함수를 계산하려고 하는 것입니다(스크린샷 참조). (내 생각에 \def는 tikz에 넣을 때 평가되는 문자열일 뿐입니다.)
누군가 나를 도와줄 수 있습니까?
- 방정식(인수)을 다른 변수로 평가하여 단일 숫자로 해결하거나
- 방정식을 역삼각함수에 적절하게 삽입하는 방법을 설명하거나
- 다른 방법을 도와주시겠어요?
아래 MWE에서 계산기 패키지의 \ARCSIN을 사용하려는 것을 볼 수 있습니다. 더 좋은게 사용가능한가요?
감사해요
\documentclass{article}
\usepackage{calc}
\usepackage{calculator}
\usepackage{trig}
\begin{document}
%% Defined Variables
\def\CrankAngle{170} % Angle position of the crank for piston dynamics
\def\Stroke{60} % Piston stroke, which is equivalent to crank working diameter
\def\ConRodLength{100} % Length of connecting rod
\def\PistonOffset{25} % L_o - offset of the piston cylinder from the crank centerline
%% Derived Variables (Calculated from Defined Variables)
\CalculateCos{\CrankAngle} % Need to pre-calculate the value before using
\def\StrokeXPos{\UseCos{\CrankAngle}*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO
\CalculateSin{\CrankAngle} % Need to pre-calculate the value before using
\def\StrokeYPos{\UseSin{\CrankAngle}*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO
\def\ConRodYOffset{\PistonOffset -\StrokeYPos}
\def\ConRodSinRatio{\ConRodYOffset/\ConRodLength}
%\ARCSIN{\ConRodSinRatio}{\sol} - WHAT TO USE THIS (OR SIMILAR) BUT NEED NUMBER IN RATIO; NOT EXPRESSION
\section{Sample Evaluations}
X-Position = \StrokeXPos
Y-Position = \StrokeYPos
Con Rod Y-Offset = \ConRodYOffset
Con Rod Sin Ratio = \ConRodSinRatio
\end{document}
답변1
pgf
나는 항상 계산에 사용해 왔으며 훌륭하게 작동하는 것 같습니다.
암호:
\documentclass{article}
\usepackage{mathtools}% For {align*}
\usepackage{pgf}
\begin{document}
%% Defined Variables
\def\CrankAngle{170} % Angle position of the crank for piston dynamics
\def\Stroke{60} % Piston stroke, which is equivalent to crank working diameter
\def\ConRodLength{100} % Length of connecting rod
\def\PistonOffset{25} % L_o - offset of the piston cylinder from the crank centerline
%% Derived Variables (Calculated from Defined Variables)
\pgfmathsetmacro\StrokeXPos{cos(\CrankAngle)*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO
\pgfmathsetmacro\StrokeYPos{sin(\CrankAngle)*\Stroke/2} % Assign the value of the recently-calculated sin to a global variable MUST DO
\pgfmathsetmacro\ConRodYOffset{\PistonOffset -\StrokeYPos}
\pgfmathsetmacro\ConRodSinRatio{\ConRodYOffset/\ConRodLength}
\pgfmathsetmacro\ArcSinValue{asin(\ConRodSinRatio)}
\section{Sample Evaluations}
\begin{align*}
\text{X-Position} &= \StrokeXPos \\
\text{Y-Position} &= \StrokeYPos \\
\text{Con Rod Y-Offset} &= \ConRodYOffset \\
\text{Con Rod Sin Ratio} &= \ConRodSinRatio \\
\text{Arc Sin Value} &= \ArcSinValue \\
\end{align*}
\end{document}