0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

(四角錘)「2019年度 京都大・文系数学問5」をsympyとvbaソルバーとwolframalphaでやってみたい。

Last updated at Posted at 2021-11-08

オリジナル

球面に内接する四角錘

問題

SymPy Liveで(微分)

以下のソースコードを貼り付けて、Evaluateです。

from sympy import *
var('r h')
f=(sqrt(r**2 - h**2) / sqrt(2) * 2)**2 * (r +h ) / 3
t=solve(diff(f,h), h)
print("#",t[1].subs({r:1}),f.subs({r:1,h:t[1]}))
# 1/3 64/81

matplotlibでグラフ作成。勉強中。

SymPy Liveで(非線形方程式)

勉強中。おすすめ。アドバイス下さい。

vbaソルバーで

????教えて下さい。
行数を少なくする方法を教えて下さい。
よろしくお願いします。

Const r = 1
Function myR1C1toA1(i, j)
    myR1C1toA1 = Application.ConvertFormula("R" & i & "C" & j, xlR1C1, xlA1)
End Function
Sub myTaiseki()
    Range(myR1C1toA1(2, 1)).Formula = "= (sqrt( 1^ 2 - " & myR1C1toA1(1, 1) & "^ 2) / sqrt(2) * 2) ^ 2 * (1 +" & myR1C1toA1(1, 1) & ") / 3"
    Dim ws As Worksheet: Set ws = ActiveSheet
    SolverReset
    SolverOk setCell:=ws.Range(myR1C1toA1(2, 1)), _
                      MaxMinVal:=1, _
                      ByChange:=ws.Range(myR1C1toA1(1, 1)), _
                      EngineDesc:="GRG Nonlinear"
    SolverOptions AssumeNonNeg:=True
    SolverSolve UserFinish:=True
End Sub
Sub myFormat()
    Range("A1:B1").Select
    Selection.NumberFormatLocal = "0.000_ "
    Range("B1") = 1 / 3
    Range("B2") = 64 / 81
    Range("A1").Select
End Sub
Sub aaa_Main()
    Dim myTS As Variant
    ActiveSheet.Cells.Clear
    Call myTaiseki
    myFormat
End Sub
' 0.333 	0.333 
' 0.790123457	0.790123457

Dim myTSは、不要です。

wolframalphaで

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?