Matrix mit Zeitabhängigen Funktionen Partiellableiten

46 views
Skip to first unread message

nils Frank

unread,
Feb 19, 2025, 9:25:45 PM2/19/25
to sympy
Hallo,
Hat jemand eine Idee wie man die folgende Matrix definieren muss damit man Sie nach t ableiten kann? 

Ich habe Folgenden Code geschrieben und es funktioniert nicht mit  " .diff(t) "

import sympy as sp

a = sp.Symbol("a")
t = sp.Symbol("t")
l = sp.Symbol("l")
phi = Function('phi')(t)

from sympy import *
init_printing(use_unicode=True)


r_0p = Matrix([l*sin(phi), a*cos(2*phi)+3*t**2, 0])
r_0p
 
ich möchte nun r_0p nach t ableiten
der Daten Typ der Matrix wird als "sympy.matrices.dense.MutableDenseMatrix"

wenn versuche ich, wie folgt, die Matrix nach t abzuleiten

(r_0p_deff = r_0p.deff(t)
r_0p_deff

Kommt der Fehler
AttributeError: 'MutableDenseMatrix' object has no attribute 'deff'  



Bei dem Folgenden Code funktioniert es, auch wenn ich hier die Bedeutung der inneren Klammern bei der Ausgabe nicht verstehe.

a = Matrix([x*y,z,4*y])
a

type(a)
= sympy.matrices.dense.MutableDenseMatrix

# leitet die Matrix ab
a_diff = a.diff(r)
a_diff


hat jemand eine Idee??


Matrix Code diff(t) Attribut problem.jpg

Jason Moore

unread,
Feb 19, 2025, 10:55:49 PM2/19/25
to sy...@googlegroups.com
It seems you typed "deff" not "diff".

Jason


--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sympy/39e25bce-8538-44a1-8f15-9b2e6286e25an%40googlegroups.com.

peter.st...@gmail.com

unread,
Feb 20, 2025, 12:43:05 AM2/20/25
to sy...@googlegroups.com

import sympy as sm

a, l, t = sm.symbols('a l t')

phi = sm.Function('phi')(t)

dt = sm.Matrix([l*sm.sin(phi), l*sm.cos(phi) + 3*t**2, 0]).diff(t)

dt

Funktionierte bei mir problemlos.

Vielleicht hilft phi = sp.Function(‚phi‘)(t)

 

NB: Besser Du schreibst auf englisch, das können mehr Leute lesen.

--

image001.png

nils Frank

unread,
Feb 20, 2025, 1:47:52 AM2/20/25
to sympy
oh that's embarrassing now,
thanks for the hint!
Reply all
Reply to author
Forward
0 new messages